diff options
282 files changed, 4809 insertions, 2741 deletions
| @@ -92,6 +92,7 @@ Rudolf Marek <R.Marek@sh.cvut.cz> | |||
| 92 | Rui Saraiva <rmps@joel.ist.utl.pt> | 92 | Rui Saraiva <rmps@joel.ist.utl.pt> |
| 93 | Sachin P Sant <ssant@in.ibm.com> | 93 | Sachin P Sant <ssant@in.ibm.com> |
| 94 | Sam Ravnborg <sam@mars.ravnborg.org> | 94 | Sam Ravnborg <sam@mars.ravnborg.org> |
| 95 | Sascha Hauer <s.hauer@pengutronix.de> | ||
| 95 | S.Çağlar Onur <caglar@pardus.org.tr> | 96 | S.Çağlar Onur <caglar@pardus.org.tr> |
| 96 | Simon Kelley <simon@thekelleys.org.uk> | 97 | Simon Kelley <simon@thekelleys.org.uk> |
| 97 | Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr> | 98 | Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr> |
| @@ -100,6 +101,7 @@ Tejun Heo <htejun@gmail.com> | |||
| 100 | Thomas Graf <tgraf@suug.ch> | 101 | Thomas Graf <tgraf@suug.ch> |
| 101 | Tony Luck <tony.luck@intel.com> | 102 | Tony Luck <tony.luck@intel.com> |
| 102 | Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com> | 103 | Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com> |
| 103 | Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> | ||
| 104 | Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> | 104 | Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> |
| 105 | Uwe Kleine-König <ukl@pengutronix.de> | ||
| 106 | Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> | ||
| 105 | Valdis Kletnieks <Valdis.Kletnieks@vt.edu> | 107 | Valdis Kletnieks <Valdis.Kletnieks@vt.edu> |
diff --git a/Documentation/filesystems/ubifs.txt b/Documentation/filesystems/ubifs.txt index 84da2a4ba25a..12fedb7834c6 100644 --- a/Documentation/filesystems/ubifs.txt +++ b/Documentation/filesystems/ubifs.txt | |||
| @@ -79,13 +79,6 @@ Mount options | |||
| 79 | 79 | ||
| 80 | (*) == default. | 80 | (*) == default. |
| 81 | 81 | ||
| 82 | norm_unmount (*) commit on unmount; the journal is committed | ||
| 83 | when the file-system is unmounted so that the | ||
| 84 | next mount does not have to replay the journal | ||
| 85 | and it becomes very fast; | ||
| 86 | fast_unmount do not commit on unmount; this option makes | ||
| 87 | unmount faster, but the next mount slower | ||
| 88 | because of the need to replay the journal. | ||
| 89 | bulk_read read more in one go to take advantage of flash | 82 | bulk_read read more in one go to take advantage of flash |
| 90 | media that read faster sequentially | 83 | media that read faster sequentially |
| 91 | no_bulk_read (*) do not bulk-read | 84 | no_bulk_read (*) do not bulk-read |
diff --git a/MAINTAINERS b/MAINTAINERS index 474ec0c53272..0ea3a6d98714 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -911,7 +911,7 @@ S: Maintained | |||
| 911 | BLACKFIN ARCHITECTURE | 911 | BLACKFIN ARCHITECTURE |
| 912 | P: Bryan Wu | 912 | P: Bryan Wu |
| 913 | M: cooloney@kernel.org | 913 | M: cooloney@kernel.org |
| 914 | L: uclinux-dist-devel@blackfin.uclinux.org (subscribers-only) | 914 | L: uclinux-dist-devel@blackfin.uclinux.org |
| 915 | W: http://blackfin.uclinux.org | 915 | W: http://blackfin.uclinux.org |
| 916 | S: Supported | 916 | S: Supported |
| 917 | 917 | ||
| @@ -1021,6 +1021,14 @@ M: mb@bu3sch.de | |||
| 1021 | W: http://bu3sch.de/btgpio.php | 1021 | W: http://bu3sch.de/btgpio.php |
| 1022 | S: Maintained | 1022 | S: Maintained |
| 1023 | 1023 | ||
| 1024 | BTRFS FILE SYSTEM | ||
| 1025 | P: Chris Mason | ||
| 1026 | M: chris.mason@oracle.com | ||
| 1027 | L: linux-btrfs@vger.kernel.org | ||
| 1028 | W: http://btrfs.wiki.kernel.org/ | ||
| 1029 | T: git kernel.org:/pub/scm/linux/kernel/git/mason/btrfs-unstable.git | ||
| 1030 | S: Maintained | ||
| 1031 | |||
| 1024 | BTTV VIDEO4LINUX DRIVER | 1032 | BTTV VIDEO4LINUX DRIVER |
| 1025 | P: Mauro Carvalho Chehab | 1033 | P: Mauro Carvalho Chehab |
| 1026 | M: mchehab@infradead.org | 1034 | M: mchehab@infradead.org |
| @@ -2212,7 +2220,7 @@ P: Sean Hefty | |||
| 2212 | M: sean.hefty@intel.com | 2220 | M: sean.hefty@intel.com |
| 2213 | P: Hal Rosenstock | 2221 | P: Hal Rosenstock |
| 2214 | M: hal.rosenstock@gmail.com | 2222 | M: hal.rosenstock@gmail.com |
| 2215 | L: general@lists.openfabrics.org | 2223 | L: general@lists.openfabrics.org (moderated for non-subscribers) |
| 2216 | W: http://www.openib.org/ | 2224 | W: http://www.openib.org/ |
| 2217 | T: git kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git | 2225 | T: git kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git |
| 2218 | S: Supported | 2226 | S: Supported |
| @@ -4841,6 +4849,7 @@ P: Ingo Molnar | |||
| 4841 | M: mingo@redhat.com | 4849 | M: mingo@redhat.com |
| 4842 | P: H. Peter Anvin | 4850 | P: H. Peter Anvin |
| 4843 | M: hpa@zytor.com | 4851 | M: hpa@zytor.com |
| 4852 | M: x86@kernel.org | ||
| 4844 | L: linux-kernel@vger.kernel.org | 4853 | L: linux-kernel@vger.kernel.org |
| 4845 | T: git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git | 4854 | T: git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git |
| 4846 | S: Maintained | 4855 | S: Maintained |
diff --git a/arch/alpha/include/asm/bug.h b/arch/alpha/include/asm/bug.h index 7b85b7c93709..1720c8ad86fe 100644 --- a/arch/alpha/include/asm/bug.h +++ b/arch/alpha/include/asm/bug.h | |||
| @@ -8,12 +8,12 @@ | |||
| 8 | 8 | ||
| 9 | /* ??? Would be nice to use .gprel32 here, but we can't be sure that the | 9 | /* ??? Would be nice to use .gprel32 here, but we can't be sure that the |
| 10 | function loaded the GP, so this could fail in modules. */ | 10 | function loaded the GP, so this could fail in modules. */ |
| 11 | #define BUG() { \ | 11 | #define BUG() do { \ |
| 12 | __asm__ __volatile__( \ | 12 | __asm__ __volatile__( \ |
| 13 | "call_pal %0 # bugchk\n\t" \ | 13 | "call_pal %0 # bugchk\n\t" \ |
| 14 | ".long %1\n\t.8byte %2" \ | 14 | ".long %1\n\t.8byte %2" \ |
| 15 | : : "i"(PAL_bugchk), "i"(__LINE__), "i"(__FILE__)); \ | 15 | : : "i"(PAL_bugchk), "i"(__LINE__), "i"(__FILE__)); \ |
| 16 | for ( ; ; ); } | 16 | for ( ; ; ); } while (0) |
| 17 | 17 | ||
| 18 | #define HAVE_ARCH_BUG | 18 | #define HAVE_ARCH_BUG |
| 19 | #endif | 19 | #endif |
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 77b047475539..85040cfeb5e5 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S | |||
| @@ -650,6 +650,7 @@ ENTRY(fp_enter) | |||
| 650 | no_fp: mov pc, lr | 650 | no_fp: mov pc, lr |
| 651 | 651 | ||
| 652 | __und_usr_unknown: | 652 | __und_usr_unknown: |
| 653 | enable_irq | ||
| 653 | mov r0, sp | 654 | mov r0, sp |
| 654 | adr lr, ret_from_exception | 655 | adr lr, ret_from_exception |
| 655 | b do_undefinstr | 656 | b do_undefinstr |
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 06269ea375c5..49a6ba926c2b 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S | |||
| @@ -136,7 +136,7 @@ ENTRY(mcount) | |||
| 136 | ldmia sp!, {r0-r3, pc} | 136 | ldmia sp!, {r0-r3, pc} |
| 137 | 137 | ||
| 138 | trace: | 138 | trace: |
| 139 | ldr r1, [fp, #-4] | 139 | ldr r1, [fp, #-4] @ lr of instrumented routine |
| 140 | mov r0, lr | 140 | mov r0, lr |
| 141 | sub r0, r0, #MCOUNT_INSN_SIZE | 141 | sub r0, r0, #MCOUNT_INSN_SIZE |
| 142 | mov lr, pc | 142 | mov lr, pc |
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 7141cee1fab7..363db186cb93 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c | |||
| @@ -101,7 +101,7 @@ unlock: | |||
| 101 | /* Handle bad interrupts */ | 101 | /* Handle bad interrupts */ |
| 102 | static struct irq_desc bad_irq_desc = { | 102 | static struct irq_desc bad_irq_desc = { |
| 103 | .handle_irq = handle_bad_irq, | 103 | .handle_irq = handle_bad_irq, |
| 104 | .lock = SPIN_LOCK_UNLOCKED | 104 | .lock = __SPIN_LOCK_UNLOCKED(bad_irq_desc.lock), |
| 105 | }; | 105 | }; |
| 106 | 106 | ||
| 107 | /* | 107 | /* |
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c index c2a96e3965a6..e61967dde9a1 100644 --- a/arch/arm/mach-msm/board-halibut.c +++ b/arch/arm/mach-msm/board-halibut.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <asm/mach/map.h> | 27 | #include <asm/mach/map.h> |
| 28 | #include <asm/mach/flash.h> | 28 | #include <asm/mach/flash.h> |
| 29 | 29 | ||
| 30 | #include <mach/irqs.h> | ||
| 30 | #include <mach/board.h> | 31 | #include <mach/board.h> |
| 31 | #include <mach/msm_iomap.h> | 32 | #include <mach/msm_iomap.h> |
| 32 | 33 | ||
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c index 77382d8b6b2f..ba5d7c08dc17 100644 --- a/arch/arm/mach-omap1/devices.c +++ b/arch/arm/mach-omap1/devices.c | |||
| @@ -181,7 +181,7 @@ void __init omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, | |||
| 181 | } | 181 | } |
| 182 | size = OMAP1_MMC_SIZE; | 182 | size = OMAP1_MMC_SIZE; |
| 183 | 183 | ||
| 184 | omap_mmc_add(i, base, size, irq, mmc_data[i]); | 184 | omap_mmc_add("mmci-omap", i, base, size, irq, mmc_data[i]); |
| 185 | }; | 185 | }; |
| 186 | } | 186 | } |
| 187 | 187 | ||
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c index ca7a0cc1707c..575ba31295cf 100644 --- a/arch/arm/mach-omap1/mcbsp.c +++ b/arch/arm/mach-omap1/mcbsp.c | |||
| @@ -28,81 +28,8 @@ | |||
| 28 | #define DPS_RSTCT2_PER_EN (1 << 0) | 28 | #define DPS_RSTCT2_PER_EN (1 << 0) |
| 29 | #define DSP_RSTCT2_WD_PER_EN (1 << 1) | 29 | #define DSP_RSTCT2_WD_PER_EN (1 << 1) |
| 30 | 30 | ||
| 31 | struct mcbsp_internal_clk { | ||
| 32 | struct clk clk; | ||
| 33 | struct clk **childs; | ||
| 34 | int n_childs; | ||
| 35 | }; | ||
| 36 | |||
| 37 | #if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) | 31 | #if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) |
| 38 | static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk) | 32 | const char *clk_names[] = { "dsp_ck", "api_ck", "dspxor_ck" }; |
| 39 | { | ||
| 40 | const char *clk_names[] = { "dsp_ck", "api_ck", "dspxor_ck" }; | ||
| 41 | int i; | ||
| 42 | |||
| 43 | mclk->n_childs = ARRAY_SIZE(clk_names); | ||
| 44 | mclk->childs = kzalloc(mclk->n_childs * sizeof(struct clk *), | ||
| 45 | GFP_KERNEL); | ||
| 46 | |||
| 47 | for (i = 0; i < mclk->n_childs; i++) { | ||
| 48 | /* We fake a platform device to get correct device id */ | ||
| 49 | struct platform_device pdev; | ||
| 50 | |||
| 51 | pdev.dev.bus = &platform_bus_type; | ||
| 52 | pdev.id = mclk->clk.id; | ||
| 53 | mclk->childs[i] = clk_get(&pdev.dev, clk_names[i]); | ||
| 54 | if (IS_ERR(mclk->childs[i])) | ||
| 55 | printk(KERN_ERR "Could not get clock %s (%d).\n", | ||
| 56 | clk_names[i], mclk->clk.id); | ||
| 57 | } | ||
| 58 | } | ||
| 59 | |||
| 60 | static int omap_mcbsp_clk_enable(struct clk *clk) | ||
| 61 | { | ||
| 62 | struct mcbsp_internal_clk *mclk = container_of(clk, | ||
| 63 | struct mcbsp_internal_clk, clk); | ||
| 64 | int i; | ||
| 65 | |||
| 66 | for (i = 0; i < mclk->n_childs; i++) | ||
| 67 | clk_enable(mclk->childs[i]); | ||
| 68 | return 0; | ||
| 69 | } | ||
| 70 | |||
| 71 | static void omap_mcbsp_clk_disable(struct clk *clk) | ||
| 72 | { | ||
| 73 | struct mcbsp_internal_clk *mclk = container_of(clk, | ||
| 74 | struct mcbsp_internal_clk, clk); | ||
| 75 | int i; | ||
| 76 | |||
| 77 | for (i = 0; i < mclk->n_childs; i++) | ||
| 78 | clk_disable(mclk->childs[i]); | ||
| 79 | } | ||
| 80 | |||
| 81 | static struct mcbsp_internal_clk omap_mcbsp_clks[] = { | ||
| 82 | { | ||
| 83 | .clk = { | ||
| 84 | .name = "mcbsp_clk", | ||
| 85 | .id = 1, | ||
| 86 | .enable = omap_mcbsp_clk_enable, | ||
| 87 | .disable = omap_mcbsp_clk_disable, | ||
| 88 | }, | ||
| 89 | }, | ||
| 90 | { | ||
| 91 | .clk = { | ||
| 92 | .name = "mcbsp_clk", | ||
| 93 | .id = 3, | ||
| 94 | .enable = omap_mcbsp_clk_enable, | ||
| 95 | .disable = omap_mcbsp_clk_disable, | ||
| 96 | }, | ||
| 97 | }, | ||
| 98 | }; | ||
| 99 | |||
| 100 | #define omap_mcbsp_clks_size ARRAY_SIZE(omap_mcbsp_clks) | ||
| 101 | #else | ||
| 102 | #define omap_mcbsp_clks_size 0 | ||
| 103 | static struct mcbsp_internal_clk __initdata *omap_mcbsp_clks; | ||
| 104 | static inline void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk) | ||
| 105 | { } | ||
| 106 | #endif | 33 | #endif |
| 107 | 34 | ||
| 108 | static void omap1_mcbsp_request(unsigned int id) | 35 | static void omap1_mcbsp_request(unsigned int id) |
| @@ -167,8 +94,9 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = { | |||
| 167 | .rx_irq = INT_McBSP1RX, | 94 | .rx_irq = INT_McBSP1RX, |
| 168 | .tx_irq = INT_McBSP1TX, | 95 | .tx_irq = INT_McBSP1TX, |
| 169 | .ops = &omap1_mcbsp_ops, | 96 | .ops = &omap1_mcbsp_ops, |
| 170 | .clk_name = "mcbsp_clk", | 97 | .clk_names = clk_names, |
| 171 | }, | 98 | .num_clks = 3, |
| 99 | }, | ||
| 172 | { | 100 | { |
| 173 | .phys_base = OMAP1510_MCBSP2_BASE, | 101 | .phys_base = OMAP1510_MCBSP2_BASE, |
| 174 | .dma_rx_sync = OMAP_DMA_MCBSP2_RX, | 102 | .dma_rx_sync = OMAP_DMA_MCBSP2_RX, |
| @@ -184,7 +112,8 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = { | |||
| 184 | .rx_irq = INT_McBSP3RX, | 112 | .rx_irq = INT_McBSP3RX, |
| 185 | .tx_irq = INT_McBSP3TX, | 113 | .tx_irq = INT_McBSP3TX, |
| 186 | .ops = &omap1_mcbsp_ops, | 114 | .ops = &omap1_mcbsp_ops, |
| 187 | .clk_name = "mcbsp_clk", | 115 | .clk_names = clk_names, |
| 116 | .num_clks = 3, | ||
| 188 | }, | 117 | }, |
| 189 | }; | 118 | }; |
| 190 | #define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata) | 119 | #define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata) |
| @@ -202,7 +131,8 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = { | |||
| 202 | .rx_irq = INT_McBSP1RX, | 131 | .rx_irq = INT_McBSP1RX, |
| 203 | .tx_irq = INT_McBSP1TX, | 132 | .tx_irq = INT_McBSP1TX, |
| 204 | .ops = &omap1_mcbsp_ops, | 133 | .ops = &omap1_mcbsp_ops, |
| 205 | .clk_name = "mcbsp_clk", | 134 | .clk_names = clk_names, |
| 135 | .num_clks = 3, | ||
| 206 | }, | 136 | }, |
| 207 | { | 137 | { |
| 208 | .phys_base = OMAP1610_MCBSP2_BASE, | 138 | .phys_base = OMAP1610_MCBSP2_BASE, |
| @@ -219,7 +149,8 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = { | |||
| 219 | .rx_irq = INT_McBSP3RX, | 149 | .rx_irq = INT_McBSP3RX, |
| 220 | .tx_irq = INT_McBSP3TX, | 150 | .tx_irq = INT_McBSP3TX, |
| 221 | .ops = &omap1_mcbsp_ops, | 151 | .ops = &omap1_mcbsp_ops, |
| 222 | .clk_name = "mcbsp_clk", | 152 | .clk_names = clk_names, |
| 153 | .num_clks = 3, | ||
| 223 | }, | 154 | }, |
| 224 | }; | 155 | }; |
| 225 | #define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata) | 156 | #define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata) |
| @@ -230,15 +161,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = { | |||
| 230 | 161 | ||
| 231 | int __init omap1_mcbsp_init(void) | 162 | int __init omap1_mcbsp_init(void) |
| 232 | { | 163 | { |
| 233 | int i; | ||
| 234 | |||
| 235 | for (i = 0; i < omap_mcbsp_clks_size; i++) { | ||
| 236 | if (cpu_is_omap15xx() || cpu_is_omap16xx()) { | ||
| 237 | omap_mcbsp_clk_init(&omap_mcbsp_clks[i]); | ||
| 238 | clk_register(&omap_mcbsp_clks[i].clk); | ||
| 239 | } | ||
| 240 | } | ||
| 241 | |||
| 242 | if (cpu_is_omap730()) | 164 | if (cpu_is_omap730()) |
| 243 | omap_mcbsp_count = OMAP730_MCBSP_PDATA_SZ; | 165 | omap_mcbsp_count = OMAP730_MCBSP_PDATA_SZ; |
| 244 | if (cpu_is_omap15xx()) | 166 | if (cpu_is_omap15xx()) |
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 9d7216ff6c9f..ce03fa750775 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
| @@ -421,6 +421,7 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, | |||
| 421 | int nr_controllers) | 421 | int nr_controllers) |
| 422 | { | 422 | { |
| 423 | int i; | 423 | int i; |
| 424 | char *name; | ||
| 424 | 425 | ||
| 425 | for (i = 0; i < nr_controllers; i++) { | 426 | for (i = 0; i < nr_controllers; i++) { |
| 426 | unsigned long base, size; | 427 | unsigned long base, size; |
| @@ -450,12 +451,14 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, | |||
| 450 | continue; | 451 | continue; |
| 451 | } | 452 | } |
| 452 | 453 | ||
| 453 | if (cpu_is_omap2420()) | 454 | if (cpu_is_omap2420()) { |
| 454 | size = OMAP2420_MMC_SIZE; | 455 | size = OMAP2420_MMC_SIZE; |
| 455 | else | 456 | name = "mmci-omap"; |
| 457 | } else { | ||
| 456 | size = HSMMC_SIZE; | 458 | size = HSMMC_SIZE; |
| 457 | 459 | name = "mmci-omap-hs"; | |
| 458 | omap_mmc_add(i, base, size, irq, mmc_data[i]); | 460 | } |
| 461 | omap_mmc_add(name, i, base, size, irq, mmc_data[i]); | ||
| 459 | }; | 462 | }; |
| 460 | } | 463 | } |
| 461 | 464 | ||
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index b0f8e7d62798..b52a02fc7cd6 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c | |||
| @@ -172,9 +172,13 @@ void __init omap34xx_check_revision(void) | |||
| 172 | omap_revision = OMAP3430_REV_ES3_0; | 172 | omap_revision = OMAP3430_REV_ES3_0; |
| 173 | rev_name = "ES3.0"; | 173 | rev_name = "ES3.0"; |
| 174 | break; | 174 | break; |
| 175 | case 4: | ||
| 176 | omap_revision = OMAP3430_REV_ES3_1; | ||
| 177 | rev_name = "ES3.1"; | ||
| 178 | break; | ||
| 175 | default: | 179 | default: |
| 176 | /* Use the latest known revision as default */ | 180 | /* Use the latest known revision as default */ |
| 177 | omap_revision = OMAP3430_REV_ES3_0; | 181 | omap_revision = OMAP3430_REV_ES3_1; |
| 178 | rev_name = "Unknown revision\n"; | 182 | rev_name = "Unknown revision\n"; |
| 179 | } | 183 | } |
| 180 | } | 184 | } |
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c index 636e2821af7d..9ba20d985dda 100644 --- a/arch/arm/mach-omap2/irq.c +++ b/arch/arm/mach-omap2/irq.c | |||
| @@ -134,6 +134,7 @@ static struct irq_chip omap_irq_chip = { | |||
| 134 | .ack = omap_mask_ack_irq, | 134 | .ack = omap_mask_ack_irq, |
| 135 | .mask = omap_mask_irq, | 135 | .mask = omap_mask_irq, |
| 136 | .unmask = omap_unmask_irq, | 136 | .unmask = omap_unmask_irq, |
| 137 | .disable = omap_mask_irq, | ||
| 137 | }; | 138 | }; |
| 138 | 139 | ||
| 139 | static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank) | 140 | static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank) |
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c index e20023c9d15d..a9e631fc1134 100644 --- a/arch/arm/mach-omap2/mcbsp.c +++ b/arch/arm/mach-omap2/mcbsp.c | |||
| @@ -24,106 +24,7 @@ | |||
| 24 | #include <mach/cpu.h> | 24 | #include <mach/cpu.h> |
| 25 | #include <mach/mcbsp.h> | 25 | #include <mach/mcbsp.h> |
| 26 | 26 | ||
| 27 | struct mcbsp_internal_clk { | 27 | const char *clk_names[] = { "mcbsp_ick", "mcbsp_fck" }; |
| 28 | struct clk clk; | ||
| 29 | struct clk **childs; | ||
| 30 | int n_childs; | ||
| 31 | }; | ||
| 32 | |||
| 33 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) | ||
| 34 | static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk) | ||
| 35 | { | ||
| 36 | const char *clk_names[] = { "mcbsp_ick", "mcbsp_fck" }; | ||
| 37 | int i; | ||
| 38 | |||
| 39 | mclk->n_childs = ARRAY_SIZE(clk_names); | ||
| 40 | mclk->childs = kzalloc(mclk->n_childs * sizeof(struct clk *), | ||
| 41 | GFP_KERNEL); | ||
| 42 | |||
| 43 | for (i = 0; i < mclk->n_childs; i++) { | ||
| 44 | /* We fake a platform device to get correct device id */ | ||
| 45 | struct platform_device pdev; | ||
| 46 | |||
| 47 | pdev.dev.bus = &platform_bus_type; | ||
| 48 | pdev.id = mclk->clk.id; | ||
| 49 | mclk->childs[i] = clk_get(&pdev.dev, clk_names[i]); | ||
| 50 | if (IS_ERR(mclk->childs[i])) | ||
| 51 | printk(KERN_ERR "Could not get clock %s (%d).\n", | ||
| 52 | clk_names[i], mclk->clk.id); | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | static int omap_mcbsp_clk_enable(struct clk *clk) | ||
| 57 | { | ||
| 58 | struct mcbsp_internal_clk *mclk = container_of(clk, | ||
| 59 | struct mcbsp_internal_clk, clk); | ||
| 60 | int i; | ||
| 61 | |||
| 62 | for (i = 0; i < mclk->n_childs; i++) | ||
| 63 | clk_enable(mclk->childs[i]); | ||
| 64 | return 0; | ||
| 65 | } | ||
| 66 | |||
| 67 | static void omap_mcbsp_clk_disable(struct clk *clk) | ||
| 68 | { | ||
| 69 | struct mcbsp_internal_clk *mclk = container_of(clk, | ||
| 70 | struct mcbsp_internal_clk, clk); | ||
| 71 | int i; | ||
| 72 | |||
| 73 | for (i = 0; i < mclk->n_childs; i++) | ||
| 74 | clk_disable(mclk->childs[i]); | ||
| 75 | } | ||
| 76 | |||
| 77 | static struct mcbsp_internal_clk omap_mcbsp_clks[] = { | ||
| 78 | { | ||
| 79 | .clk = { | ||
| 80 | .name = "mcbsp_clk", | ||
| 81 | .id = 1, | ||
| 82 | .enable = omap_mcbsp_clk_enable, | ||
| 83 | .disable = omap_mcbsp_clk_disable, | ||
| 84 | }, | ||
| 85 | }, | ||
| 86 | { | ||
| 87 | .clk = { | ||
| 88 | .name = "mcbsp_clk", | ||
| 89 | .id = 2, | ||
| 90 | .enable = omap_mcbsp_clk_enable, | ||
| 91 | .disable = omap_mcbsp_clk_disable, | ||
| 92 | }, | ||
| 93 | }, | ||
| 94 | { | ||
| 95 | .clk = { | ||
| 96 | .name = "mcbsp_clk", | ||
| 97 | .id = 3, | ||
| 98 | .enable = omap_mcbsp_clk_enable, | ||
| 99 | .disable = omap_mcbsp_clk_disable, | ||
| 100 | }, | ||
| 101 | }, | ||
| 102 | { | ||
| 103 | .clk = { | ||
| 104 | .name = "mcbsp_clk", | ||
| 105 | .id = 4, | ||
| 106 | .enable = omap_mcbsp_clk_enable, | ||
| 107 | .disable = omap_mcbsp_clk_disable, | ||
| 108 | }, | ||
| 109 | }, | ||
| 110 | { | ||
| 111 | .clk = { | ||
| 112 | .name = "mcbsp_clk", | ||
| 113 | .id = 5, | ||
| 114 | .enable = omap_mcbsp_clk_enable, | ||
| 115 | .disable = omap_mcbsp_clk_disable, | ||
| 116 | }, | ||
| 117 | }, | ||
| 118 | }; | ||
| 119 | |||
| 120 | #define omap_mcbsp_clks_size ARRAY_SIZE(omap_mcbsp_clks) | ||
| 121 | #else | ||
| 122 | #define omap_mcbsp_clks_size 0 | ||
| 123 | static struct mcbsp_internal_clk __initdata *omap_mcbsp_clks; | ||
| 124 | static inline void omap_mcbsp_clk_init(struct clk *clk) | ||
| 125 | { } | ||
| 126 | #endif | ||
| 127 | 28 | ||
| 128 | static void omap2_mcbsp2_mux_setup(void) | 29 | static void omap2_mcbsp2_mux_setup(void) |
| 129 | { | 30 | { |
| @@ -156,7 +57,8 @@ static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = { | |||
| 156 | .rx_irq = INT_24XX_MCBSP1_IRQ_RX, | 57 | .rx_irq = INT_24XX_MCBSP1_IRQ_RX, |
| 157 | .tx_irq = INT_24XX_MCBSP1_IRQ_TX, | 58 | .tx_irq = INT_24XX_MCBSP1_IRQ_TX, |
| 158 | .ops = &omap2_mcbsp_ops, | 59 | .ops = &omap2_mcbsp_ops, |
| 159 | .clk_name = "mcbsp_clk", | 60 | .clk_names = clk_names, |
| 61 | .num_clks = 2, | ||
| 160 | }, | 62 | }, |
| 161 | { | 63 | { |
| 162 | .phys_base = OMAP24XX_MCBSP2_BASE, | 64 | .phys_base = OMAP24XX_MCBSP2_BASE, |
| @@ -165,7 +67,8 @@ static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = { | |||
| 165 | .rx_irq = INT_24XX_MCBSP2_IRQ_RX, | 67 | .rx_irq = INT_24XX_MCBSP2_IRQ_RX, |
| 166 | .tx_irq = INT_24XX_MCBSP2_IRQ_TX, | 68 | .tx_irq = INT_24XX_MCBSP2_IRQ_TX, |
| 167 | .ops = &omap2_mcbsp_ops, | 69 | .ops = &omap2_mcbsp_ops, |
| 168 | .clk_name = "mcbsp_clk", | 70 | .clk_names = clk_names, |
| 71 | .num_clks = 2, | ||
| 169 | }, | 72 | }, |
| 170 | }; | 73 | }; |
| 171 | #define OMAP2420_MCBSP_PDATA_SZ ARRAY_SIZE(omap2420_mcbsp_pdata) | 74 | #define OMAP2420_MCBSP_PDATA_SZ ARRAY_SIZE(omap2420_mcbsp_pdata) |
| @@ -183,7 +86,8 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { | |||
| 183 | .rx_irq = INT_24XX_MCBSP1_IRQ_RX, | 86 | .rx_irq = INT_24XX_MCBSP1_IRQ_RX, |
| 184 | .tx_irq = INT_24XX_MCBSP1_IRQ_TX, | 87 | .tx_irq = INT_24XX_MCBSP1_IRQ_TX, |
| 185 | .ops = &omap2_mcbsp_ops, | 88 | .ops = &omap2_mcbsp_ops, |
| 186 | .clk_name = "mcbsp_clk", | 89 | .clk_names = clk_names, |
| 90 | .num_clks = 2, | ||
| 187 | }, | 91 | }, |
| 188 | { | 92 | { |
| 189 | .phys_base = OMAP24XX_MCBSP2_BASE, | 93 | .phys_base = OMAP24XX_MCBSP2_BASE, |
| @@ -192,7 +96,8 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { | |||
| 192 | .rx_irq = INT_24XX_MCBSP2_IRQ_RX, | 96 | .rx_irq = INT_24XX_MCBSP2_IRQ_RX, |
| 193 | .tx_irq = INT_24XX_MCBSP2_IRQ_TX, | 97 | .tx_irq = INT_24XX_MCBSP2_IRQ_TX, |
| 194 | .ops = &omap2_mcbsp_ops, | 98 | .ops = &omap2_mcbsp_ops, |
| 195 | .clk_name = "mcbsp_clk", | 99 | .clk_names = clk_names, |
| 100 | .num_clks = 2, | ||
| 196 | }, | 101 | }, |
| 197 | { | 102 | { |
| 198 | .phys_base = OMAP2430_MCBSP3_BASE, | 103 | .phys_base = OMAP2430_MCBSP3_BASE, |
| @@ -201,7 +106,8 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { | |||
| 201 | .rx_irq = INT_24XX_MCBSP3_IRQ_RX, | 106 | .rx_irq = INT_24XX_MCBSP3_IRQ_RX, |
| 202 | .tx_irq = INT_24XX_MCBSP3_IRQ_TX, | 107 | .tx_irq = INT_24XX_MCBSP3_IRQ_TX, |
| 203 | .ops = &omap2_mcbsp_ops, | 108 | .ops = &omap2_mcbsp_ops, |
| 204 | .clk_name = "mcbsp_clk", | 109 | .clk_names = clk_names, |
| 110 | .num_clks = 2, | ||
| 205 | }, | 111 | }, |
| 206 | { | 112 | { |
| 207 | .phys_base = OMAP2430_MCBSP4_BASE, | 113 | .phys_base = OMAP2430_MCBSP4_BASE, |
| @@ -210,7 +116,8 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { | |||
| 210 | .rx_irq = INT_24XX_MCBSP4_IRQ_RX, | 116 | .rx_irq = INT_24XX_MCBSP4_IRQ_RX, |
| 211 | .tx_irq = INT_24XX_MCBSP4_IRQ_TX, | 117 | .tx_irq = INT_24XX_MCBSP4_IRQ_TX, |
| 212 | .ops = &omap2_mcbsp_ops, | 118 | .ops = &omap2_mcbsp_ops, |
| 213 | .clk_name = "mcbsp_clk", | 119 | .clk_names = clk_names, |
| 120 | .num_clks = 2, | ||
| 214 | }, | 121 | }, |
| 215 | { | 122 | { |
| 216 | .phys_base = OMAP2430_MCBSP5_BASE, | 123 | .phys_base = OMAP2430_MCBSP5_BASE, |
| @@ -219,7 +126,8 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { | |||
| 219 | .rx_irq = INT_24XX_MCBSP5_IRQ_RX, | 126 | .rx_irq = INT_24XX_MCBSP5_IRQ_RX, |
| 220 | .tx_irq = INT_24XX_MCBSP5_IRQ_TX, | 127 | .tx_irq = INT_24XX_MCBSP5_IRQ_TX, |
| 221 | .ops = &omap2_mcbsp_ops, | 128 | .ops = &omap2_mcbsp_ops, |
| 222 | .clk_name = "mcbsp_clk", | 129 | .clk_names = clk_names, |
| 130 | .num_clks = 2, | ||
| 223 | }, | 131 | }, |
| 224 | }; | 132 | }; |
| 225 | #define OMAP2430_MCBSP_PDATA_SZ ARRAY_SIZE(omap2430_mcbsp_pdata) | 133 | #define OMAP2430_MCBSP_PDATA_SZ ARRAY_SIZE(omap2430_mcbsp_pdata) |
| @@ -237,7 +145,8 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { | |||
| 237 | .rx_irq = INT_24XX_MCBSP1_IRQ_RX, | 145 | .rx_irq = INT_24XX_MCBSP1_IRQ_RX, |
| 238 | .tx_irq = INT_24XX_MCBSP1_IRQ_TX, | 146 | .tx_irq = INT_24XX_MCBSP1_IRQ_TX, |
| 239 | .ops = &omap2_mcbsp_ops, | 147 | .ops = &omap2_mcbsp_ops, |
| 240 | .clk_name = "mcbsp_clk", | 148 | .clk_names = clk_names, |
| 149 | .num_clks = 2, | ||
| 241 | }, | 150 | }, |
| 242 | { | 151 | { |
| 243 | .phys_base = OMAP34XX_MCBSP2_BASE, | 152 | .phys_base = OMAP34XX_MCBSP2_BASE, |
| @@ -246,7 +155,8 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { | |||
| 246 | .rx_irq = INT_24XX_MCBSP2_IRQ_RX, | 155 | .rx_irq = INT_24XX_MCBSP2_IRQ_RX, |
| 247 | .tx_irq = INT_24XX_MCBSP2_IRQ_TX, | 156 | .tx_irq = INT_24XX_MCBSP2_IRQ_TX, |
| 248 | .ops = &omap2_mcbsp_ops, | 157 | .ops = &omap2_mcbsp_ops, |
| 249 | .clk_name = "mcbsp_clk", | 158 | .clk_names = clk_names, |
| 159 | .num_clks = 2, | ||
| 250 | }, | 160 | }, |
| 251 | { | 161 | { |
| 252 | .phys_base = OMAP34XX_MCBSP3_BASE, | 162 | .phys_base = OMAP34XX_MCBSP3_BASE, |
| @@ -255,7 +165,8 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { | |||
| 255 | .rx_irq = INT_24XX_MCBSP3_IRQ_RX, | 165 | .rx_irq = INT_24XX_MCBSP3_IRQ_RX, |
| 256 | .tx_irq = INT_24XX_MCBSP3_IRQ_TX, | 166 | .tx_irq = INT_24XX_MCBSP3_IRQ_TX, |
| 257 | .ops = &omap2_mcbsp_ops, | 167 | .ops = &omap2_mcbsp_ops, |
| 258 | .clk_name = "mcbsp_clk", | 168 | .clk_names = clk_names, |
| 169 | .num_clks = 2, | ||
| 259 | }, | 170 | }, |
| 260 | { | 171 | { |
| 261 | .phys_base = OMAP34XX_MCBSP4_BASE, | 172 | .phys_base = OMAP34XX_MCBSP4_BASE, |
| @@ -264,7 +175,8 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { | |||
| 264 | .rx_irq = INT_24XX_MCBSP4_IRQ_RX, | 175 | .rx_irq = INT_24XX_MCBSP4_IRQ_RX, |
| 265 | .tx_irq = INT_24XX_MCBSP4_IRQ_TX, | 176 | .tx_irq = INT_24XX_MCBSP4_IRQ_TX, |
| 266 | .ops = &omap2_mcbsp_ops, | 177 | .ops = &omap2_mcbsp_ops, |
| 267 | .clk_name = "mcbsp_clk", | 178 | .clk_names = clk_names, |
| 179 | .num_clks = 2, | ||
| 268 | }, | 180 | }, |
| 269 | { | 181 | { |
| 270 | .phys_base = OMAP34XX_MCBSP5_BASE, | 182 | .phys_base = OMAP34XX_MCBSP5_BASE, |
| @@ -273,7 +185,8 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { | |||
| 273 | .rx_irq = INT_24XX_MCBSP5_IRQ_RX, | 185 | .rx_irq = INT_24XX_MCBSP5_IRQ_RX, |
| 274 | .tx_irq = INT_24XX_MCBSP5_IRQ_TX, | 186 | .tx_irq = INT_24XX_MCBSP5_IRQ_TX, |
| 275 | .ops = &omap2_mcbsp_ops, | 187 | .ops = &omap2_mcbsp_ops, |
| 276 | .clk_name = "mcbsp_clk", | 188 | .clk_names = clk_names, |
| 189 | .num_clks = 2, | ||
| 277 | }, | 190 | }, |
| 278 | }; | 191 | }; |
| 279 | #define OMAP34XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap34xx_mcbsp_pdata) | 192 | #define OMAP34XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap34xx_mcbsp_pdata) |
| @@ -284,14 +197,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { | |||
| 284 | 197 | ||
| 285 | static int __init omap2_mcbsp_init(void) | 198 | static int __init omap2_mcbsp_init(void) |
| 286 | { | 199 | { |
| 287 | int i; | ||
| 288 | |||
| 289 | for (i = 0; i < omap_mcbsp_clks_size; i++) { | ||
| 290 | /* Once we call clk_get inside init, we do not register it */ | ||
| 291 | omap_mcbsp_clk_init(&omap_mcbsp_clks[i]); | ||
| 292 | clk_register(&omap_mcbsp_clks[i].clk); | ||
| 293 | } | ||
| 294 | |||
| 295 | if (cpu_is_omap2420()) | 200 | if (cpu_is_omap2420()) |
| 296 | omap_mcbsp_count = OMAP2420_MCBSP_PDATA_SZ; | 201 | omap_mcbsp_count = OMAP2420_MCBSP_PDATA_SZ; |
| 297 | if (cpu_is_omap2430()) | 202 | if (cpu_is_omap2430()) |
diff --git a/arch/arm/mach-omap2/sleep24xx.S b/arch/arm/mach-omap2/sleep24xx.S index 43336b93b21c..bf9e96105e11 100644 --- a/arch/arm/mach-omap2/sleep24xx.S +++ b/arch/arm/mach-omap2/sleep24xx.S | |||
| @@ -93,9 +93,8 @@ ENTRY(omap24xx_cpu_suspend) | |||
| 93 | orr r4, r4, #0x40 @ enable self refresh on idle req | 93 | orr r4, r4, #0x40 @ enable self refresh on idle req |
| 94 | mov r5, #0x2000 @ set delay (DPLL relock + DLL relock) | 94 | mov r5, #0x2000 @ set delay (DPLL relock + DLL relock) |
| 95 | str r4, [r2] @ make it so | 95 | str r4, [r2] @ make it so |
| 96 | mov r2, #0 | ||
| 97 | nop | 96 | nop |
| 98 | mcr p15, 0, r2, c7, c0, 4 @ wait for interrupt | 97 | mcr p15, 0, r3, c7, c0, 4 @ wait for interrupt |
| 99 | nop | 98 | nop |
| 100 | loop: | 99 | loop: |
| 101 | subs r5, r5, #0x1 @ awake, wait just a bit | 100 | subs r5, r5, #0x1 @ awake, wait just a bit |
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c index ae6036300f60..9fc13a2cc3f4 100644 --- a/arch/arm/mach-omap2/timer-gp.c +++ b/arch/arm/mach-omap2/timer-gp.c | |||
| @@ -118,7 +118,8 @@ static void __init omap2_gp_clockevent_init(void) | |||
| 118 | clockevent_gpt.max_delta_ns = | 118 | clockevent_gpt.max_delta_ns = |
| 119 | clockevent_delta2ns(0xffffffff, &clockevent_gpt); | 119 | clockevent_delta2ns(0xffffffff, &clockevent_gpt); |
| 120 | clockevent_gpt.min_delta_ns = | 120 | clockevent_gpt.min_delta_ns = |
| 121 | clockevent_delta2ns(1, &clockevent_gpt); | 121 | clockevent_delta2ns(3, &clockevent_gpt); |
| 122 | /* Timer internal resynch latency. */ | ||
| 122 | 123 | ||
| 123 | clockevent_gpt.cpumask = cpumask_of(0); | 124 | clockevent_gpt.cpumask = cpumask_of(0); |
| 124 | clockevents_register_device(&clockevent_gpt); | 125 | clockevents_register_device(&clockevent_gpt); |
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index c1fbd5b5f9c4..23cfdd593954 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c | |||
| @@ -289,7 +289,7 @@ static struct platform_device sa11x0pcmcia_device = { | |||
| 289 | }; | 289 | }; |
| 290 | 290 | ||
| 291 | static struct platform_device sa11x0mtd_device = { | 291 | static struct platform_device sa11x0mtd_device = { |
| 292 | .name = "flash", | 292 | .name = "sa1100-mtd", |
| 293 | .id = -1, | 293 | .id = -1, |
| 294 | }; | 294 | }; |
| 295 | 295 | ||
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c index 81d0b8772de3..bc0099d5ae85 100644 --- a/arch/arm/mm/fault-armv.c +++ b/arch/arm/mm/fault-armv.c | |||
| @@ -66,7 +66,10 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address) | |||
| 66 | * fault (ie, is old), we can safely ignore any issues. | 66 | * fault (ie, is old), we can safely ignore any issues. |
| 67 | */ | 67 | */ |
| 68 | if (ret && (pte_val(entry) & L_PTE_MT_MASK) != shared_pte_mask) { | 68 | if (ret && (pte_val(entry) & L_PTE_MT_MASK) != shared_pte_mask) { |
| 69 | flush_cache_page(vma, address, pte_pfn(entry)); | 69 | unsigned long pfn = pte_pfn(entry); |
| 70 | flush_cache_page(vma, address, pfn); | ||
| 71 | outer_flush_range((pfn << PAGE_SHIFT), | ||
| 72 | (pfn << PAGE_SHIFT) + PAGE_SIZE); | ||
| 70 | pte_val(entry) &= ~L_PTE_MT_MASK; | 73 | pte_val(entry) &= ~L_PTE_MT_MASK; |
| 71 | pte_val(entry) |= shared_pte_mask; | 74 | pte_val(entry) |= shared_pte_mask; |
| 72 | set_pte_at(vma->vm_mm, address, pte, entry); | 75 | set_pte_at(vma->vm_mm, address, pte, entry); |
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c index ac15c23fd5da..208dbb121f47 100644 --- a/arch/arm/plat-omap/devices.c +++ b/arch/arm/plat-omap/devices.c | |||
| @@ -200,14 +200,15 @@ void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config, | |||
| 200 | /* | 200 | /* |
| 201 | * Register MMC devices. Called from mach-omap1 and mach-omap2 device init. | 201 | * Register MMC devices. Called from mach-omap1 and mach-omap2 device init. |
| 202 | */ | 202 | */ |
| 203 | int __init omap_mmc_add(int id, unsigned long base, unsigned long size, | 203 | int __init omap_mmc_add(const char *name, int id, unsigned long base, |
| 204 | unsigned int irq, struct omap_mmc_platform_data *data) | 204 | unsigned long size, unsigned int irq, |
| 205 | struct omap_mmc_platform_data *data) | ||
| 205 | { | 206 | { |
| 206 | struct platform_device *pdev; | 207 | struct platform_device *pdev; |
| 207 | struct resource res[OMAP_MMC_NR_RES]; | 208 | struct resource res[OMAP_MMC_NR_RES]; |
| 208 | int ret; | 209 | int ret; |
| 209 | 210 | ||
| 210 | pdev = platform_device_alloc("mmci-omap", id); | 211 | pdev = platform_device_alloc(name, id); |
| 211 | if (!pdev) | 212 | if (!pdev) |
| 212 | return -ENOMEM; | 213 | return -ENOMEM; |
| 213 | 214 | ||
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index e77373c39f8c..47ec77af4ccb 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c | |||
| @@ -709,6 +709,7 @@ int omap_request_dma(int dev_id, const char *dev_name, | |||
| 709 | chan->dev_name = dev_name; | 709 | chan->dev_name = dev_name; |
| 710 | chan->callback = callback; | 710 | chan->callback = callback; |
| 711 | chan->data = data; | 711 | chan->data = data; |
| 712 | chan->flags = 0; | ||
| 712 | 713 | ||
| 713 | #ifndef CONFIG_ARCH_OMAP1 | 714 | #ifndef CONFIG_ARCH_OMAP1 |
| 714 | if (cpu_class_is_omap2()) { | 715 | if (cpu_class_is_omap2()) { |
| @@ -1888,11 +1889,11 @@ static int omap2_dma_handle_ch(int ch) | |||
| 1888 | status = dma_read(CSR(ch)); | 1889 | status = dma_read(CSR(ch)); |
| 1889 | } | 1890 | } |
| 1890 | 1891 | ||
| 1892 | dma_write(status, CSR(ch)); | ||
| 1893 | |||
| 1891 | if (likely(dma_chan[ch].callback != NULL)) | 1894 | if (likely(dma_chan[ch].callback != NULL)) |
| 1892 | dma_chan[ch].callback(ch, status, dma_chan[ch].data); | 1895 | dma_chan[ch].callback(ch, status, dma_chan[ch].data); |
| 1893 | 1896 | ||
| 1894 | dma_write(status, CSR(ch)); | ||
| 1895 | |||
| 1896 | return 0; | 1897 | return 0; |
| 1897 | } | 1898 | } |
| 1898 | 1899 | ||
diff --git a/arch/arm/plat-omap/include/mach/cpu.h b/arch/arm/plat-omap/include/mach/cpu.h index b2062f1175de..a8e1178a9468 100644 --- a/arch/arm/plat-omap/include/mach/cpu.h +++ b/arch/arm/plat-omap/include/mach/cpu.h | |||
| @@ -339,6 +339,7 @@ IS_OMAP_TYPE(3430, 0x3430) | |||
| 339 | #define OMAP3430_REV_ES2_0 0x34301034 | 339 | #define OMAP3430_REV_ES2_0 0x34301034 |
| 340 | #define OMAP3430_REV_ES2_1 0x34302034 | 340 | #define OMAP3430_REV_ES2_1 0x34302034 |
| 341 | #define OMAP3430_REV_ES3_0 0x34303034 | 341 | #define OMAP3430_REV_ES3_0 0x34303034 |
| 342 | #define OMAP3430_REV_ES3_1 0x34304034 | ||
| 342 | 343 | ||
| 343 | /* | 344 | /* |
| 344 | * omap_chip bits | 345 | * omap_chip bits |
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h index eef873db3d48..113c2466c86a 100644 --- a/arch/arm/plat-omap/include/mach/mcbsp.h +++ b/arch/arm/plat-omap/include/mach/mcbsp.h | |||
| @@ -344,7 +344,8 @@ struct omap_mcbsp_platform_data { | |||
| 344 | u8 dma_rx_sync, dma_tx_sync; | 344 | u8 dma_rx_sync, dma_tx_sync; |
| 345 | u16 rx_irq, tx_irq; | 345 | u16 rx_irq, tx_irq; |
| 346 | struct omap_mcbsp_ops *ops; | 346 | struct omap_mcbsp_ops *ops; |
| 347 | char const *clk_name; | 347 | char const **clk_names; |
| 348 | int num_clks; | ||
| 348 | }; | 349 | }; |
| 349 | 350 | ||
| 350 | struct omap_mcbsp { | 351 | struct omap_mcbsp { |
| @@ -376,7 +377,8 @@ struct omap_mcbsp { | |||
| 376 | /* Protect the field .free, while checking if the mcbsp is in use */ | 377 | /* Protect the field .free, while checking if the mcbsp is in use */ |
| 377 | spinlock_t lock; | 378 | spinlock_t lock; |
| 378 | struct omap_mcbsp_platform_data *pdata; | 379 | struct omap_mcbsp_platform_data *pdata; |
| 379 | struct clk *clk; | 380 | struct clk **clks; |
| 381 | int num_clks; | ||
| 380 | }; | 382 | }; |
| 381 | extern struct omap_mcbsp **mcbsp_ptr; | 383 | extern struct omap_mcbsp **mcbsp_ptr; |
| 382 | extern int omap_mcbsp_count; | 384 | extern int omap_mcbsp_count; |
diff --git a/arch/arm/plat-omap/include/mach/mmc.h b/arch/arm/plat-omap/include/mach/mmc.h index 031250f02805..73a9e15031b1 100644 --- a/arch/arm/plat-omap/include/mach/mmc.h +++ b/arch/arm/plat-omap/include/mach/mmc.h | |||
| @@ -115,8 +115,9 @@ void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, | |||
| 115 | int nr_controllers); | 115 | int nr_controllers); |
| 116 | void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, | 116 | void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, |
| 117 | int nr_controllers); | 117 | int nr_controllers); |
| 118 | int omap_mmc_add(int id, unsigned long base, unsigned long size, | 118 | int omap_mmc_add(const char *name, int id, unsigned long base, |
| 119 | unsigned int irq, struct omap_mmc_platform_data *data); | 119 | unsigned long size, unsigned int irq, |
| 120 | struct omap_mmc_platform_data *data); | ||
| 120 | #else | 121 | #else |
| 121 | static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, | 122 | static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, |
| 122 | int nr_controllers) | 123 | int nr_controllers) |
| @@ -126,8 +127,9 @@ static inline void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, | |||
| 126 | int nr_controllers) | 127 | int nr_controllers) |
| 127 | { | 128 | { |
| 128 | } | 129 | } |
| 129 | static inline int omap_mmc_add(int id, unsigned long base, unsigned long size, | 130 | static inline int omap_mmc_add(const char *name, int id, unsigned long base, |
| 130 | unsigned int irq, struct omap_mmc_platform_data *data) | 131 | unsigned long size, unsigned int irq, |
| 132 | struct omap_mmc_platform_data *data) | ||
| 131 | { | 133 | { |
| 132 | return 0; | 134 | return 0; |
| 133 | } | 135 | } |
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c index f2401a831f99..e5842e30e534 100644 --- a/arch/arm/plat-omap/mcbsp.c +++ b/arch/arm/plat-omap/mcbsp.c | |||
| @@ -214,6 +214,7 @@ EXPORT_SYMBOL(omap_mcbsp_set_io_type); | |||
| 214 | int omap_mcbsp_request(unsigned int id) | 214 | int omap_mcbsp_request(unsigned int id) |
| 215 | { | 215 | { |
| 216 | struct omap_mcbsp *mcbsp; | 216 | struct omap_mcbsp *mcbsp; |
| 217 | int i; | ||
| 217 | int err; | 218 | int err; |
| 218 | 219 | ||
| 219 | if (!omap_mcbsp_check_valid_id(id)) { | 220 | if (!omap_mcbsp_check_valid_id(id)) { |
| @@ -225,7 +226,8 @@ int omap_mcbsp_request(unsigned int id) | |||
| 225 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request) | 226 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request) |
| 226 | mcbsp->pdata->ops->request(id); | 227 | mcbsp->pdata->ops->request(id); |
| 227 | 228 | ||
| 228 | clk_enable(mcbsp->clk); | 229 | for (i = 0; i < mcbsp->num_clks; i++) |
| 230 | clk_enable(mcbsp->clks[i]); | ||
| 229 | 231 | ||
| 230 | spin_lock(&mcbsp->lock); | 232 | spin_lock(&mcbsp->lock); |
| 231 | if (!mcbsp->free) { | 233 | if (!mcbsp->free) { |
| @@ -276,6 +278,7 @@ EXPORT_SYMBOL(omap_mcbsp_request); | |||
| 276 | void omap_mcbsp_free(unsigned int id) | 278 | void omap_mcbsp_free(unsigned int id) |
| 277 | { | 279 | { |
| 278 | struct omap_mcbsp *mcbsp; | 280 | struct omap_mcbsp *mcbsp; |
| 281 | int i; | ||
| 279 | 282 | ||
| 280 | if (!omap_mcbsp_check_valid_id(id)) { | 283 | if (!omap_mcbsp_check_valid_id(id)) { |
| 281 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | 284 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); |
| @@ -286,7 +289,8 @@ void omap_mcbsp_free(unsigned int id) | |||
| 286 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) | 289 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) |
| 287 | mcbsp->pdata->ops->free(id); | 290 | mcbsp->pdata->ops->free(id); |
| 288 | 291 | ||
| 289 | clk_disable(mcbsp->clk); | 292 | for (i = mcbsp->num_clks - 1; i >= 0; i--) |
| 293 | clk_disable(mcbsp->clks[i]); | ||
| 290 | 294 | ||
| 291 | spin_lock(&mcbsp->lock); | 295 | spin_lock(&mcbsp->lock); |
| 292 | if (mcbsp->free) { | 296 | if (mcbsp->free) { |
| @@ -872,6 +876,7 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev) | |||
| 872 | struct omap_mcbsp_platform_data *pdata = pdev->dev.platform_data; | 876 | struct omap_mcbsp_platform_data *pdata = pdev->dev.platform_data; |
| 873 | struct omap_mcbsp *mcbsp; | 877 | struct omap_mcbsp *mcbsp; |
| 874 | int id = pdev->id - 1; | 878 | int id = pdev->id - 1; |
| 879 | int i; | ||
| 875 | int ret = 0; | 880 | int ret = 0; |
| 876 | 881 | ||
| 877 | if (!pdata) { | 882 | if (!pdata) { |
| @@ -916,14 +921,25 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev) | |||
| 916 | mcbsp->dma_rx_sync = pdata->dma_rx_sync; | 921 | mcbsp->dma_rx_sync = pdata->dma_rx_sync; |
| 917 | mcbsp->dma_tx_sync = pdata->dma_tx_sync; | 922 | mcbsp->dma_tx_sync = pdata->dma_tx_sync; |
| 918 | 923 | ||
| 919 | if (pdata->clk_name) | 924 | if (pdata->num_clks) { |
| 920 | mcbsp->clk = clk_get(&pdev->dev, pdata->clk_name); | 925 | mcbsp->num_clks = pdata->num_clks; |
| 921 | if (IS_ERR(mcbsp->clk)) { | 926 | mcbsp->clks = kzalloc(mcbsp->num_clks * sizeof(struct clk *), |
| 922 | dev_err(&pdev->dev, | 927 | GFP_KERNEL); |
| 923 | "Invalid clock configuration for McBSP%d.\n", | 928 | if (!mcbsp->clks) { |
| 924 | mcbsp->id); | 929 | ret = -ENOMEM; |
| 925 | ret = PTR_ERR(mcbsp->clk); | 930 | goto exit; |
| 926 | goto err_clk; | 931 | } |
| 932 | for (i = 0; i < mcbsp->num_clks; i++) { | ||
| 933 | mcbsp->clks[i] = clk_get(&pdev->dev, pdata->clk_names[i]); | ||
| 934 | if (IS_ERR(mcbsp->clks[i])) { | ||
| 935 | dev_err(&pdev->dev, | ||
| 936 | "Invalid %s configuration for McBSP%d.\n", | ||
| 937 | pdata->clk_names[i], mcbsp->id); | ||
| 938 | ret = PTR_ERR(mcbsp->clks[i]); | ||
| 939 | goto err_clk; | ||
| 940 | } | ||
| 941 | } | ||
| 942 | |||
| 927 | } | 943 | } |
| 928 | 944 | ||
| 929 | mcbsp->pdata = pdata; | 945 | mcbsp->pdata = pdata; |
| @@ -932,6 +948,9 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev) | |||
| 932 | return 0; | 948 | return 0; |
| 933 | 949 | ||
| 934 | err_clk: | 950 | err_clk: |
| 951 | while (i--) | ||
| 952 | clk_put(mcbsp->clks[i]); | ||
| 953 | kfree(mcbsp->clks); | ||
| 935 | iounmap(mcbsp->io_base); | 954 | iounmap(mcbsp->io_base); |
| 936 | err_ioremap: | 955 | err_ioremap: |
| 937 | mcbsp->free = 0; | 956 | mcbsp->free = 0; |
| @@ -942,6 +961,7 @@ exit: | |||
| 942 | static int __devexit omap_mcbsp_remove(struct platform_device *pdev) | 961 | static int __devexit omap_mcbsp_remove(struct platform_device *pdev) |
| 943 | { | 962 | { |
| 944 | struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); | 963 | struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); |
| 964 | int i; | ||
| 945 | 965 | ||
| 946 | platform_set_drvdata(pdev, NULL); | 966 | platform_set_drvdata(pdev, NULL); |
| 947 | if (mcbsp) { | 967 | if (mcbsp) { |
| @@ -950,12 +970,18 @@ static int __devexit omap_mcbsp_remove(struct platform_device *pdev) | |||
| 950 | mcbsp->pdata->ops->free) | 970 | mcbsp->pdata->ops->free) |
| 951 | mcbsp->pdata->ops->free(mcbsp->id); | 971 | mcbsp->pdata->ops->free(mcbsp->id); |
| 952 | 972 | ||
| 953 | clk_disable(mcbsp->clk); | 973 | for (i = mcbsp->num_clks - 1; i >= 0; i--) { |
| 954 | clk_put(mcbsp->clk); | 974 | clk_disable(mcbsp->clks[i]); |
| 975 | clk_put(mcbsp->clks[i]); | ||
| 976 | } | ||
| 955 | 977 | ||
| 956 | iounmap(mcbsp->io_base); | 978 | iounmap(mcbsp->io_base); |
| 957 | 979 | ||
| 958 | mcbsp->clk = NULL; | 980 | if (mcbsp->num_clks) { |
| 981 | kfree(mcbsp->clks); | ||
| 982 | mcbsp->clks = NULL; | ||
| 983 | mcbsp->num_clks = 0; | ||
| 984 | } | ||
| 959 | mcbsp->free = 0; | 985 | mcbsp->free = 0; |
| 960 | mcbsp->dev = NULL; | 986 | mcbsp->dev = NULL; |
| 961 | } | 987 | } |
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index a949c4fbbddd..8f1f97d56e1e 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig | |||
| @@ -169,26 +169,51 @@ config BF542 | |||
| 169 | help | 169 | help |
| 170 | BF542 Processor Support. | 170 | BF542 Processor Support. |
| 171 | 171 | ||
| 172 | config BF542M | ||
| 173 | bool "BF542m" | ||
| 174 | help | ||
| 175 | BF542 Processor Support. | ||
| 176 | |||
| 172 | config BF544 | 177 | config BF544 |
| 173 | bool "BF544" | 178 | bool "BF544" |
| 174 | help | 179 | help |
| 175 | BF544 Processor Support. | 180 | BF544 Processor Support. |
| 176 | 181 | ||
| 182 | config BF544M | ||
| 183 | bool "BF544m" | ||
| 184 | help | ||
| 185 | BF544 Processor Support. | ||
| 186 | |||
| 177 | config BF547 | 187 | config BF547 |
| 178 | bool "BF547" | 188 | bool "BF547" |
| 179 | help | 189 | help |
| 180 | BF547 Processor Support. | 190 | BF547 Processor Support. |
| 181 | 191 | ||
| 192 | config BF547M | ||
| 193 | bool "BF547m" | ||
| 194 | help | ||
| 195 | BF547 Processor Support. | ||
| 196 | |||
| 182 | config BF548 | 197 | config BF548 |
| 183 | bool "BF548" | 198 | bool "BF548" |
| 184 | help | 199 | help |
| 185 | BF548 Processor Support. | 200 | BF548 Processor Support. |
| 186 | 201 | ||
| 202 | config BF548M | ||
| 203 | bool "BF548m" | ||
| 204 | help | ||
| 205 | BF548 Processor Support. | ||
| 206 | |||
| 187 | config BF549 | 207 | config BF549 |
| 188 | bool "BF549" | 208 | bool "BF549" |
| 189 | help | 209 | help |
| 190 | BF549 Processor Support. | 210 | BF549 Processor Support. |
| 191 | 211 | ||
| 212 | config BF549M | ||
| 213 | bool "BF549m" | ||
| 214 | help | ||
| 215 | BF549 Processor Support. | ||
| 216 | |||
| 192 | config BF561 | 217 | config BF561 |
| 193 | bool "BF561" | 218 | bool "BF561" |
| 194 | help | 219 | help |
| @@ -224,39 +249,39 @@ config TICK_SOURCE_SYSTMR0 | |||
| 224 | 249 | ||
| 225 | config BF_REV_MIN | 250 | config BF_REV_MIN |
| 226 | int | 251 | int |
| 227 | default 0 if (BF51x || BF52x || BF54x) | 252 | default 0 if (BF51x || BF52x || (BF54x && !BF54xM)) |
| 228 | default 2 if (BF537 || BF536 || BF534) | 253 | default 2 if (BF537 || BF536 || BF534) |
| 229 | default 3 if (BF561 ||BF533 || BF532 || BF531) | 254 | default 3 if (BF561 || BF533 || BF532 || BF531 || BF54xM) |
| 230 | default 4 if (BF538 || BF539) | 255 | default 4 if (BF538 || BF539) |
| 231 | 256 | ||
| 232 | config BF_REV_MAX | 257 | config BF_REV_MAX |
| 233 | int | 258 | int |
| 234 | default 2 if (BF51x || BF52x || BF54x) | 259 | default 2 if (BF51x || BF52x || (BF54x && !BF54xM)) |
| 235 | default 3 if (BF537 || BF536 || BF534) | 260 | default 3 if (BF537 || BF536 || BF534 || BF54xM) |
| 236 | default 5 if (BF561 || BF538 || BF539) | 261 | default 5 if (BF561 || BF538 || BF539) |
| 237 | default 6 if (BF533 || BF532 || BF531) | 262 | default 6 if (BF533 || BF532 || BF531) |
| 238 | 263 | ||
| 239 | choice | 264 | choice |
| 240 | prompt "Silicon Rev" | 265 | prompt "Silicon Rev" |
| 241 | default BF_REV_0_1 if (BF51x || BF52x || BF54x) | 266 | default BF_REV_0_1 if (BF51x || BF52x || (BF54x && !BF54xM)) |
| 242 | default BF_REV_0_2 if (BF534 || BF536 || BF537) | 267 | default BF_REV_0_2 if (BF534 || BF536 || BF537) |
| 243 | default BF_REV_0_3 if (BF531 || BF532 || BF533 || BF561) | 268 | default BF_REV_0_3 if (BF531 || BF532 || BF533 || BF54xM || BF561) |
| 244 | 269 | ||
| 245 | config BF_REV_0_0 | 270 | config BF_REV_0_0 |
| 246 | bool "0.0" | 271 | bool "0.0" |
| 247 | depends on (BF51x || BF52x || BF54x) | 272 | depends on (BF51x || BF52x || (BF54x && !BF54xM)) |
| 248 | 273 | ||
| 249 | config BF_REV_0_1 | 274 | config BF_REV_0_1 |
| 250 | bool "0.1" | 275 | bool "0.1" |
| 251 | depends on (BF52x || BF54x) | 276 | depends on (BF52x || (BF54x && !BF54xM)) |
| 252 | 277 | ||
| 253 | config BF_REV_0_2 | 278 | config BF_REV_0_2 |
| 254 | bool "0.2" | 279 | bool "0.2" |
| 255 | depends on (BF52x || BF537 || BF536 || BF534 || BF54x) | 280 | depends on (BF52x || BF537 || BF536 || BF534 || (BF54x && !BF54xM)) |
| 256 | 281 | ||
| 257 | config BF_REV_0_3 | 282 | config BF_REV_0_3 |
| 258 | bool "0.3" | 283 | bool "0.3" |
| 259 | depends on (BF561 || BF537 || BF536 || BF534 || BF533 || BF532 || BF531) | 284 | depends on (BF54xM || BF561 || BF537 || BF536 || BF534 || BF533 || BF532 || BF531) |
| 260 | 285 | ||
| 261 | config BF_REV_0_4 | 286 | config BF_REV_0_4 |
| 262 | bool "0.4" | 287 | bool "0.4" |
| @@ -293,9 +318,14 @@ config BF53x | |||
| 293 | depends on (BF531 || BF532 || BF533 || BF534 || BF536 || BF537) | 318 | depends on (BF531 || BF532 || BF533 || BF534 || BF536 || BF537) |
| 294 | default y | 319 | default y |
| 295 | 320 | ||
| 321 | config BF54xM | ||
| 322 | bool | ||
| 323 | depends on (BF542M || BF544M || BF547M || BF548M || BF549M) | ||
| 324 | default y | ||
| 325 | |||
| 296 | config BF54x | 326 | config BF54x |
| 297 | bool | 327 | bool |
| 298 | depends on (BF542 || BF544 || BF547 || BF548 || BF549) | 328 | depends on (BF542 || BF544 || BF547 || BF548 || BF549 || BF54xM) |
| 299 | default y | 329 | default y |
| 300 | 330 | ||
| 301 | config MEM_GENERIC_BOARD | 331 | config MEM_GENERIC_BOARD |
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile index e550c8d46066..d54c8283825c 100644 --- a/arch/blackfin/Makefile +++ b/arch/blackfin/Makefile | |||
| @@ -21,57 +21,67 @@ KALLSYMS += --symbol-prefix=_ | |||
| 21 | KBUILD_DEFCONFIG := BF537-STAMP_defconfig | 21 | KBUILD_DEFCONFIG := BF537-STAMP_defconfig |
| 22 | 22 | ||
| 23 | # setup the machine name and the machine dependent settings | 23 | # setup the machine name and the machine dependent settings |
| 24 | machine-$(CONFIG_BF512) := bf518 | 24 | machine-$(CONFIG_BF512) := bf518 |
| 25 | machine-$(CONFIG_BF514) := bf518 | 25 | machine-$(CONFIG_BF514) := bf518 |
| 26 | machine-$(CONFIG_BF516) := bf518 | 26 | machine-$(CONFIG_BF516) := bf518 |
| 27 | machine-$(CONFIG_BF518) := bf518 | 27 | machine-$(CONFIG_BF518) := bf518 |
| 28 | machine-$(CONFIG_BF522) := bf527 | 28 | machine-$(CONFIG_BF522) := bf527 |
| 29 | machine-$(CONFIG_BF523) := bf527 | 29 | machine-$(CONFIG_BF523) := bf527 |
| 30 | machine-$(CONFIG_BF524) := bf527 | 30 | machine-$(CONFIG_BF524) := bf527 |
| 31 | machine-$(CONFIG_BF525) := bf527 | 31 | machine-$(CONFIG_BF525) := bf527 |
| 32 | machine-$(CONFIG_BF526) := bf527 | 32 | machine-$(CONFIG_BF526) := bf527 |
| 33 | machine-$(CONFIG_BF527) := bf527 | 33 | machine-$(CONFIG_BF527) := bf527 |
| 34 | machine-$(CONFIG_BF531) := bf533 | 34 | machine-$(CONFIG_BF531) := bf533 |
| 35 | machine-$(CONFIG_BF532) := bf533 | 35 | machine-$(CONFIG_BF532) := bf533 |
| 36 | machine-$(CONFIG_BF533) := bf533 | 36 | machine-$(CONFIG_BF533) := bf533 |
| 37 | machine-$(CONFIG_BF534) := bf537 | 37 | machine-$(CONFIG_BF534) := bf537 |
| 38 | machine-$(CONFIG_BF536) := bf537 | 38 | machine-$(CONFIG_BF536) := bf537 |
| 39 | machine-$(CONFIG_BF537) := bf537 | 39 | machine-$(CONFIG_BF537) := bf537 |
| 40 | machine-$(CONFIG_BF538) := bf538 | 40 | machine-$(CONFIG_BF538) := bf538 |
| 41 | machine-$(CONFIG_BF539) := bf538 | 41 | machine-$(CONFIG_BF539) := bf538 |
| 42 | machine-$(CONFIG_BF542) := bf548 | 42 | machine-$(CONFIG_BF542) := bf548 |
| 43 | machine-$(CONFIG_BF544) := bf548 | 43 | machine-$(CONFIG_BF542M) := bf548 |
| 44 | machine-$(CONFIG_BF547) := bf548 | 44 | machine-$(CONFIG_BF544) := bf548 |
| 45 | machine-$(CONFIG_BF548) := bf548 | 45 | machine-$(CONFIG_BF544M) := bf548 |
| 46 | machine-$(CONFIG_BF549) := bf548 | 46 | machine-$(CONFIG_BF547) := bf548 |
| 47 | machine-$(CONFIG_BF561) := bf561 | 47 | machine-$(CONFIG_BF547M) := bf548 |
| 48 | machine-$(CONFIG_BF548) := bf548 | ||
| 49 | machine-$(CONFIG_BF548M) := bf548 | ||
| 50 | machine-$(CONFIG_BF549) := bf548 | ||
| 51 | machine-$(CONFIG_BF549M) := bf548 | ||
| 52 | machine-$(CONFIG_BF561) := bf561 | ||
| 48 | MACHINE := $(machine-y) | 53 | MACHINE := $(machine-y) |
| 49 | export MACHINE | 54 | export MACHINE |
| 50 | 55 | ||
| 51 | cpu-$(CONFIG_BF512) := bf512 | 56 | cpu-$(CONFIG_BF512) := bf512 |
| 52 | cpu-$(CONFIG_BF514) := bf514 | 57 | cpu-$(CONFIG_BF514) := bf514 |
| 53 | cpu-$(CONFIG_BF516) := bf516 | 58 | cpu-$(CONFIG_BF516) := bf516 |
| 54 | cpu-$(CONFIG_BF518) := bf518 | 59 | cpu-$(CONFIG_BF518) := bf518 |
| 55 | cpu-$(CONFIG_BF522) := bf522 | 60 | cpu-$(CONFIG_BF522) := bf522 |
| 56 | cpu-$(CONFIG_BF523) := bf523 | 61 | cpu-$(CONFIG_BF523) := bf523 |
| 57 | cpu-$(CONFIG_BF524) := bf524 | 62 | cpu-$(CONFIG_BF524) := bf524 |
| 58 | cpu-$(CONFIG_BF525) := bf525 | 63 | cpu-$(CONFIG_BF525) := bf525 |
| 59 | cpu-$(CONFIG_BF526) := bf526 | 64 | cpu-$(CONFIG_BF526) := bf526 |
| 60 | cpu-$(CONFIG_BF527) := bf527 | 65 | cpu-$(CONFIG_BF527) := bf527 |
| 61 | cpu-$(CONFIG_BF531) := bf531 | 66 | cpu-$(CONFIG_BF531) := bf531 |
| 62 | cpu-$(CONFIG_BF532) := bf532 | 67 | cpu-$(CONFIG_BF532) := bf532 |
| 63 | cpu-$(CONFIG_BF533) := bf533 | 68 | cpu-$(CONFIG_BF533) := bf533 |
| 64 | cpu-$(CONFIG_BF534) := bf534 | 69 | cpu-$(CONFIG_BF534) := bf534 |
| 65 | cpu-$(CONFIG_BF536) := bf536 | 70 | cpu-$(CONFIG_BF536) := bf536 |
| 66 | cpu-$(CONFIG_BF537) := bf537 | 71 | cpu-$(CONFIG_BF537) := bf537 |
| 67 | cpu-$(CONFIG_BF538) := bf538 | 72 | cpu-$(CONFIG_BF538) := bf538 |
| 68 | cpu-$(CONFIG_BF539) := bf539 | 73 | cpu-$(CONFIG_BF539) := bf539 |
| 69 | cpu-$(CONFIG_BF542) := bf542 | 74 | cpu-$(CONFIG_BF542) := bf542 |
| 70 | cpu-$(CONFIG_BF544) := bf544 | 75 | cpu-$(CONFIG_BF542M) := bf542m |
| 71 | cpu-$(CONFIG_BF547) := bf547 | 76 | cpu-$(CONFIG_BF544) := bf544 |
| 72 | cpu-$(CONFIG_BF548) := bf548 | 77 | cpu-$(CONFIG_BF544M) := bf544m |
| 73 | cpu-$(CONFIG_BF549) := bf549 | 78 | cpu-$(CONFIG_BF547) := bf547 |
| 74 | cpu-$(CONFIG_BF561) := bf561 | 79 | cpu-$(CONFIG_BF547M) := bf547m |
| 80 | cpu-$(CONFIG_BF548) := bf548 | ||
| 81 | cpu-$(CONFIG_BF548M) := bf548m | ||
| 82 | cpu-$(CONFIG_BF549) := bf549 | ||
| 83 | cpu-$(CONFIG_BF549M) := bf549m | ||
| 84 | cpu-$(CONFIG_BF561) := bf561 | ||
| 75 | 85 | ||
| 76 | rev-$(CONFIG_BF_REV_0_0) := 0.0 | 86 | rev-$(CONFIG_BF_REV_0_0) := 0.0 |
| 77 | rev-$(CONFIG_BF_REV_0_1) := 0.1 | 87 | rev-$(CONFIG_BF_REV_0_1) := 0.1 |
diff --git a/arch/blackfin/configs/BF518F-EZBRD_defconfig b/arch/blackfin/configs/BF518F-EZBRD_defconfig index defb9785c65b..4fdb9e04759f 100644 --- a/arch/blackfin/configs/BF518F-EZBRD_defconfig +++ b/arch/blackfin/configs/BF518F-EZBRD_defconfig | |||
| @@ -1,6 +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.28-rc2 | 3 | # Linux kernel version: 2.6.28-rc2 |
| 4 | # Fri Jan 9 17:58:41 2009 | ||
| 4 | # | 5 | # |
| 5 | # CONFIG_MMU is not set | 6 | # CONFIG_MMU is not set |
| 6 | # CONFIG_FPU is not set | 7 | # CONFIG_FPU is not set |
| @@ -149,6 +150,7 @@ CONFIG_BF_REV_0_0=y | |||
| 149 | # CONFIG_BF_REV_ANY is not set | 150 | # CONFIG_BF_REV_ANY is not set |
| 150 | # CONFIG_BF_REV_NONE is not set | 151 | # CONFIG_BF_REV_NONE is not set |
| 151 | CONFIG_BF51x=y | 152 | CONFIG_BF51x=y |
| 153 | CONFIG_MEM_MT48LC32M8A2_75=y | ||
| 152 | CONFIG_BFIN518F_EZBRD=y | 154 | CONFIG_BFIN518F_EZBRD=y |
| 153 | 155 | ||
| 154 | # | 156 | # |
| @@ -598,7 +600,10 @@ CONFIG_PHYLIB=y | |||
| 598 | # CONFIG_MDIO_BITBANG is not set | 600 | # CONFIG_MDIO_BITBANG is not set |
| 599 | CONFIG_NET_ETHERNET=y | 601 | CONFIG_NET_ETHERNET=y |
| 600 | CONFIG_MII=y | 602 | CONFIG_MII=y |
| 601 | # CONFIG_BFIN_MAC is not set | 603 | CONFIG_BFIN_MAC=y |
| 604 | CONFIG_BFIN_TX_DESC_NUM=10 | ||
| 605 | CONFIG_BFIN_RX_DESC_NUM=20 | ||
| 606 | # CONFIG_BFIN_MAC_RMII is not set | ||
| 602 | # CONFIG_SMC91X is not set | 607 | # CONFIG_SMC91X is not set |
| 603 | # CONFIG_SMSC911X is not set | 608 | # CONFIG_SMSC911X is not set |
| 604 | # CONFIG_DM9000 is not set | 609 | # CONFIG_DM9000 is not set |
| @@ -679,7 +684,7 @@ CONFIG_VT_CONSOLE=y | |||
| 679 | CONFIG_HW_CONSOLE=y | 684 | CONFIG_HW_CONSOLE=y |
| 680 | # CONFIG_VT_HW_CONSOLE_BINDING is not set | 685 | # CONFIG_VT_HW_CONSOLE_BINDING is not set |
| 681 | # CONFIG_DEVKMEM is not set | 686 | # CONFIG_DEVKMEM is not set |
| 682 | # CONFIG_BFIN_JTAG_COMM is not set | 687 | CONFIG_BFIN_JTAG_COMM=m |
| 683 | # CONFIG_SERIAL_NONSTANDARD is not set | 688 | # CONFIG_SERIAL_NONSTANDARD is not set |
| 684 | 689 | ||
| 685 | # | 690 | # |
diff --git a/arch/blackfin/configs/BF526-EZBRD_defconfig b/arch/blackfin/configs/BF526-EZBRD_defconfig index 992424ff3153..8e2b855b8db7 100644 --- a/arch/blackfin/configs/BF526-EZBRD_defconfig +++ b/arch/blackfin/configs/BF526-EZBRD_defconfig | |||
| @@ -723,7 +723,7 @@ CONFIG_VT_CONSOLE=y | |||
| 723 | CONFIG_HW_CONSOLE=y | 723 | CONFIG_HW_CONSOLE=y |
| 724 | # CONFIG_VT_HW_CONSOLE_BINDING is not set | 724 | # CONFIG_VT_HW_CONSOLE_BINDING is not set |
| 725 | # CONFIG_DEVKMEM is not set | 725 | # CONFIG_DEVKMEM is not set |
| 726 | # CONFIG_BFIN_JTAG_COMM is not set | 726 | CONFIG_BFIN_JTAG_COMM=m |
| 727 | # CONFIG_SERIAL_NONSTANDARD is not set | 727 | # CONFIG_SERIAL_NONSTANDARD is not set |
| 728 | 728 | ||
| 729 | # | 729 | # |
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig index 21e3c1af55ba..833128b39724 100644 --- a/arch/blackfin/configs/BF527-EZKIT_defconfig +++ b/arch/blackfin/configs/BF527-EZKIT_defconfig | |||
| @@ -767,7 +767,7 @@ CONFIG_VT_CONSOLE=y | |||
| 767 | CONFIG_HW_CONSOLE=y | 767 | CONFIG_HW_CONSOLE=y |
| 768 | # CONFIG_VT_HW_CONSOLE_BINDING is not set | 768 | # CONFIG_VT_HW_CONSOLE_BINDING is not set |
| 769 | # CONFIG_DEVKMEM is not set | 769 | # CONFIG_DEVKMEM is not set |
| 770 | # CONFIG_BFIN_JTAG_COMM is not set | 770 | CONFIG_BFIN_JTAG_COMM=m |
| 771 | # CONFIG_SERIAL_NONSTANDARD is not set | 771 | # CONFIG_SERIAL_NONSTANDARD is not set |
| 772 | 772 | ||
| 773 | # | 773 | # |
diff --git a/arch/blackfin/configs/BF533-EZKIT_defconfig b/arch/blackfin/configs/BF533-EZKIT_defconfig index 0bdf20a1af61..334c94b51c40 100644 --- a/arch/blackfin/configs/BF533-EZKIT_defconfig +++ b/arch/blackfin/configs/BF533-EZKIT_defconfig | |||
| @@ -672,7 +672,7 @@ CONFIG_BFIN_DMA_INTERFACE=m | |||
| 672 | CONFIG_SIMPLE_GPIO=m | 672 | CONFIG_SIMPLE_GPIO=m |
| 673 | # CONFIG_VT is not set | 673 | # CONFIG_VT is not set |
| 674 | # CONFIG_DEVKMEM is not set | 674 | # CONFIG_DEVKMEM is not set |
| 675 | # CONFIG_BFIN_JTAG_COMM is not set | 675 | CONFIG_BFIN_JTAG_COMM=m |
| 676 | # CONFIG_SERIAL_NONSTANDARD is not set | 676 | # CONFIG_SERIAL_NONSTANDARD is not set |
| 677 | 677 | ||
| 678 | # | 678 | # |
diff --git a/arch/blackfin/configs/BF533-STAMP_defconfig b/arch/blackfin/configs/BF533-STAMP_defconfig index 2f747d6e97e2..9d733436e300 100644 --- a/arch/blackfin/configs/BF533-STAMP_defconfig +++ b/arch/blackfin/configs/BF533-STAMP_defconfig | |||
| @@ -679,7 +679,7 @@ CONFIG_BFIN_DMA_INTERFACE=m | |||
| 679 | CONFIG_SIMPLE_GPIO=m | 679 | CONFIG_SIMPLE_GPIO=m |
| 680 | # CONFIG_VT is not set | 680 | # CONFIG_VT is not set |
| 681 | # CONFIG_DEVKMEM is not set | 681 | # CONFIG_DEVKMEM is not set |
| 682 | # CONFIG_BFIN_JTAG_COMM is not set | 682 | CONFIG_BFIN_JTAG_COMM=m |
| 683 | # CONFIG_SERIAL_NONSTANDARD is not set | 683 | # CONFIG_SERIAL_NONSTANDARD is not set |
| 684 | 684 | ||
| 685 | # | 685 | # |
diff --git a/arch/blackfin/configs/BF537-STAMP_defconfig b/arch/blackfin/configs/BF537-STAMP_defconfig index 8b0a81294e65..4fb4108d3103 100644 --- a/arch/blackfin/configs/BF537-STAMP_defconfig +++ b/arch/blackfin/configs/BF537-STAMP_defconfig | |||
| @@ -722,7 +722,7 @@ CONFIG_BFIN_DMA_INTERFACE=m | |||
| 722 | CONFIG_SIMPLE_GPIO=m | 722 | CONFIG_SIMPLE_GPIO=m |
| 723 | # CONFIG_VT is not set | 723 | # CONFIG_VT is not set |
| 724 | # CONFIG_DEVKMEM is not set | 724 | # CONFIG_DEVKMEM is not set |
| 725 | # CONFIG_BFIN_JTAG_COMM is not set | 725 | CONFIG_BFIN_JTAG_COMM=m |
| 726 | # CONFIG_SERIAL_NONSTANDARD is not set | 726 | # CONFIG_SERIAL_NONSTANDARD is not set |
| 727 | 727 | ||
| 728 | # | 728 | # |
diff --git a/arch/blackfin/configs/BF538-EZKIT_defconfig b/arch/blackfin/configs/BF538-EZKIT_defconfig index a1f766bf7d9b..cb32f5624a1b 100644 --- a/arch/blackfin/configs/BF538-EZKIT_defconfig +++ b/arch/blackfin/configs/BF538-EZKIT_defconfig | |||
| @@ -726,7 +726,7 @@ CONFIG_BFIN_DMA_INTERFACE=m | |||
| 726 | CONFIG_SIMPLE_GPIO=m | 726 | CONFIG_SIMPLE_GPIO=m |
| 727 | # CONFIG_VT is not set | 727 | # CONFIG_VT is not set |
| 728 | # CONFIG_DEVKMEM is not set | 728 | # CONFIG_DEVKMEM is not set |
| 729 | # CONFIG_BFIN_JTAG_COMM is not set | 729 | CONFIG_BFIN_JTAG_COMM=m |
| 730 | # CONFIG_SERIAL_NONSTANDARD is not set | 730 | # CONFIG_SERIAL_NONSTANDARD is not set |
| 731 | 731 | ||
| 732 | # | 732 | # |
diff --git a/arch/blackfin/configs/BF548-EZKIT_defconfig b/arch/blackfin/configs/BF548-EZKIT_defconfig index cd2da6b7692c..0f8697618aa5 100644 --- a/arch/blackfin/configs/BF548-EZKIT_defconfig +++ b/arch/blackfin/configs/BF548-EZKIT_defconfig | |||
| @@ -856,7 +856,7 @@ CONFIG_VT_CONSOLE=y | |||
| 856 | CONFIG_HW_CONSOLE=y | 856 | CONFIG_HW_CONSOLE=y |
| 857 | # CONFIG_VT_HW_CONSOLE_BINDING is not set | 857 | # CONFIG_VT_HW_CONSOLE_BINDING is not set |
| 858 | # CONFIG_DEVKMEM is not set | 858 | # CONFIG_DEVKMEM is not set |
| 859 | # CONFIG_BFIN_JTAG_COMM is not set | 859 | CONFIG_BFIN_JTAG_COMM=m |
| 860 | # CONFIG_SERIAL_NONSTANDARD is not set | 860 | # CONFIG_SERIAL_NONSTANDARD is not set |
| 861 | 861 | ||
| 862 | # | 862 | # |
diff --git a/arch/blackfin/configs/BF561-EZKIT_defconfig b/arch/blackfin/configs/BF561-EZKIT_defconfig index b398ca202dbd..042c7adfccfa 100644 --- a/arch/blackfin/configs/BF561-EZKIT_defconfig +++ b/arch/blackfin/configs/BF561-EZKIT_defconfig | |||
| @@ -709,7 +709,7 @@ CONFIG_BFIN_DMA_INTERFACE=m | |||
| 709 | CONFIG_SIMPLE_GPIO=m | 709 | CONFIG_SIMPLE_GPIO=m |
| 710 | # CONFIG_VT is not set | 710 | # CONFIG_VT is not set |
| 711 | # CONFIG_DEVKMEM is not set | 711 | # CONFIG_DEVKMEM is not set |
| 712 | # CONFIG_BFIN_JTAG_COMM is not set | 712 | CONFIG_BFIN_JTAG_COMM=m |
| 713 | # CONFIG_SERIAL_NONSTANDARD is not set | 713 | # CONFIG_SERIAL_NONSTANDARD is not set |
| 714 | 714 | ||
| 715 | # | 715 | # |
diff --git a/arch/blackfin/configs/CM-BF527_defconfig b/arch/blackfin/configs/CM-BF527_defconfig index 95146948166f..865ed85a5760 100644 --- a/arch/blackfin/configs/CM-BF527_defconfig +++ b/arch/blackfin/configs/CM-BF527_defconfig | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | # | 1 | # |
| 2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
| 3 | # Linux kernel version: 2.6.24.7 | 3 | # Linux kernel version: 2.6.28 |
| 4 | # Fri Jul 18 18:00:41 2008 | ||
| 5 | # | 4 | # |
| 6 | # CONFIG_MMU is not set | 5 | # CONFIG_MMU is not set |
| 7 | # CONFIG_FPU is not set | 6 | # CONFIG_FPU is not set |
| @@ -9,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y | |||
| 9 | # CONFIG_RWSEM_XCHGADD_ALGORITHM is not set | 8 | # CONFIG_RWSEM_XCHGADD_ALGORITHM is not set |
| 10 | CONFIG_BLACKFIN=y | 9 | CONFIG_BLACKFIN=y |
| 11 | CONFIG_ZONE_DMA=y | 10 | CONFIG_ZONE_DMA=y |
| 12 | CONFIG_SEMAPHORE_SLEEPERS=y | ||
| 13 | CONFIG_GENERIC_FIND_NEXT_BIT=y | 11 | CONFIG_GENERIC_FIND_NEXT_BIT=y |
| 14 | CONFIG_GENERIC_HWEIGHT=y | 12 | CONFIG_GENERIC_HWEIGHT=y |
| 15 | CONFIG_GENERIC_HARDIRQS=y | 13 | CONFIG_GENERIC_HARDIRQS=y |
| @@ -32,18 +30,16 @@ CONFIG_SYSVIPC_SYSCTL=y | |||
| 32 | # CONFIG_POSIX_MQUEUE is not set | 30 | # CONFIG_POSIX_MQUEUE is not set |
| 33 | # CONFIG_BSD_PROCESS_ACCT is not set | 31 | # CONFIG_BSD_PROCESS_ACCT is not set |
| 34 | # CONFIG_TASKSTATS is not set | 32 | # CONFIG_TASKSTATS is not set |
| 35 | # CONFIG_USER_NS is not set | ||
| 36 | # CONFIG_PID_NS is not set | ||
| 37 | # CONFIG_AUDIT is not set | 33 | # CONFIG_AUDIT is not set |
| 38 | CONFIG_IKCONFIG=y | 34 | CONFIG_IKCONFIG=y |
| 39 | CONFIG_IKCONFIG_PROC=y | 35 | CONFIG_IKCONFIG_PROC=y |
| 40 | CONFIG_LOG_BUF_SHIFT=14 | 36 | CONFIG_LOG_BUF_SHIFT=14 |
| 41 | # CONFIG_CGROUPS is not set | 37 | # CONFIG_CGROUPS is not set |
| 42 | CONFIG_FAIR_GROUP_SCHED=y | 38 | # CONFIG_GROUP_SCHED is not set |
| 43 | CONFIG_FAIR_USER_SCHED=y | 39 | CONFIG_SYSFS_DEPRECATED=y |
| 44 | # CONFIG_FAIR_CGROUP_SCHED is not set | 40 | CONFIG_SYSFS_DEPRECATED_V2=y |
| 45 | # CONFIG_SYSFS_DEPRECATED is not set | ||
| 46 | # CONFIG_RELAY is not set | 41 | # CONFIG_RELAY is not set |
| 42 | # CONFIG_NAMESPACES is not set | ||
| 47 | CONFIG_BLK_DEV_INITRD=y | 43 | CONFIG_BLK_DEV_INITRD=y |
| 48 | CONFIG_INITRAMFS_SOURCE="" | 44 | CONFIG_INITRAMFS_SOURCE="" |
| 49 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | 45 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set |
| @@ -52,26 +48,35 @@ CONFIG_EMBEDDED=y | |||
| 52 | CONFIG_UID16=y | 48 | CONFIG_UID16=y |
| 53 | CONFIG_SYSCTL_SYSCALL=y | 49 | CONFIG_SYSCTL_SYSCALL=y |
| 54 | CONFIG_KALLSYMS=y | 50 | CONFIG_KALLSYMS=y |
| 51 | # CONFIG_KALLSYMS_ALL is not set | ||
| 55 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | 52 | # CONFIG_KALLSYMS_EXTRA_PASS is not set |
| 56 | CONFIG_HOTPLUG=y | 53 | CONFIG_HOTPLUG=y |
| 57 | CONFIG_PRINTK=y | 54 | CONFIG_PRINTK=y |
| 58 | CONFIG_BUG=y | 55 | CONFIG_BUG=y |
| 59 | # CONFIG_ELF_CORE is not set | 56 | # CONFIG_ELF_CORE is not set |
| 57 | CONFIG_COMPAT_BRK=y | ||
| 60 | CONFIG_BASE_FULL=y | 58 | CONFIG_BASE_FULL=y |
| 61 | CONFIG_FUTEX=y | 59 | CONFIG_FUTEX=y |
| 62 | CONFIG_ANON_INODES=y | 60 | CONFIG_ANON_INODES=y |
| 63 | CONFIG_EPOLL=y | 61 | CONFIG_EPOLL=y |
| 64 | CONFIG_SIGNALFD=y | 62 | CONFIG_SIGNALFD=y |
| 63 | CONFIG_TIMERFD=y | ||
| 65 | CONFIG_EVENTFD=y | 64 | CONFIG_EVENTFD=y |
| 65 | CONFIG_AIO=y | ||
| 66 | CONFIG_VM_EVENT_COUNTERS=y | 66 | CONFIG_VM_EVENT_COUNTERS=y |
| 67 | CONFIG_SLAB=y | 67 | CONFIG_SLAB=y |
| 68 | # CONFIG_SLUB is not set | 68 | # CONFIG_SLUB is not set |
| 69 | # CONFIG_SLOB is not set | 69 | # CONFIG_SLOB is not set |
| 70 | # CONFIG_PROFILING is not set | ||
| 71 | # CONFIG_MARKERS is not set | ||
| 72 | CONFIG_HAVE_OPROFILE=y | ||
| 73 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set | ||
| 70 | CONFIG_SLABINFO=y | 74 | CONFIG_SLABINFO=y |
| 71 | CONFIG_RT_MUTEXES=y | 75 | CONFIG_RT_MUTEXES=y |
| 72 | CONFIG_TINY_SHMEM=y | 76 | CONFIG_TINY_SHMEM=y |
| 73 | CONFIG_BASE_SMALL=0 | 77 | CONFIG_BASE_SMALL=0 |
| 74 | CONFIG_MODULES=y | 78 | CONFIG_MODULES=y |
| 79 | # CONFIG_MODULE_FORCE_LOAD is not set | ||
| 75 | CONFIG_MODULE_UNLOAD=y | 80 | CONFIG_MODULE_UNLOAD=y |
| 76 | # CONFIG_MODULE_FORCE_UNLOAD is not set | 81 | # CONFIG_MODULE_FORCE_UNLOAD is not set |
| 77 | # CONFIG_MODVERSIONS is not set | 82 | # CONFIG_MODVERSIONS is not set |
| @@ -82,6 +87,7 @@ CONFIG_BLOCK=y | |||
| 82 | # CONFIG_BLK_DEV_IO_TRACE is not set | 87 | # CONFIG_BLK_DEV_IO_TRACE is not set |
| 83 | # CONFIG_LSF is not set | 88 | # CONFIG_LSF is not set |
| 84 | # CONFIG_BLK_DEV_BSG is not set | 89 | # CONFIG_BLK_DEV_BSG is not set |
| 90 | # CONFIG_BLK_DEV_INTEGRITY is not set | ||
| 85 | 91 | ||
| 86 | # | 92 | # |
| 87 | # IO Schedulers | 93 | # IO Schedulers |
| @@ -95,9 +101,11 @@ CONFIG_IOSCHED_CFQ=y | |||
| 95 | CONFIG_DEFAULT_CFQ=y | 101 | CONFIG_DEFAULT_CFQ=y |
| 96 | # CONFIG_DEFAULT_NOOP is not set | 102 | # CONFIG_DEFAULT_NOOP is not set |
| 97 | CONFIG_DEFAULT_IOSCHED="cfq" | 103 | CONFIG_DEFAULT_IOSCHED="cfq" |
| 104 | CONFIG_CLASSIC_RCU=y | ||
| 98 | # CONFIG_PREEMPT_NONE is not set | 105 | # CONFIG_PREEMPT_NONE is not set |
| 99 | CONFIG_PREEMPT_VOLUNTARY=y | 106 | CONFIG_PREEMPT_VOLUNTARY=y |
| 100 | # CONFIG_PREEMPT is not set | 107 | # CONFIG_PREEMPT is not set |
| 108 | # CONFIG_FREEZER is not set | ||
| 101 | 109 | ||
| 102 | # | 110 | # |
| 103 | # Blackfin Processor Options | 111 | # Blackfin Processor Options |
| @@ -106,6 +114,10 @@ CONFIG_PREEMPT_VOLUNTARY=y | |||
| 106 | # | 114 | # |
| 107 | # Processor and Board Settings | 115 | # Processor and Board Settings |
| 108 | # | 116 | # |
| 117 | # CONFIG_BF512 is not set | ||
| 118 | # CONFIG_BF514 is not set | ||
| 119 | # CONFIG_BF516 is not set | ||
| 120 | # CONFIG_BF518 is not set | ||
| 109 | # CONFIG_BF522 is not set | 121 | # CONFIG_BF522 is not set |
| 110 | # CONFIG_BF523 is not set | 122 | # CONFIG_BF523 is not set |
| 111 | # CONFIG_BF524 is not set | 123 | # CONFIG_BF524 is not set |
| @@ -118,48 +130,32 @@ CONFIG_BF527=y | |||
| 118 | # CONFIG_BF534 is not set | 130 | # CONFIG_BF534 is not set |
| 119 | # CONFIG_BF536 is not set | 131 | # CONFIG_BF536 is not set |
| 120 | # CONFIG_BF537 is not set | 132 | # CONFIG_BF537 is not set |
| 133 | # CONFIG_BF538 is not set | ||
| 134 | # CONFIG_BF539 is not set | ||
| 121 | # CONFIG_BF542 is not set | 135 | # CONFIG_BF542 is not set |
| 136 | # CONFIG_BF542M is not set | ||
| 122 | # CONFIG_BF544 is not set | 137 | # CONFIG_BF544 is not set |
| 138 | # CONFIG_BF544M is not set | ||
| 123 | # CONFIG_BF547 is not set | 139 | # CONFIG_BF547 is not set |
| 140 | # CONFIG_BF547M is not set | ||
| 124 | # CONFIG_BF548 is not set | 141 | # CONFIG_BF548 is not set |
| 142 | # CONFIG_BF548M is not set | ||
| 125 | # CONFIG_BF549 is not set | 143 | # CONFIG_BF549 is not set |
| 144 | # CONFIG_BF549M is not set | ||
| 126 | # CONFIG_BF561 is not set | 145 | # CONFIG_BF561 is not set |
| 146 | CONFIG_BF_REV_MIN=0 | ||
| 147 | CONFIG_BF_REV_MAX=2 | ||
| 127 | # CONFIG_BF_REV_0_0 is not set | 148 | # CONFIG_BF_REV_0_0 is not set |
| 128 | CONFIG_BF_REV_0_1=y | 149 | CONFIG_BF_REV_0_1=y |
| 129 | # CONFIG_BF_REV_0_2 is not set | 150 | # CONFIG_BF_REV_0_2 is not set |
| 130 | # CONFIG_BF_REV_0_3 is not set | 151 | # CONFIG_BF_REV_0_3 is not set |
| 131 | # CONFIG_BF_REV_0_4 is not set | 152 | # CONFIG_BF_REV_0_4 is not set |
| 132 | # CONFIG_BF_REV_0_5 is not set | 153 | # CONFIG_BF_REV_0_5 is not set |
| 154 | # CONFIG_BF_REV_0_6 is not set | ||
| 133 | # CONFIG_BF_REV_ANY is not set | 155 | # CONFIG_BF_REV_ANY is not set |
| 134 | # CONFIG_BF_REV_NONE is not set | 156 | # CONFIG_BF_REV_NONE is not set |
| 135 | CONFIG_BF52x=y | 157 | CONFIG_BF52x=y |
| 136 | CONFIG_MEM_MT48LC16M16A2TG_75=y | 158 | CONFIG_MEM_MT48LC16M16A2TG_75=y |
| 137 | # CONFIG_BFIN527_EZKIT is not set | ||
| 138 | CONFIG_BFIN527_BLUETECHNIX_CM=y | ||
| 139 | |||
| 140 | # | ||
| 141 | # BF527 Specific Configuration | ||
| 142 | # | ||
| 143 | |||
| 144 | # | ||
| 145 | # Alternative Multiplexing Scheme | ||
| 146 | # | ||
| 147 | # CONFIG_BF527_SPORT0_PORTF is not set | ||
| 148 | CONFIG_BF527_SPORT0_PORTG=y | ||
| 149 | CONFIG_BF527_SPORT0_TSCLK_PG10=y | ||
| 150 | # CONFIG_BF527_SPORT0_TSCLK_PG14 is not set | ||
| 151 | CONFIG_BF527_UART1_PORTF=y | ||
| 152 | # CONFIG_BF527_UART1_PORTG is not set | ||
| 153 | # CONFIG_BF527_NAND_D_PORTF is not set | ||
| 154 | CONFIG_BF527_NAND_D_PORTH=y | ||
| 155 | |||
| 156 | # | ||
| 157 | # Interrupt Priority Assignment | ||
| 158 | # | ||
| 159 | |||
| 160 | # | ||
| 161 | # Priority | ||
| 162 | # | ||
| 163 | CONFIG_IRQ_PLL_WAKEUP=7 | 159 | CONFIG_IRQ_PLL_WAKEUP=7 |
| 164 | CONFIG_IRQ_DMA0_ERROR=7 | 160 | CONFIG_IRQ_DMA0_ERROR=7 |
| 165 | CONFIG_IRQ_DMAR0_BLK=7 | 161 | CONFIG_IRQ_DMAR0_BLK=7 |
| @@ -179,7 +175,6 @@ CONFIG_IRQ_SPORT0_TX=9 | |||
| 179 | CONFIG_IRQ_SPORT1_RX=9 | 175 | CONFIG_IRQ_SPORT1_RX=9 |
| 180 | CONFIG_IRQ_SPORT1_TX=9 | 176 | CONFIG_IRQ_SPORT1_TX=9 |
| 181 | CONFIG_IRQ_TWI=10 | 177 | CONFIG_IRQ_TWI=10 |
| 182 | CONFIG_IRQ_SPI=10 | ||
| 183 | CONFIG_IRQ_UART0_RX=10 | 178 | CONFIG_IRQ_UART0_RX=10 |
| 184 | CONFIG_IRQ_UART0_TX=10 | 179 | CONFIG_IRQ_UART0_TX=10 |
| 185 | CONFIG_IRQ_UART1_RX=10 | 180 | CONFIG_IRQ_UART1_RX=10 |
| @@ -205,6 +200,34 @@ CONFIG_IRQ_MEM_DMA1=13 | |||
| 205 | CONFIG_IRQ_WATCH=13 | 200 | CONFIG_IRQ_WATCH=13 |
| 206 | CONFIG_IRQ_PORTF_INTA=13 | 201 | CONFIG_IRQ_PORTF_INTA=13 |
| 207 | CONFIG_IRQ_PORTF_INTB=13 | 202 | CONFIG_IRQ_PORTF_INTB=13 |
| 203 | # CONFIG_BFIN527_EZKIT is not set | ||
| 204 | CONFIG_BFIN527_BLUETECHNIX_CM=y | ||
| 205 | # CONFIG_BFIN526_EZBRD is not set | ||
| 206 | |||
| 207 | # | ||
| 208 | # BF527 Specific Configuration | ||
| 209 | # | ||
| 210 | |||
| 211 | # | ||
| 212 | # Alternative Multiplexing Scheme | ||
| 213 | # | ||
| 214 | # CONFIG_BF527_SPORT0_PORTF is not set | ||
| 215 | CONFIG_BF527_SPORT0_PORTG=y | ||
| 216 | CONFIG_BF527_SPORT0_TSCLK_PG10=y | ||
| 217 | # CONFIG_BF527_SPORT0_TSCLK_PG14 is not set | ||
| 218 | CONFIG_BF527_UART1_PORTF=y | ||
| 219 | # CONFIG_BF527_UART1_PORTG is not set | ||
| 220 | # CONFIG_BF527_NAND_D_PORTF is not set | ||
| 221 | CONFIG_BF527_NAND_D_PORTH=y | ||
| 222 | |||
| 223 | # | ||
| 224 | # Interrupt Priority Assignment | ||
| 225 | # | ||
| 226 | |||
| 227 | # | ||
| 228 | # Priority | ||
| 229 | # | ||
| 230 | CONFIG_IRQ_SPI=10 | ||
| 208 | CONFIG_IRQ_SPI_ERROR=7 | 231 | CONFIG_IRQ_SPI_ERROR=7 |
| 209 | CONFIG_IRQ_NFC_ERROR=7 | 232 | CONFIG_IRQ_NFC_ERROR=7 |
| 210 | CONFIG_IRQ_HDMA_ERROR=7 | 233 | CONFIG_IRQ_HDMA_ERROR=7 |
| @@ -226,7 +249,6 @@ CONFIG_BOOT_LOAD=0x1000 | |||
| 226 | # | 249 | # |
| 227 | CONFIG_CLKIN_HZ=25000000 | 250 | CONFIG_CLKIN_HZ=25000000 |
| 228 | # CONFIG_BFIN_KERNEL_CLOCK is not set | 251 | # CONFIG_BFIN_KERNEL_CLOCK is not set |
| 229 | CONFIG_MAX_MEM_SIZE=512 | ||
| 230 | CONFIG_MAX_VCO_HZ=600000000 | 252 | CONFIG_MAX_VCO_HZ=600000000 |
| 231 | CONFIG_MIN_VCO_HZ=50000000 | 253 | CONFIG_MIN_VCO_HZ=50000000 |
| 232 | CONFIG_MAX_SCLK_HZ=133333333 | 254 | CONFIG_MAX_SCLK_HZ=133333333 |
| @@ -240,10 +262,10 @@ CONFIG_HZ_250=y | |||
| 240 | # CONFIG_HZ_300 is not set | 262 | # CONFIG_HZ_300 is not set |
| 241 | # CONFIG_HZ_1000 is not set | 263 | # CONFIG_HZ_1000 is not set |
| 242 | CONFIG_HZ=250 | 264 | CONFIG_HZ=250 |
| 265 | # CONFIG_SCHED_HRTICK is not set | ||
| 243 | CONFIG_GENERIC_TIME=y | 266 | CONFIG_GENERIC_TIME=y |
| 244 | CONFIG_GENERIC_CLOCKEVENTS=y | 267 | CONFIG_GENERIC_CLOCKEVENTS=y |
| 245 | # CONFIG_CYCLES_CLOCKSOURCE is not set | 268 | # CONFIG_CYCLES_CLOCKSOURCE is not set |
| 246 | # CONFIG_TICK_ONESHOT is not set | ||
| 247 | # CONFIG_NO_HZ is not set | 269 | # CONFIG_NO_HZ is not set |
| 248 | # CONFIG_HIGH_RES_TIMERS is not set | 270 | # CONFIG_HIGH_RES_TIMERS is not set |
| 249 | CONFIG_GENERIC_CLOCKEVENTS_BUILD=y | 271 | CONFIG_GENERIC_CLOCKEVENTS_BUILD=y |
| @@ -277,6 +299,12 @@ CONFIG_ACCESS_OK_L1=y | |||
| 277 | CONFIG_CACHELINE_ALIGNED_L1=y | 299 | CONFIG_CACHELINE_ALIGNED_L1=y |
| 278 | # CONFIG_SYSCALL_TAB_L1 is not set | 300 | # CONFIG_SYSCALL_TAB_L1 is not set |
| 279 | # CONFIG_CPLB_SWITCH_TAB_L1 is not set | 301 | # CONFIG_CPLB_SWITCH_TAB_L1 is not set |
| 302 | CONFIG_APP_STACK_L1=y | ||
| 303 | |||
| 304 | # | ||
| 305 | # Speed Optimizations | ||
| 306 | # | ||
| 307 | CONFIG_BFIN_INS_LOWOVERHEAD=y | ||
| 280 | CONFIG_RAMKERNEL=y | 308 | CONFIG_RAMKERNEL=y |
| 281 | # CONFIG_ROMKERNEL is not set | 309 | # CONFIG_ROMKERNEL is not set |
| 282 | CONFIG_SELECT_MEMORY_MODEL=y | 310 | CONFIG_SELECT_MEMORY_MODEL=y |
| @@ -285,10 +313,10 @@ CONFIG_FLATMEM_MANUAL=y | |||
| 285 | # CONFIG_SPARSEMEM_MANUAL is not set | 313 | # CONFIG_SPARSEMEM_MANUAL is not set |
| 286 | CONFIG_FLATMEM=y | 314 | CONFIG_FLATMEM=y |
| 287 | CONFIG_FLAT_NODE_MEM_MAP=y | 315 | CONFIG_FLAT_NODE_MEM_MAP=y |
| 288 | # CONFIG_SPARSEMEM_STATIC is not set | 316 | CONFIG_PAGEFLAGS_EXTENDED=y |
| 289 | # CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set | ||
| 290 | CONFIG_SPLIT_PTLOCK_CPUS=4 | 317 | CONFIG_SPLIT_PTLOCK_CPUS=4 |
| 291 | # CONFIG_RESOURCES_64BIT is not set | 318 | # CONFIG_RESOURCES_64BIT is not set |
| 319 | # CONFIG_PHYS_ADDR_T_64BIT is not set | ||
| 292 | CONFIG_ZONE_DMA_FLAG=1 | 320 | CONFIG_ZONE_DMA_FLAG=1 |
| 293 | CONFIG_VIRT_TO_BUS=y | 321 | CONFIG_VIRT_TO_BUS=y |
| 294 | CONFIG_BFIN_GPTIMERS=y | 322 | CONFIG_BFIN_GPTIMERS=y |
| @@ -334,7 +362,6 @@ CONFIG_BANK_3=0xFFC0 | |||
| 334 | # | 362 | # |
| 335 | # Bus options (PCI, PCMCIA, EISA, MCA, ISA) | 363 | # Bus options (PCI, PCMCIA, EISA, MCA, ISA) |
| 336 | # | 364 | # |
| 337 | # CONFIG_PCI is not set | ||
| 338 | # CONFIG_ARCH_SUPPORTS_MSI is not set | 365 | # CONFIG_ARCH_SUPPORTS_MSI is not set |
| 339 | # CONFIG_PCCARD is not set | 366 | # CONFIG_PCCARD is not set |
| 340 | 367 | ||
| @@ -345,25 +372,20 @@ CONFIG_BINFMT_ELF_FDPIC=y | |||
| 345 | CONFIG_BINFMT_FLAT=y | 372 | CONFIG_BINFMT_FLAT=y |
| 346 | CONFIG_BINFMT_ZFLAT=y | 373 | CONFIG_BINFMT_ZFLAT=y |
| 347 | # CONFIG_BINFMT_SHARED_FLAT is not set | 374 | # CONFIG_BINFMT_SHARED_FLAT is not set |
| 375 | # CONFIG_HAVE_AOUT is not set | ||
| 348 | # CONFIG_BINFMT_MISC is not set | 376 | # CONFIG_BINFMT_MISC is not set |
| 349 | 377 | ||
| 350 | # | 378 | # |
| 351 | # Power management options | 379 | # Power management options |
| 352 | # | 380 | # |
| 353 | # CONFIG_PM is not set | 381 | # CONFIG_PM is not set |
| 354 | CONFIG_SUSPEND_UP_POSSIBLE=y | 382 | CONFIG_ARCH_SUSPEND_POSSIBLE=y |
| 355 | # CONFIG_PM_BFIN_SLEEP_DEEPER is not set | ||
| 356 | # CONFIG_PM_BFIN_SLEEP is not set | ||
| 357 | # CONFIG_PM_WAKEUP_BY_GPIO is not set | 383 | # CONFIG_PM_WAKEUP_BY_GPIO is not set |
| 358 | 384 | ||
| 359 | # | 385 | # |
| 360 | # CPU Frequency scaling | 386 | # CPU Frequency scaling |
| 361 | # | 387 | # |
| 362 | # CONFIG_CPU_FREQ is not set | 388 | # CONFIG_CPU_FREQ is not set |
| 363 | |||
| 364 | # | ||
| 365 | # Networking | ||
| 366 | # | ||
| 367 | CONFIG_NET=y | 389 | CONFIG_NET=y |
| 368 | 390 | ||
| 369 | # | 391 | # |
| @@ -376,6 +398,7 @@ CONFIG_XFRM=y | |||
| 376 | # CONFIG_XFRM_USER is not set | 398 | # CONFIG_XFRM_USER is not set |
| 377 | # CONFIG_XFRM_SUB_POLICY is not set | 399 | # CONFIG_XFRM_SUB_POLICY is not set |
| 378 | # CONFIG_XFRM_MIGRATE is not set | 400 | # CONFIG_XFRM_MIGRATE is not set |
| 401 | # CONFIG_XFRM_STATISTICS is not set | ||
| 379 | # CONFIG_NET_KEY is not set | 402 | # CONFIG_NET_KEY is not set |
| 380 | CONFIG_INET=y | 403 | CONFIG_INET=y |
| 381 | # CONFIG_IP_MULTICAST is not set | 404 | # CONFIG_IP_MULTICAST is not set |
| @@ -405,8 +428,6 @@ CONFIG_TCP_CONG_CUBIC=y | |||
| 405 | CONFIG_DEFAULT_TCP_CONG="cubic" | 428 | CONFIG_DEFAULT_TCP_CONG="cubic" |
| 406 | # CONFIG_TCP_MD5SIG is not set | 429 | # CONFIG_TCP_MD5SIG is not set |
| 407 | # CONFIG_IPV6 is not set | 430 | # CONFIG_IPV6 is not set |
| 408 | # CONFIG_INET6_XFRM_TUNNEL is not set | ||
| 409 | # CONFIG_INET6_TUNNEL is not set | ||
| 410 | # CONFIG_NETLABEL is not set | 431 | # CONFIG_NETLABEL is not set |
| 411 | # CONFIG_NETWORK_SECMARK is not set | 432 | # CONFIG_NETWORK_SECMARK is not set |
| 412 | # CONFIG_NETFILTER is not set | 433 | # CONFIG_NETFILTER is not set |
| @@ -415,6 +436,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic" | |||
| 415 | # CONFIG_TIPC is not set | 436 | # CONFIG_TIPC is not set |
| 416 | # CONFIG_ATM is not set | 437 | # CONFIG_ATM is not set |
| 417 | # CONFIG_BRIDGE is not set | 438 | # CONFIG_BRIDGE is not set |
| 439 | # CONFIG_NET_DSA is not set | ||
| 418 | # CONFIG_VLAN_8021Q is not set | 440 | # CONFIG_VLAN_8021Q is not set |
| 419 | # CONFIG_DECNET is not set | 441 | # CONFIG_DECNET is not set |
| 420 | # CONFIG_LLC2 is not set | 442 | # CONFIG_LLC2 is not set |
| @@ -431,14 +453,14 @@ CONFIG_DEFAULT_TCP_CONG="cubic" | |||
| 431 | # | 453 | # |
| 432 | # CONFIG_NET_PKTGEN is not set | 454 | # CONFIG_NET_PKTGEN is not set |
| 433 | # CONFIG_HAMRADIO is not set | 455 | # CONFIG_HAMRADIO is not set |
| 456 | # CONFIG_CAN is not set | ||
| 434 | # CONFIG_IRDA is not set | 457 | # CONFIG_IRDA is not set |
| 435 | # CONFIG_BT is not set | 458 | # CONFIG_BT is not set |
| 436 | # CONFIG_AF_RXRPC is not set | 459 | # CONFIG_AF_RXRPC is not set |
| 437 | 460 | # CONFIG_PHONET is not set | |
| 438 | # | 461 | CONFIG_WIRELESS=y |
| 439 | # Wireless | ||
| 440 | # | ||
| 441 | # CONFIG_CFG80211 is not set | 462 | # CONFIG_CFG80211 is not set |
| 463 | CONFIG_WIRELESS_OLD_REGULATORY=y | ||
| 442 | # CONFIG_WIRELESS_EXT is not set | 464 | # CONFIG_WIRELESS_EXT is not set |
| 443 | # CONFIG_MAC80211 is not set | 465 | # CONFIG_MAC80211 is not set |
| 444 | # CONFIG_IEEE80211 is not set | 466 | # CONFIG_IEEE80211 is not set |
| @@ -456,6 +478,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
| 456 | CONFIG_STANDALONE=y | 478 | CONFIG_STANDALONE=y |
| 457 | CONFIG_PREVENT_FIRMWARE_BUILD=y | 479 | CONFIG_PREVENT_FIRMWARE_BUILD=y |
| 458 | # CONFIG_FW_LOADER is not set | 480 | # CONFIG_FW_LOADER is not set |
| 481 | # CONFIG_DEBUG_DRIVER is not set | ||
| 482 | # CONFIG_DEBUG_DEVRES is not set | ||
| 459 | # CONFIG_SYS_HYPERVISOR is not set | 483 | # CONFIG_SYS_HYPERVISOR is not set |
| 460 | # CONFIG_CONNECTOR is not set | 484 | # CONFIG_CONNECTOR is not set |
| 461 | CONFIG_MTD=y | 485 | CONFIG_MTD=y |
| @@ -464,6 +488,7 @@ CONFIG_MTD=y | |||
| 464 | CONFIG_MTD_PARTITIONS=y | 488 | CONFIG_MTD_PARTITIONS=y |
| 465 | # CONFIG_MTD_REDBOOT_PARTS is not set | 489 | # CONFIG_MTD_REDBOOT_PARTS is not set |
| 466 | # CONFIG_MTD_CMDLINE_PARTS is not set | 490 | # CONFIG_MTD_CMDLINE_PARTS is not set |
| 491 | # CONFIG_MTD_AR7_PARTS is not set | ||
| 467 | 492 | ||
| 468 | # | 493 | # |
| 469 | # User Modules And Translation Layers | 494 | # User Modules And Translation Layers |
| @@ -507,6 +532,7 @@ CONFIG_MTD_ROM=m | |||
| 507 | # | 532 | # |
| 508 | CONFIG_MTD_COMPLEX_MAPPINGS=y | 533 | CONFIG_MTD_COMPLEX_MAPPINGS=y |
| 509 | # CONFIG_MTD_PHYSMAP is not set | 534 | # CONFIG_MTD_PHYSMAP is not set |
| 535 | # CONFIG_MTD_GPIO_ADDR is not set | ||
| 510 | # CONFIG_MTD_UCLINUX is not set | 536 | # CONFIG_MTD_UCLINUX is not set |
| 511 | # CONFIG_MTD_PLATRAM is not set | 537 | # CONFIG_MTD_PLATRAM is not set |
| 512 | 538 | ||
| @@ -542,10 +568,12 @@ CONFIG_BLK_DEV=y | |||
| 542 | CONFIG_BLK_DEV_RAM=y | 568 | CONFIG_BLK_DEV_RAM=y |
| 543 | CONFIG_BLK_DEV_RAM_COUNT=16 | 569 | CONFIG_BLK_DEV_RAM_COUNT=16 |
| 544 | CONFIG_BLK_DEV_RAM_SIZE=4096 | 570 | CONFIG_BLK_DEV_RAM_SIZE=4096 |
| 545 | CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 | 571 | # CONFIG_BLK_DEV_XIP is not set |
| 546 | # CONFIG_CDROM_PKTCDVD is not set | 572 | # CONFIG_CDROM_PKTCDVD is not set |
| 547 | # CONFIG_ATA_OVER_ETH is not set | 573 | # CONFIG_ATA_OVER_ETH is not set |
| 574 | # CONFIG_BLK_DEV_HD is not set | ||
| 548 | # CONFIG_MISC_DEVICES is not set | 575 | # CONFIG_MISC_DEVICES is not set |
| 576 | CONFIG_HAVE_IDE=y | ||
| 549 | # CONFIG_IDE is not set | 577 | # CONFIG_IDE is not set |
| 550 | 578 | ||
| 551 | # | 579 | # |
| @@ -558,7 +586,6 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 | |||
| 558 | # CONFIG_ATA is not set | 586 | # CONFIG_ATA is not set |
| 559 | # CONFIG_MD is not set | 587 | # CONFIG_MD is not set |
| 560 | CONFIG_NETDEVICES=y | 588 | CONFIG_NETDEVICES=y |
| 561 | # CONFIG_NETDEVICES_MULTIQUEUE is not set | ||
| 562 | # CONFIG_DUMMY is not set | 589 | # CONFIG_DUMMY is not set |
| 563 | # CONFIG_BONDING is not set | 590 | # CONFIG_BONDING is not set |
| 564 | # CONFIG_MACVLAN is not set | 591 | # CONFIG_MACVLAN is not set |
| @@ -579,6 +606,7 @@ CONFIG_PHYLIB=y | |||
| 579 | # CONFIG_SMSC_PHY is not set | 606 | # CONFIG_SMSC_PHY is not set |
| 580 | # CONFIG_BROADCOM_PHY is not set | 607 | # CONFIG_BROADCOM_PHY is not set |
| 581 | # CONFIG_ICPLUS_PHY is not set | 608 | # CONFIG_ICPLUS_PHY is not set |
| 609 | # CONFIG_REALTEK_PHY is not set | ||
| 582 | # CONFIG_FIXED_PHY is not set | 610 | # CONFIG_FIXED_PHY is not set |
| 583 | # CONFIG_MDIO_BITBANG is not set | 611 | # CONFIG_MDIO_BITBANG is not set |
| 584 | CONFIG_NET_ETHERNET=y | 612 | CONFIG_NET_ETHERNET=y |
| @@ -591,11 +619,14 @@ CONFIG_BFIN_MAC_RMII=y | |||
| 591 | # CONFIG_SMC91X is not set | 619 | # CONFIG_SMC91X is not set |
| 592 | # CONFIG_SMSC911X is not set | 620 | # CONFIG_SMSC911X is not set |
| 593 | # CONFIG_DM9000 is not set | 621 | # CONFIG_DM9000 is not set |
| 622 | # CONFIG_ENC28J60 is not set | ||
| 594 | # CONFIG_IBM_NEW_EMAC_ZMII is not set | 623 | # CONFIG_IBM_NEW_EMAC_ZMII is not set |
| 595 | # CONFIG_IBM_NEW_EMAC_RGMII is not set | 624 | # CONFIG_IBM_NEW_EMAC_RGMII is not set |
| 596 | # CONFIG_IBM_NEW_EMAC_TAH is not set | 625 | # CONFIG_IBM_NEW_EMAC_TAH is not set |
| 597 | # CONFIG_IBM_NEW_EMAC_EMAC4 is not set | 626 | # CONFIG_IBM_NEW_EMAC_EMAC4 is not set |
| 598 | # CONFIG_B44 is not set | 627 | # CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set |
| 628 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set | ||
| 629 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set | ||
| 599 | # CONFIG_NETDEV_1000 is not set | 630 | # CONFIG_NETDEV_1000 is not set |
| 600 | # CONFIG_NETDEV_10000 is not set | 631 | # CONFIG_NETDEV_10000 is not set |
| 601 | 632 | ||
| @@ -604,6 +635,7 @@ CONFIG_BFIN_MAC_RMII=y | |||
| 604 | # | 635 | # |
| 605 | # CONFIG_WLAN_PRE80211 is not set | 636 | # CONFIG_WLAN_PRE80211 is not set |
| 606 | # CONFIG_WLAN_80211 is not set | 637 | # CONFIG_WLAN_80211 is not set |
| 638 | # CONFIG_IWLWIFI_LEDS is not set | ||
| 607 | 639 | ||
| 608 | # | 640 | # |
| 609 | # USB Network Adapters | 641 | # USB Network Adapters |
| @@ -616,7 +648,6 @@ CONFIG_BFIN_MAC_RMII=y | |||
| 616 | # CONFIG_WAN is not set | 648 | # CONFIG_WAN is not set |
| 617 | # CONFIG_PPP is not set | 649 | # CONFIG_PPP is not set |
| 618 | # CONFIG_SLIP is not set | 650 | # CONFIG_SLIP is not set |
| 619 | # CONFIG_SHAPER is not set | ||
| 620 | # CONFIG_NETCONSOLE is not set | 651 | # CONFIG_NETCONSOLE is not set |
| 621 | # CONFIG_NETPOLL is not set | 652 | # CONFIG_NETPOLL is not set |
| 622 | # CONFIG_NET_POLL_CONTROLLER is not set | 653 | # CONFIG_NET_POLL_CONTROLLER is not set |
| @@ -642,14 +673,15 @@ CONFIG_BFIN_MAC_RMII=y | |||
| 642 | # CONFIG_BF5xx_PPIFCD is not set | 673 | # CONFIG_BF5xx_PPIFCD is not set |
| 643 | # CONFIG_BFIN_SIMPLE_TIMER is not set | 674 | # CONFIG_BFIN_SIMPLE_TIMER is not set |
| 644 | # CONFIG_BF5xx_PPI is not set | 675 | # CONFIG_BF5xx_PPI is not set |
| 645 | CONFIG_BFIN_OTP=y | 676 | # CONFIG_BF5xx_EPPI is not set |
| 646 | # CONFIG_BFIN_OTP_WRITE_ENABLE is not set | ||
| 647 | # CONFIG_BFIN_SPORT is not set | 677 | # CONFIG_BFIN_SPORT is not set |
| 648 | # CONFIG_BFIN_TIMER_LATENCY is not set | 678 | # CONFIG_BFIN_TIMER_LATENCY is not set |
| 649 | # CONFIG_TWI_LCD is not set | 679 | # CONFIG_TWI_LCD is not set |
| 680 | CONFIG_BFIN_DMA_INTERFACE=m | ||
| 650 | CONFIG_SIMPLE_GPIO=m | 681 | CONFIG_SIMPLE_GPIO=m |
| 651 | # CONFIG_VT is not set | 682 | # CONFIG_VT is not set |
| 652 | # CONFIG_DEVKMEM is not set | 683 | # CONFIG_DEVKMEM is not set |
| 684 | # CONFIG_BFIN_JTAG_COMM is not set | ||
| 653 | # CONFIG_SERIAL_NONSTANDARD is not set | 685 | # CONFIG_SERIAL_NONSTANDARD is not set |
| 654 | 686 | ||
| 655 | # | 687 | # |
| @@ -673,6 +705,8 @@ CONFIG_SERIAL_CORE_CONSOLE=y | |||
| 673 | # CONFIG_SERIAL_BFIN_SPORT is not set | 705 | # CONFIG_SERIAL_BFIN_SPORT is not set |
| 674 | CONFIG_UNIX98_PTYS=y | 706 | CONFIG_UNIX98_PTYS=y |
| 675 | # CONFIG_LEGACY_PTYS is not set | 707 | # CONFIG_LEGACY_PTYS is not set |
| 708 | CONFIG_BFIN_OTP=y | ||
| 709 | # CONFIG_BFIN_OTP_WRITE_ENABLE is not set | ||
| 676 | 710 | ||
| 677 | # | 711 | # |
| 678 | # CAN, the car bus and industrial fieldbus | 712 | # CAN, the car bus and industrial fieldbus |
| @@ -680,44 +714,49 @@ CONFIG_UNIX98_PTYS=y | |||
| 680 | # CONFIG_CAN4LINUX is not set | 714 | # CONFIG_CAN4LINUX is not set |
| 681 | # CONFIG_IPMI_HANDLER is not set | 715 | # CONFIG_IPMI_HANDLER is not set |
| 682 | # CONFIG_HW_RANDOM is not set | 716 | # CONFIG_HW_RANDOM is not set |
| 683 | # CONFIG_GEN_RTC is not set | ||
| 684 | # CONFIG_R3964 is not set | 717 | # CONFIG_R3964 is not set |
| 685 | # CONFIG_RAW_DRIVER is not set | 718 | # CONFIG_RAW_DRIVER is not set |
| 686 | # CONFIG_TCG_TPM is not set | 719 | # CONFIG_TCG_TPM is not set |
| 687 | CONFIG_I2C=y | 720 | CONFIG_I2C=y |
| 688 | CONFIG_I2C_BOARDINFO=y | 721 | CONFIG_I2C_BOARDINFO=y |
| 689 | CONFIG_I2C_CHARDEV=m | 722 | CONFIG_I2C_CHARDEV=m |
| 723 | CONFIG_I2C_HELPER_AUTO=y | ||
| 690 | 724 | ||
| 691 | # | 725 | # |
| 692 | # I2C Algorithms | 726 | # I2C Hardware Bus support |
| 693 | # | 727 | # |
| 694 | # CONFIG_I2C_ALGOBIT is not set | ||
| 695 | # CONFIG_I2C_ALGOPCF is not set | ||
| 696 | # CONFIG_I2C_ALGOPCA is not set | ||
| 697 | 728 | ||
| 698 | # | 729 | # |
| 699 | # I2C Hardware Bus support | 730 | # I2C system bus drivers (mostly embedded / system-on-chip) |
| 700 | # | 731 | # |
| 701 | CONFIG_I2C_BLACKFIN_TWI=m | 732 | CONFIG_I2C_BLACKFIN_TWI=m |
| 702 | CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100 | 733 | CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100 |
| 703 | # CONFIG_I2C_GPIO is not set | 734 | # CONFIG_I2C_GPIO is not set |
| 704 | # CONFIG_I2C_OCORES is not set | 735 | # CONFIG_I2C_OCORES is not set |
| 705 | # CONFIG_I2C_PARPORT_LIGHT is not set | ||
| 706 | # CONFIG_I2C_SIMTEC is not set | 736 | # CONFIG_I2C_SIMTEC is not set |
| 737 | |||
| 738 | # | ||
| 739 | # External I2C/SMBus adapter drivers | ||
| 740 | # | ||
| 741 | # CONFIG_I2C_PARPORT_LIGHT is not set | ||
| 707 | # CONFIG_I2C_TAOS_EVM is not set | 742 | # CONFIG_I2C_TAOS_EVM is not set |
| 708 | # CONFIG_I2C_STUB is not set | ||
| 709 | # CONFIG_I2C_TINY_USB is not set | 743 | # CONFIG_I2C_TINY_USB is not set |
| 710 | 744 | ||
| 711 | # | 745 | # |
| 746 | # Other I2C/SMBus bus drivers | ||
| 747 | # | ||
| 748 | # CONFIG_I2C_PCA_PLATFORM is not set | ||
| 749 | # CONFIG_I2C_STUB is not set | ||
| 750 | |||
| 751 | # | ||
| 712 | # Miscellaneous I2C Chip support | 752 | # Miscellaneous I2C Chip support |
| 713 | # | 753 | # |
| 714 | # CONFIG_SENSORS_DS1337 is not set | ||
| 715 | # CONFIG_SENSORS_DS1374 is not set | ||
| 716 | # CONFIG_DS1682 is not set | 754 | # CONFIG_DS1682 is not set |
| 755 | # CONFIG_AT24 is not set | ||
| 717 | # CONFIG_SENSORS_AD5252 is not set | 756 | # CONFIG_SENSORS_AD5252 is not set |
| 718 | # CONFIG_EEPROM_LEGACY is not set | 757 | # CONFIG_SENSORS_EEPROM is not set |
| 719 | # CONFIG_SENSORS_PCF8574 is not set | 758 | # CONFIG_SENSORS_PCF8574 is not set |
| 720 | # CONFIG_SENSORS_PCF8575 is not set | 759 | # CONFIG_PCF8575 is not set |
| 721 | # CONFIG_SENSORS_PCA9539 is not set | 760 | # CONFIG_SENSORS_PCA9539 is not set |
| 722 | # CONFIG_SENSORS_PCF8591 is not set | 761 | # CONFIG_SENSORS_PCF8591 is not set |
| 723 | # CONFIG_SENSORS_MAX6875 is not set | 762 | # CONFIG_SENSORS_MAX6875 is not set |
| @@ -726,37 +765,41 @@ CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100 | |||
| 726 | # CONFIG_I2C_DEBUG_ALGO is not set | 765 | # CONFIG_I2C_DEBUG_ALGO is not set |
| 727 | # CONFIG_I2C_DEBUG_BUS is not set | 766 | # CONFIG_I2C_DEBUG_BUS is not set |
| 728 | # CONFIG_I2C_DEBUG_CHIP is not set | 767 | # CONFIG_I2C_DEBUG_CHIP is not set |
| 729 | |||
| 730 | # | ||
| 731 | # SPI support | ||
| 732 | # | ||
| 733 | CONFIG_SPI=y | 768 | CONFIG_SPI=y |
| 769 | # CONFIG_SPI_DEBUG is not set | ||
| 734 | CONFIG_SPI_MASTER=y | 770 | CONFIG_SPI_MASTER=y |
| 735 | 771 | ||
| 736 | # | 772 | # |
| 737 | # SPI Master Controller Drivers | 773 | # SPI Master Controller Drivers |
| 738 | # | 774 | # |
| 739 | CONFIG_SPI_BFIN=y | 775 | CONFIG_SPI_BFIN=y |
| 776 | # CONFIG_SPI_BFIN_LOCK is not set | ||
| 740 | # CONFIG_SPI_BITBANG is not set | 777 | # CONFIG_SPI_BITBANG is not set |
| 741 | 778 | ||
| 742 | # | 779 | # |
| 743 | # SPI Protocol Masters | 780 | # SPI Protocol Masters |
| 744 | # | 781 | # |
| 745 | # CONFIG_EEPROM_AT25 is not set | 782 | # CONFIG_SPI_AT25 is not set |
| 746 | # CONFIG_SPI_SPIDEV is not set | 783 | # CONFIG_SPI_SPIDEV is not set |
| 747 | # CONFIG_SPI_TLE62X0 is not set | 784 | # CONFIG_SPI_TLE62X0 is not set |
| 785 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y | ||
| 786 | # CONFIG_GPIOLIB is not set | ||
| 748 | # CONFIG_W1 is not set | 787 | # CONFIG_W1 is not set |
| 749 | # CONFIG_POWER_SUPPLY is not set | 788 | # CONFIG_POWER_SUPPLY is not set |
| 750 | CONFIG_HWMON=y | 789 | CONFIG_HWMON=y |
| 751 | # CONFIG_HWMON_VID is not set | 790 | # CONFIG_HWMON_VID is not set |
| 791 | # CONFIG_SENSORS_AD7414 is not set | ||
| 752 | # CONFIG_SENSORS_AD7418 is not set | 792 | # CONFIG_SENSORS_AD7418 is not set |
| 793 | # CONFIG_SENSORS_ADCXX is not set | ||
| 753 | # CONFIG_SENSORS_ADM1021 is not set | 794 | # CONFIG_SENSORS_ADM1021 is not set |
| 754 | # CONFIG_SENSORS_ADM1025 is not set | 795 | # CONFIG_SENSORS_ADM1025 is not set |
| 755 | # CONFIG_SENSORS_ADM1026 is not set | 796 | # CONFIG_SENSORS_ADM1026 is not set |
| 756 | # CONFIG_SENSORS_ADM1029 is not set | 797 | # CONFIG_SENSORS_ADM1029 is not set |
| 757 | # CONFIG_SENSORS_ADM1031 is not set | 798 | # CONFIG_SENSORS_ADM1031 is not set |
| 758 | # CONFIG_SENSORS_ADM9240 is not set | 799 | # CONFIG_SENSORS_ADM9240 is not set |
| 800 | # CONFIG_SENSORS_ADT7462 is not set | ||
| 759 | # CONFIG_SENSORS_ADT7470 is not set | 801 | # CONFIG_SENSORS_ADT7470 is not set |
| 802 | # CONFIG_SENSORS_ADT7473 is not set | ||
| 760 | # CONFIG_SENSORS_ATXP1 is not set | 803 | # CONFIG_SENSORS_ATXP1 is not set |
| 761 | # CONFIG_SENSORS_DS1621 is not set | 804 | # CONFIG_SENSORS_DS1621 is not set |
| 762 | # CONFIG_SENSORS_F71805F is not set | 805 | # CONFIG_SENSORS_F71805F is not set |
| @@ -777,6 +820,7 @@ CONFIG_HWMON=y | |||
| 777 | # CONFIG_SENSORS_LM90 is not set | 820 | # CONFIG_SENSORS_LM90 is not set |
| 778 | # CONFIG_SENSORS_LM92 is not set | 821 | # CONFIG_SENSORS_LM92 is not set |
| 779 | # CONFIG_SENSORS_LM93 is not set | 822 | # CONFIG_SENSORS_LM93 is not set |
| 823 | # CONFIG_SENSORS_MAX1111 is not set | ||
| 780 | # CONFIG_SENSORS_MAX1619 is not set | 824 | # CONFIG_SENSORS_MAX1619 is not set |
| 781 | # CONFIG_SENSORS_MAX6650 is not set | 825 | # CONFIG_SENSORS_MAX6650 is not set |
| 782 | # CONFIG_SENSORS_PC87360 is not set | 826 | # CONFIG_SENSORS_PC87360 is not set |
| @@ -785,6 +829,7 @@ CONFIG_HWMON=y | |||
| 785 | # CONFIG_SENSORS_SMSC47M1 is not set | 829 | # CONFIG_SENSORS_SMSC47M1 is not set |
| 786 | # CONFIG_SENSORS_SMSC47M192 is not set | 830 | # CONFIG_SENSORS_SMSC47M192 is not set |
| 787 | # CONFIG_SENSORS_SMSC47B397 is not set | 831 | # CONFIG_SENSORS_SMSC47B397 is not set |
| 832 | # CONFIG_SENSORS_ADS7828 is not set | ||
| 788 | # CONFIG_SENSORS_THMC50 is not set | 833 | # CONFIG_SENSORS_THMC50 is not set |
| 789 | # CONFIG_SENSORS_VT1211 is not set | 834 | # CONFIG_SENSORS_VT1211 is not set |
| 790 | # CONFIG_SENSORS_W83781D is not set | 835 | # CONFIG_SENSORS_W83781D is not set |
| @@ -792,9 +837,12 @@ CONFIG_HWMON=y | |||
| 792 | # CONFIG_SENSORS_W83792D is not set | 837 | # CONFIG_SENSORS_W83792D is not set |
| 793 | # CONFIG_SENSORS_W83793 is not set | 838 | # CONFIG_SENSORS_W83793 is not set |
| 794 | # CONFIG_SENSORS_W83L785TS is not set | 839 | # CONFIG_SENSORS_W83L785TS is not set |
| 840 | # CONFIG_SENSORS_W83L786NG is not set | ||
| 795 | # CONFIG_SENSORS_W83627HF is not set | 841 | # CONFIG_SENSORS_W83627HF is not set |
| 796 | # CONFIG_SENSORS_W83627EHF is not set | 842 | # CONFIG_SENSORS_W83627EHF is not set |
| 797 | # CONFIG_HWMON_DEBUG_CHIP is not set | 843 | # CONFIG_HWMON_DEBUG_CHIP is not set |
| 844 | # CONFIG_THERMAL is not set | ||
| 845 | # CONFIG_THERMAL_HWMON is not set | ||
| 798 | CONFIG_WATCHDOG=y | 846 | CONFIG_WATCHDOG=y |
| 799 | # CONFIG_WATCHDOG_NOWAYOUT is not set | 847 | # CONFIG_WATCHDOG_NOWAYOUT is not set |
| 800 | 848 | ||
| @@ -810,21 +858,31 @@ CONFIG_BFIN_WDT=y | |||
| 810 | # CONFIG_USBPCWATCHDOG is not set | 858 | # CONFIG_USBPCWATCHDOG is not set |
| 811 | 859 | ||
| 812 | # | 860 | # |
| 813 | # Sonics Silicon Backplane | ||
| 814 | # | ||
| 815 | CONFIG_SSB_POSSIBLE=y | ||
| 816 | # CONFIG_SSB is not set | ||
| 817 | |||
| 818 | # | ||
| 819 | # Multifunction device drivers | 861 | # Multifunction device drivers |
| 820 | # | 862 | # |
| 863 | # CONFIG_MFD_CORE is not set | ||
| 821 | # CONFIG_MFD_SM501 is not set | 864 | # CONFIG_MFD_SM501 is not set |
| 865 | # CONFIG_HTC_PASIC3 is not set | ||
| 866 | # CONFIG_MFD_TMIO is not set | ||
| 867 | # CONFIG_PMIC_DA903X is not set | ||
| 868 | # CONFIG_MFD_WM8400 is not set | ||
| 869 | # CONFIG_MFD_WM8350_I2C is not set | ||
| 870 | # CONFIG_REGULATOR is not set | ||
| 822 | 871 | ||
| 823 | # | 872 | # |
| 824 | # Multimedia devices | 873 | # Multimedia devices |
| 825 | # | 874 | # |
| 875 | |||
| 876 | # | ||
| 877 | # Multimedia core support | ||
| 878 | # | ||
| 826 | # CONFIG_VIDEO_DEV is not set | 879 | # CONFIG_VIDEO_DEV is not set |
| 827 | # CONFIG_DVB_CORE is not set | 880 | # CONFIG_DVB_CORE is not set |
| 881 | # CONFIG_VIDEO_MEDIA is not set | ||
| 882 | |||
| 883 | # | ||
| 884 | # Multimedia drivers | ||
| 885 | # | ||
| 828 | # CONFIG_DAB is not set | 886 | # CONFIG_DAB is not set |
| 829 | 887 | ||
| 830 | # | 888 | # |
| @@ -839,10 +897,6 @@ CONFIG_SSB_POSSIBLE=y | |||
| 839 | # Display device support | 897 | # Display device support |
| 840 | # | 898 | # |
| 841 | # CONFIG_DISPLAY_SUPPORT is not set | 899 | # CONFIG_DISPLAY_SUPPORT is not set |
| 842 | |||
| 843 | # | ||
| 844 | # Sound | ||
| 845 | # | ||
| 846 | # CONFIG_SOUND is not set | 900 | # CONFIG_SOUND is not set |
| 847 | CONFIG_USB_SUPPORT=y | 901 | CONFIG_USB_SUPPORT=y |
| 848 | CONFIG_USB_ARCH_HAS_HCD=y | 902 | CONFIG_USB_ARCH_HAS_HCD=y |
| @@ -850,6 +904,7 @@ CONFIG_USB_ARCH_HAS_HCD=y | |||
| 850 | # CONFIG_USB_ARCH_HAS_EHCI is not set | 904 | # CONFIG_USB_ARCH_HAS_EHCI is not set |
| 851 | CONFIG_USB=y | 905 | CONFIG_USB=y |
| 852 | # CONFIG_USB_DEBUG is not set | 906 | # CONFIG_USB_DEBUG is not set |
| 907 | # CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set | ||
| 853 | 908 | ||
| 854 | # | 909 | # |
| 855 | # Miscellaneous USB options | 910 | # Miscellaneous USB options |
| @@ -860,40 +915,48 @@ CONFIG_USB_DEVICE_CLASS=y | |||
| 860 | # CONFIG_USB_OTG is not set | 915 | # CONFIG_USB_OTG is not set |
| 861 | # CONFIG_USB_OTG_WHITELIST is not set | 916 | # CONFIG_USB_OTG_WHITELIST is not set |
| 862 | CONFIG_USB_OTG_BLACKLIST_HUB=y | 917 | CONFIG_USB_OTG_BLACKLIST_HUB=y |
| 918 | CONFIG_USB_MON=y | ||
| 919 | # CONFIG_USB_WUSB is not set | ||
| 920 | # CONFIG_USB_WUSB_CBAF is not set | ||
| 863 | 921 | ||
| 864 | # | 922 | # |
| 865 | # USB Host Controller Drivers | 923 | # USB Host Controller Drivers |
| 866 | # | 924 | # |
| 925 | # CONFIG_USB_C67X00_HCD is not set | ||
| 867 | # CONFIG_USB_ISP116X_HCD is not set | 926 | # CONFIG_USB_ISP116X_HCD is not set |
| 868 | # CONFIG_USB_ISP1362_HCD is not set | ||
| 869 | # CONFIG_USB_ISP1760_HCD is not set | 927 | # CONFIG_USB_ISP1760_HCD is not set |
| 928 | # CONFIG_USB_ISP1362_HCD is not set | ||
| 870 | # CONFIG_USB_SL811_HCD is not set | 929 | # CONFIG_USB_SL811_HCD is not set |
| 871 | # CONFIG_USB_R8A66597_HCD is not set | 930 | # CONFIG_USB_R8A66597_HCD is not set |
| 931 | # CONFIG_USB_HWA_HCD is not set | ||
| 872 | CONFIG_USB_MUSB_HDRC=y | 932 | CONFIG_USB_MUSB_HDRC=y |
| 873 | CONFIG_USB_MUSB_SOC=y | 933 | CONFIG_USB_MUSB_SOC=y |
| 874 | 934 | ||
| 875 | # | 935 | # |
| 876 | # Blackfin high speed USB support | 936 | # Blackfin high speed USB Support |
| 877 | # | 937 | # |
| 878 | CONFIG_USB_MUSB_HOST=y | 938 | CONFIG_USB_MUSB_HOST=y |
| 879 | # CONFIG_USB_MUSB_PERIPHERAL is not set | 939 | # CONFIG_USB_MUSB_PERIPHERAL is not set |
| 880 | # CONFIG_USB_MUSB_OTG is not set | 940 | # CONFIG_USB_MUSB_OTG is not set |
| 881 | CONFIG_USB_MUSB_HDRC_HCD=y | 941 | CONFIG_USB_MUSB_HDRC_HCD=y |
| 882 | CONFIG_MUSB_PIO_ONLY=y | 942 | CONFIG_MUSB_PIO_ONLY=y |
| 883 | CONFIG_USB_MUSB_LOGLEVEL=0 | 943 | CONFIG_MUSB_DMA_POLL=y |
| 944 | # CONFIG_USB_MUSB_DEBUG is not set | ||
| 884 | 945 | ||
| 885 | # | 946 | # |
| 886 | # USB Device Class drivers | 947 | # USB Device Class drivers |
| 887 | # | 948 | # |
| 888 | # CONFIG_USB_ACM is not set | 949 | # CONFIG_USB_ACM is not set |
| 889 | # CONFIG_USB_PRINTER is not set | 950 | # CONFIG_USB_PRINTER is not set |
| 951 | # CONFIG_USB_WDM is not set | ||
| 952 | # CONFIG_USB_TMC is not set | ||
| 890 | 953 | ||
| 891 | # | 954 | # |
| 892 | # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' | 955 | # NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed; |
| 893 | # | 956 | # |
| 894 | 957 | ||
| 895 | # | 958 | # |
| 896 | # may also be needed; see USB_STORAGE Help for more information | 959 | # see USB_STORAGE Help for more information |
| 897 | # | 960 | # |
| 898 | # CONFIG_USB_LIBUSUAL is not set | 961 | # CONFIG_USB_LIBUSUAL is not set |
| 899 | 962 | ||
| @@ -901,15 +964,10 @@ CONFIG_USB_MUSB_LOGLEVEL=0 | |||
| 901 | # USB Imaging devices | 964 | # USB Imaging devices |
| 902 | # | 965 | # |
| 903 | # CONFIG_USB_MDC800 is not set | 966 | # CONFIG_USB_MDC800 is not set |
| 904 | CONFIG_USB_MON=y | ||
| 905 | 967 | ||
| 906 | # | 968 | # |
| 907 | # USB port drivers | 969 | # USB port drivers |
| 908 | # | 970 | # |
| 909 | |||
| 910 | # | ||
| 911 | # USB Serial Converter support | ||
| 912 | # | ||
| 913 | # CONFIG_USB_SERIAL is not set | 971 | # CONFIG_USB_SERIAL is not set |
| 914 | 972 | ||
| 915 | # | 973 | # |
| @@ -918,7 +976,7 @@ CONFIG_USB_MON=y | |||
| 918 | # CONFIG_USB_EMI62 is not set | 976 | # CONFIG_USB_EMI62 is not set |
| 919 | # CONFIG_USB_EMI26 is not set | 977 | # CONFIG_USB_EMI26 is not set |
| 920 | # CONFIG_USB_ADUTUX is not set | 978 | # CONFIG_USB_ADUTUX is not set |
| 921 | # CONFIG_USB_AUERSWALD is not set | 979 | # CONFIG_USB_SEVSEG is not set |
| 922 | # CONFIG_USB_RIO500 is not set | 980 | # CONFIG_USB_RIO500 is not set |
| 923 | # CONFIG_USB_LEGOTOWER is not set | 981 | # CONFIG_USB_LEGOTOWER is not set |
| 924 | # CONFIG_USB_LCD is not set | 982 | # CONFIG_USB_LCD is not set |
| @@ -934,17 +992,13 @@ CONFIG_USB_MON=y | |||
| 934 | # CONFIG_USB_LD is not set | 992 | # CONFIG_USB_LD is not set |
| 935 | # CONFIG_USB_TRANCEVIBRATOR is not set | 993 | # CONFIG_USB_TRANCEVIBRATOR is not set |
| 936 | # CONFIG_USB_IOWARRIOR is not set | 994 | # CONFIG_USB_IOWARRIOR is not set |
| 937 | 995 | # CONFIG_USB_ISIGHTFW is not set | |
| 938 | # | 996 | # CONFIG_USB_VST is not set |
| 939 | # USB DSL modem support | ||
| 940 | # | ||
| 941 | |||
| 942 | # | ||
| 943 | # USB Gadget Support | ||
| 944 | # | ||
| 945 | # CONFIG_USB_GADGET is not set | 997 | # CONFIG_USB_GADGET is not set |
| 946 | # CONFIG_MMC is not set | 998 | # CONFIG_MMC is not set |
| 999 | # CONFIG_MEMSTICK is not set | ||
| 947 | # CONFIG_NEW_LEDS is not set | 1000 | # CONFIG_NEW_LEDS is not set |
| 1001 | # CONFIG_ACCESSIBILITY is not set | ||
| 948 | CONFIG_RTC_LIB=y | 1002 | CONFIG_RTC_LIB=y |
| 949 | CONFIG_RTC_CLASS=y | 1003 | CONFIG_RTC_CLASS=y |
| 950 | CONFIG_RTC_HCTOSYS=y | 1004 | CONFIG_RTC_HCTOSYS=y |
| @@ -973,51 +1027,59 @@ CONFIG_RTC_INTF_DEV=y | |||
| 973 | # CONFIG_RTC_DRV_PCF8563 is not set | 1027 | # CONFIG_RTC_DRV_PCF8563 is not set |
| 974 | # CONFIG_RTC_DRV_PCF8583 is not set | 1028 | # CONFIG_RTC_DRV_PCF8583 is not set |
| 975 | # CONFIG_RTC_DRV_M41T80 is not set | 1029 | # CONFIG_RTC_DRV_M41T80 is not set |
| 1030 | # CONFIG_RTC_DRV_S35390A is not set | ||
| 1031 | # CONFIG_RTC_DRV_FM3130 is not set | ||
| 1032 | # CONFIG_RTC_DRV_RX8581 is not set | ||
| 976 | 1033 | ||
| 977 | # | 1034 | # |
| 978 | # SPI RTC drivers | 1035 | # SPI RTC drivers |
| 979 | # | 1036 | # |
| 980 | # CONFIG_RTC_DRV_RS5C348 is not set | 1037 | # CONFIG_RTC_DRV_M41T94 is not set |
| 1038 | # CONFIG_RTC_DRV_DS1305 is not set | ||
| 1039 | # CONFIG_RTC_DRV_DS1390 is not set | ||
| 981 | # CONFIG_RTC_DRV_MAX6902 is not set | 1040 | # CONFIG_RTC_DRV_MAX6902 is not set |
| 1041 | # CONFIG_RTC_DRV_R9701 is not set | ||
| 1042 | # CONFIG_RTC_DRV_RS5C348 is not set | ||
| 1043 | # CONFIG_RTC_DRV_DS3234 is not set | ||
| 982 | 1044 | ||
| 983 | # | 1045 | # |
| 984 | # Platform RTC drivers | 1046 | # Platform RTC drivers |
| 985 | # | 1047 | # |
| 1048 | # CONFIG_RTC_DRV_DS1286 is not set | ||
| 1049 | # CONFIG_RTC_DRV_DS1511 is not set | ||
| 986 | # CONFIG_RTC_DRV_DS1553 is not set | 1050 | # CONFIG_RTC_DRV_DS1553 is not set |
| 987 | # CONFIG_RTC_DRV_STK17TA8 is not set | ||
| 988 | # CONFIG_RTC_DRV_DS1742 is not set | 1051 | # CONFIG_RTC_DRV_DS1742 is not set |
| 1052 | # CONFIG_RTC_DRV_STK17TA8 is not set | ||
| 989 | # CONFIG_RTC_DRV_M48T86 is not set | 1053 | # CONFIG_RTC_DRV_M48T86 is not set |
| 1054 | # CONFIG_RTC_DRV_M48T35 is not set | ||
| 990 | # CONFIG_RTC_DRV_M48T59 is not set | 1055 | # CONFIG_RTC_DRV_M48T59 is not set |
| 1056 | # CONFIG_RTC_DRV_BQ4802 is not set | ||
| 991 | # CONFIG_RTC_DRV_V3020 is not set | 1057 | # CONFIG_RTC_DRV_V3020 is not set |
| 992 | 1058 | ||
| 993 | # | 1059 | # |
| 994 | # on-CPU RTC drivers | 1060 | # on-CPU RTC drivers |
| 995 | # | 1061 | # |
| 996 | CONFIG_RTC_DRV_BFIN=y | 1062 | CONFIG_RTC_DRV_BFIN=y |
| 997 | 1063 | # CONFIG_DMADEVICES is not set | |
| 998 | # | ||
| 999 | # Userspace I/O | ||
| 1000 | # | ||
| 1001 | # CONFIG_UIO is not set | 1064 | # CONFIG_UIO is not set |
| 1065 | # CONFIG_STAGING is not set | ||
| 1002 | 1066 | ||
| 1003 | # | 1067 | # |
| 1004 | # File systems | 1068 | # File systems |
| 1005 | # | 1069 | # |
| 1006 | # CONFIG_EXT2_FS is not set | 1070 | # CONFIG_EXT2_FS is not set |
| 1007 | # CONFIG_EXT3_FS is not set | 1071 | # CONFIG_EXT3_FS is not set |
| 1008 | # CONFIG_EXT4DEV_FS is not set | 1072 | # CONFIG_EXT4_FS is not set |
| 1009 | # CONFIG_REISERFS_FS is not set | 1073 | # CONFIG_REISERFS_FS is not set |
| 1010 | # CONFIG_JFS_FS is not set | 1074 | # CONFIG_JFS_FS is not set |
| 1011 | # CONFIG_FS_POSIX_ACL is not set | 1075 | # CONFIG_FS_POSIX_ACL is not set |
| 1076 | CONFIG_FILE_LOCKING=y | ||
| 1012 | # CONFIG_XFS_FS is not set | 1077 | # CONFIG_XFS_FS is not set |
| 1013 | # CONFIG_GFS2_FS is not set | ||
| 1014 | # CONFIG_OCFS2_FS is not set | 1078 | # CONFIG_OCFS2_FS is not set |
| 1015 | # CONFIG_MINIX_FS is not set | 1079 | # CONFIG_DNOTIFY is not set |
| 1016 | # CONFIG_ROMFS_FS is not set | ||
| 1017 | CONFIG_INOTIFY=y | 1080 | CONFIG_INOTIFY=y |
| 1018 | CONFIG_INOTIFY_USER=y | 1081 | CONFIG_INOTIFY_USER=y |
| 1019 | # CONFIG_QUOTA is not set | 1082 | # CONFIG_QUOTA is not set |
| 1020 | # CONFIG_DNOTIFY is not set | ||
| 1021 | # CONFIG_AUTOFS_FS is not set | 1083 | # CONFIG_AUTOFS_FS is not set |
| 1022 | # CONFIG_AUTOFS4_FS is not set | 1084 | # CONFIG_AUTOFS4_FS is not set |
| 1023 | # CONFIG_FUSE_FS is not set | 1085 | # CONFIG_FUSE_FS is not set |
| @@ -1059,8 +1121,11 @@ CONFIG_SYSFS=y | |||
| 1059 | # CONFIG_JFFS2_FS is not set | 1121 | # CONFIG_JFFS2_FS is not set |
| 1060 | # CONFIG_CRAMFS is not set | 1122 | # CONFIG_CRAMFS is not set |
| 1061 | # CONFIG_VXFS_FS is not set | 1123 | # CONFIG_VXFS_FS is not set |
| 1124 | # CONFIG_MINIX_FS is not set | ||
| 1125 | # CONFIG_OMFS_FS is not set | ||
| 1062 | # CONFIG_HPFS_FS is not set | 1126 | # CONFIG_HPFS_FS is not set |
| 1063 | # CONFIG_QNX4FS_FS is not set | 1127 | # CONFIG_QNX4FS_FS is not set |
| 1128 | # CONFIG_ROMFS_FS is not set | ||
| 1064 | # CONFIG_SYSV_FS is not set | 1129 | # CONFIG_SYSV_FS is not set |
| 1065 | # CONFIG_UFS_FS is not set | 1130 | # CONFIG_UFS_FS is not set |
| 1066 | CONFIG_NETWORK_FILESYSTEMS=y | 1131 | CONFIG_NETWORK_FILESYSTEMS=y |
| @@ -1068,13 +1133,12 @@ CONFIG_NFS_FS=m | |||
| 1068 | CONFIG_NFS_V3=y | 1133 | CONFIG_NFS_V3=y |
| 1069 | # CONFIG_NFS_V3_ACL is not set | 1134 | # CONFIG_NFS_V3_ACL is not set |
| 1070 | # CONFIG_NFS_V4 is not set | 1135 | # CONFIG_NFS_V4 is not set |
| 1071 | # CONFIG_NFS_DIRECTIO is not set | ||
| 1072 | # CONFIG_NFSD is not set | 1136 | # CONFIG_NFSD is not set |
| 1073 | CONFIG_LOCKD=m | 1137 | CONFIG_LOCKD=m |
| 1074 | CONFIG_LOCKD_V4=y | 1138 | CONFIG_LOCKD_V4=y |
| 1075 | CONFIG_NFS_COMMON=y | 1139 | CONFIG_NFS_COMMON=y |
| 1076 | CONFIG_SUNRPC=m | 1140 | CONFIG_SUNRPC=m |
| 1077 | # CONFIG_SUNRPC_BIND34 is not set | 1141 | # CONFIG_SUNRPC_REGISTER_V4 is not set |
| 1078 | # CONFIG_RPCSEC_GSS_KRB5 is not set | 1142 | # CONFIG_RPCSEC_GSS_KRB5 is not set |
| 1079 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | 1143 | # CONFIG_RPCSEC_GSS_SPKM3 is not set |
| 1080 | CONFIG_SMB_FS=m | 1144 | CONFIG_SMB_FS=m |
| @@ -1130,7 +1194,6 @@ CONFIG_NLS_DEFAULT="iso8859-1" | |||
| 1130 | # CONFIG_NLS_KOI8_U is not set | 1194 | # CONFIG_NLS_KOI8_U is not set |
| 1131 | # CONFIG_NLS_UTF8 is not set | 1195 | # CONFIG_NLS_UTF8 is not set |
| 1132 | # CONFIG_DLM is not set | 1196 | # CONFIG_DLM is not set |
| 1133 | # CONFIG_INSTRUMENTATION is not set | ||
| 1134 | 1197 | ||
| 1135 | # | 1198 | # |
| 1136 | # Kernel hacking | 1199 | # Kernel hacking |
| @@ -1138,14 +1201,61 @@ CONFIG_NLS_DEFAULT="iso8859-1" | |||
| 1138 | # CONFIG_PRINTK_TIME is not set | 1201 | # CONFIG_PRINTK_TIME is not set |
| 1139 | CONFIG_ENABLE_WARN_DEPRECATED=y | 1202 | CONFIG_ENABLE_WARN_DEPRECATED=y |
| 1140 | CONFIG_ENABLE_MUST_CHECK=y | 1203 | CONFIG_ENABLE_MUST_CHECK=y |
| 1204 | CONFIG_FRAME_WARN=1024 | ||
| 1141 | # CONFIG_MAGIC_SYSRQ is not set | 1205 | # CONFIG_MAGIC_SYSRQ is not set |
| 1142 | # CONFIG_UNUSED_SYMBOLS is not set | 1206 | # CONFIG_UNUSED_SYMBOLS is not set |
| 1143 | CONFIG_DEBUG_FS=y | 1207 | CONFIG_DEBUG_FS=y |
| 1144 | # CONFIG_HEADERS_CHECK is not set | 1208 | # CONFIG_HEADERS_CHECK is not set |
| 1145 | # CONFIG_DEBUG_KERNEL is not set | 1209 | CONFIG_DEBUG_KERNEL=y |
| 1210 | # CONFIG_DEBUG_SHIRQ is not set | ||
| 1211 | CONFIG_DETECT_SOFTLOCKUP=y | ||
| 1212 | # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set | ||
| 1213 | CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 | ||
| 1214 | # CONFIG_SCHED_DEBUG is not set | ||
| 1215 | # CONFIG_SCHEDSTATS is not set | ||
| 1216 | # CONFIG_TIMER_STATS is not set | ||
| 1217 | # CONFIG_DEBUG_OBJECTS is not set | ||
| 1218 | # CONFIG_DEBUG_SLAB is not set | ||
| 1219 | # CONFIG_DEBUG_RT_MUTEXES is not set | ||
| 1220 | # CONFIG_RT_MUTEX_TESTER is not set | ||
| 1221 | # CONFIG_DEBUG_SPINLOCK is not set | ||
| 1222 | # CONFIG_DEBUG_MUTEXES is not set | ||
| 1223 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | ||
| 1224 | # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set | ||
| 1225 | # CONFIG_DEBUG_KOBJECT is not set | ||
| 1146 | # CONFIG_DEBUG_BUGVERBOSE is not set | 1226 | # CONFIG_DEBUG_BUGVERBOSE is not set |
| 1227 | # CONFIG_DEBUG_INFO is not set | ||
| 1228 | # CONFIG_DEBUG_VM is not set | ||
| 1229 | # CONFIG_DEBUG_WRITECOUNT is not set | ||
| 1230 | # CONFIG_DEBUG_MEMORY_INIT is not set | ||
| 1231 | # CONFIG_DEBUG_LIST is not set | ||
| 1232 | # CONFIG_DEBUG_SG is not set | ||
| 1233 | # CONFIG_FRAME_POINTER is not set | ||
| 1234 | # CONFIG_BOOT_PRINTK_DELAY is not set | ||
| 1235 | # CONFIG_RCU_TORTURE_TEST is not set | ||
| 1236 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
| 1237 | # CONFIG_BACKTRACE_SELF_TEST is not set | ||
| 1238 | # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set | ||
| 1239 | # CONFIG_FAULT_INJECTION is not set | ||
| 1240 | # CONFIG_SYSCTL_SYSCALL_CHECK is not set | ||
| 1241 | |||
| 1242 | # | ||
| 1243 | # Tracers | ||
| 1244 | # | ||
| 1245 | # CONFIG_SCHED_TRACER is not set | ||
| 1246 | # CONFIG_CONTEXT_SWITCH_TRACER is not set | ||
| 1247 | # CONFIG_BOOT_TRACER is not set | ||
| 1248 | # CONFIG_DYNAMIC_PRINTK_DEBUG is not set | ||
| 1147 | # CONFIG_SAMPLES is not set | 1249 | # CONFIG_SAMPLES is not set |
| 1250 | CONFIG_HAVE_ARCH_KGDB=y | ||
| 1251 | # CONFIG_KGDB is not set | ||
| 1252 | # CONFIG_DEBUG_STACKOVERFLOW is not set | ||
| 1253 | # CONFIG_DEBUG_STACK_USAGE is not set | ||
| 1254 | # CONFIG_KGDB_TESTCASE is not set | ||
| 1255 | CONFIG_DEBUG_VERBOSE=y | ||
| 1148 | CONFIG_DEBUG_MMRS=y | 1256 | CONFIG_DEBUG_MMRS=y |
| 1257 | # CONFIG_DEBUG_HWERR is not set | ||
| 1258 | # CONFIG_DEBUG_DOUBLEFAULT is not set | ||
| 1149 | CONFIG_DEBUG_HUNT_FOR_ZERO=y | 1259 | CONFIG_DEBUG_HUNT_FOR_ZERO=y |
| 1150 | CONFIG_DEBUG_BFIN_HWTRACE_ON=y | 1260 | CONFIG_DEBUG_BFIN_HWTRACE_ON=y |
| 1151 | CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y | 1261 | CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y |
| @@ -1154,7 +1264,7 @@ CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y | |||
| 1154 | CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION=0 | 1264 | CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION=0 |
| 1155 | # CONFIG_DEBUG_BFIN_HWTRACE_EXPAND is not set | 1265 | # CONFIG_DEBUG_BFIN_HWTRACE_EXPAND is not set |
| 1156 | # CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set | 1266 | # CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set |
| 1157 | CONFIG_EARLY_PRINTK=y | 1267 | # CONFIG_EARLY_PRINTK is not set |
| 1158 | # CONFIG_CPLB_INFO is not set | 1268 | # CONFIG_CPLB_INFO is not set |
| 1159 | CONFIG_ACCESS_CHECK=y | 1269 | CONFIG_ACCESS_CHECK=y |
| 1160 | 1270 | ||
| @@ -1163,10 +1273,96 @@ CONFIG_ACCESS_CHECK=y | |||
| 1163 | # | 1273 | # |
| 1164 | # CONFIG_KEYS is not set | 1274 | # CONFIG_KEYS is not set |
| 1165 | CONFIG_SECURITY=y | 1275 | CONFIG_SECURITY=y |
| 1276 | # CONFIG_SECURITYFS is not set | ||
| 1166 | # CONFIG_SECURITY_NETWORK is not set | 1277 | # CONFIG_SECURITY_NETWORK is not set |
| 1167 | # CONFIG_SECURITY_CAPABILITIES is not set | 1278 | # CONFIG_SECURITY_FILE_CAPABILITIES is not set |
| 1168 | # CONFIG_SECURITY_ROOTPLUG is not set | 1279 | # CONFIG_SECURITY_ROOTPLUG is not set |
| 1169 | # CONFIG_CRYPTO is not set | 1280 | CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0 |
| 1281 | CONFIG_CRYPTO=y | ||
| 1282 | |||
| 1283 | # | ||
| 1284 | # Crypto core or helper | ||
| 1285 | # | ||
| 1286 | # CONFIG_CRYPTO_FIPS is not set | ||
| 1287 | # CONFIG_CRYPTO_MANAGER is not set | ||
| 1288 | # CONFIG_CRYPTO_MANAGER2 is not set | ||
| 1289 | # CONFIG_CRYPTO_GF128MUL is not set | ||
| 1290 | # CONFIG_CRYPTO_NULL is not set | ||
| 1291 | # CONFIG_CRYPTO_CRYPTD is not set | ||
| 1292 | # CONFIG_CRYPTO_AUTHENC is not set | ||
| 1293 | # CONFIG_CRYPTO_TEST is not set | ||
| 1294 | |||
| 1295 | # | ||
| 1296 | # Authenticated Encryption with Associated Data | ||
| 1297 | # | ||
| 1298 | # CONFIG_CRYPTO_CCM is not set | ||
| 1299 | # CONFIG_CRYPTO_GCM is not set | ||
| 1300 | # CONFIG_CRYPTO_SEQIV is not set | ||
| 1301 | |||
| 1302 | # | ||
| 1303 | # Block modes | ||
| 1304 | # | ||
| 1305 | # CONFIG_CRYPTO_CBC is not set | ||
| 1306 | # CONFIG_CRYPTO_CTR is not set | ||
| 1307 | # CONFIG_CRYPTO_CTS is not set | ||
| 1308 | # CONFIG_CRYPTO_ECB is not set | ||
| 1309 | # CONFIG_CRYPTO_LRW is not set | ||
| 1310 | # CONFIG_CRYPTO_PCBC is not set | ||
| 1311 | # CONFIG_CRYPTO_XTS is not set | ||
| 1312 | |||
| 1313 | # | ||
| 1314 | # Hash modes | ||
| 1315 | # | ||
| 1316 | # CONFIG_CRYPTO_HMAC is not set | ||
| 1317 | # CONFIG_CRYPTO_XCBC is not set | ||
| 1318 | |||
| 1319 | # | ||
| 1320 | # Digest | ||
| 1321 | # | ||
| 1322 | # CONFIG_CRYPTO_CRC32C is not set | ||
| 1323 | # CONFIG_CRYPTO_MD4 is not set | ||
| 1324 | # CONFIG_CRYPTO_MD5 is not set | ||
| 1325 | # CONFIG_CRYPTO_MICHAEL_MIC is not set | ||
| 1326 | # CONFIG_CRYPTO_RMD128 is not set | ||
| 1327 | # CONFIG_CRYPTO_RMD160 is not set | ||
| 1328 | # CONFIG_CRYPTO_RMD256 is not set | ||
| 1329 | # CONFIG_CRYPTO_RMD320 is not set | ||
| 1330 | # CONFIG_CRYPTO_SHA1 is not set | ||
| 1331 | # CONFIG_CRYPTO_SHA256 is not set | ||
| 1332 | # CONFIG_CRYPTO_SHA512 is not set | ||
| 1333 | # CONFIG_CRYPTO_TGR192 is not set | ||
| 1334 | # CONFIG_CRYPTO_WP512 is not set | ||
| 1335 | |||
| 1336 | # | ||
| 1337 | # Ciphers | ||
| 1338 | # | ||
| 1339 | # CONFIG_CRYPTO_AES is not set | ||
| 1340 | # CONFIG_CRYPTO_ANUBIS is not set | ||
| 1341 | # CONFIG_CRYPTO_ARC4 is not set | ||
| 1342 | # CONFIG_CRYPTO_BLOWFISH is not set | ||
| 1343 | # CONFIG_CRYPTO_CAMELLIA is not set | ||
| 1344 | # CONFIG_CRYPTO_CAST5 is not set | ||
| 1345 | # CONFIG_CRYPTO_CAST6 is not set | ||
| 1346 | # CONFIG_CRYPTO_DES is not set | ||
| 1347 | # CONFIG_CRYPTO_FCRYPT is not set | ||
| 1348 | # CONFIG_CRYPTO_KHAZAD is not set | ||
| 1349 | # CONFIG_CRYPTO_SALSA20 is not set | ||
| 1350 | # CONFIG_CRYPTO_SEED is not set | ||
| 1351 | # CONFIG_CRYPTO_SERPENT is not set | ||
| 1352 | # CONFIG_CRYPTO_TEA is not set | ||
| 1353 | # CONFIG_CRYPTO_TWOFISH is not set | ||
| 1354 | |||
| 1355 | # | ||
| 1356 | # Compression | ||
| 1357 | # | ||
| 1358 | # CONFIG_CRYPTO_DEFLATE is not set | ||
| 1359 | # CONFIG_CRYPTO_LZO is not set | ||
| 1360 | |||
| 1361 | # | ||
| 1362 | # Random Number Generation | ||
| 1363 | # | ||
| 1364 | # CONFIG_CRYPTO_ANSI_CPRNG is not set | ||
| 1365 | CONFIG_CRYPTO_HW=y | ||
| 1170 | 1366 | ||
| 1171 | # | 1367 | # |
| 1172 | # Library routines | 1368 | # Library routines |
| @@ -1174,6 +1370,7 @@ CONFIG_SECURITY=y | |||
| 1174 | CONFIG_BITREVERSE=y | 1370 | CONFIG_BITREVERSE=y |
| 1175 | CONFIG_CRC_CCITT=m | 1371 | CONFIG_CRC_CCITT=m |
| 1176 | # CONFIG_CRC16 is not set | 1372 | # CONFIG_CRC16 is not set |
| 1373 | # CONFIG_CRC_T10DIF is not set | ||
| 1177 | # CONFIG_CRC_ITU_T is not set | 1374 | # CONFIG_CRC_ITU_T is not set |
| 1178 | CONFIG_CRC32=y | 1375 | CONFIG_CRC32=y |
| 1179 | # CONFIG_CRC7 is not set | 1376 | # CONFIG_CRC7 is not set |
diff --git a/arch/blackfin/include/asm/checksum.h b/arch/blackfin/include/asm/checksum.h index f67289a0d8d2..793581fc9556 100644 --- a/arch/blackfin/include/asm/checksum.h +++ b/arch/blackfin/include/asm/checksum.h | |||
| @@ -63,23 +63,23 @@ static inline __wsum | |||
| 63 | csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, | 63 | csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, |
| 64 | unsigned short proto, __wsum sum) | 64 | unsigned short proto, __wsum sum) |
| 65 | { | 65 | { |
| 66 | 66 | unsigned int carry; | |
| 67 | __asm__ ("%0 = %0 + %1;\n\t" | 67 | |
| 68 | "CC = AC0;\n\t" | 68 | __asm__ ("%0 = %0 + %2;\n\t" |
| 69 | "if !CC jump 4;\n\t" | 69 | "CC = AC0;\n\t" |
| 70 | "%0 = %0 + %4;\n\t" | 70 | "%1 = CC;\n\t" |
| 71 | "%0 = %0 + %2;\n\t" | 71 | "%0 = %0 + %1;\n\t" |
| 72 | "CC = AC0;\n\t" | 72 | "%0 = %0 + %3;\n\t" |
| 73 | "if !CC jump 4;\n\t" | 73 | "CC = AC0;\n\t" |
| 74 | "%0 = %0 + %4;\n\t" | 74 | "%1 = CC;\n\t" |
| 75 | "%0 = %0 + %3;\n\t" | 75 | "%0 = %0 + %1;\n\t" |
| 76 | "CC = AC0;\n\t" | 76 | "%0 = %0 + %4;\n\t" |
| 77 | "if !CC jump 4;\n\t" | 77 | "CC = AC0;\n\t" |
| 78 | "%0 = %0 + %4;\n\t" | 78 | "%1 = CC;\n\t" |
| 79 | "NOP;\n\t" | 79 | "%0 = %0 + %1;\n\t" |
| 80 | : "=d" (sum) | 80 | : "=d" (sum), "=&d" (carry) |
| 81 | : "d" (daddr), "d" (saddr), "d" ((ntohs(len)<<16)+proto*256), "d" (1), "0"(sum) | 81 | : "d" (daddr), "d" (saddr), "d" ((len + proto) << 8), "0"(sum) |
| 82 | : "CC"); | 82 | : "CC"); |
| 83 | 83 | ||
| 84 | return (sum); | 84 | return (sum); |
| 85 | } | 85 | } |
diff --git a/arch/blackfin/include/asm/delay.h b/arch/blackfin/include/asm/delay.h index 0889c3abb593..c31f91cc1d5d 100644 --- a/arch/blackfin/include/asm/delay.h +++ b/arch/blackfin/include/asm/delay.h | |||
| @@ -13,29 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | static inline void __delay(unsigned long loops) | 14 | static inline void __delay(unsigned long loops) |
| 15 | { | 15 | { |
| 16 | if (ANOMALY_05000312) { | 16 | __asm__ __volatile__ ( |
| 17 | /* Interrupted loads to loop registers -> bad */ | ||
| 18 | unsigned long tmp; | ||
| 19 | __asm__ __volatile__( | ||
| 20 | "[--SP] = LC0;" | ||
| 21 | "[--SP] = LT0;" | ||
| 22 | "[--SP] = LB0;" | ||
| 23 | "LSETUP (1f,1f) LC0 = %1;" | ||
| 24 | "1: NOP;" | ||
| 25 | /* We take advantage of the fact that LC0 is 0 at | ||
| 26 | * the end of the loop. Otherwise we'd need some | ||
| 27 | * NOPs after the CLI here. | ||
| 28 | */ | ||
| 29 | "CLI %0;" | ||
| 30 | "LB0 = [SP++];" | ||
| 31 | "LT0 = [SP++];" | ||
| 32 | "LC0 = [SP++];" | ||
| 33 | "STI %0;" | ||
| 34 | : "=d" (tmp) | ||
| 35 | : "a" (loops) | ||
| 36 | ); | ||
| 37 | } else | ||
| 38 | __asm__ __volatile__ ( | ||
| 39 | "LSETUP(1f, 1f) LC0 = %0;" | 17 | "LSETUP(1f, 1f) LC0 = %0;" |
| 40 | "1: NOP;" | 18 | "1: NOP;" |
| 41 | : | 19 | : |
| @@ -47,16 +25,15 @@ static inline void __delay(unsigned long loops) | |||
| 47 | #include <linux/param.h> /* needed for HZ */ | 25 | #include <linux/param.h> /* needed for HZ */ |
| 48 | 26 | ||
| 49 | /* | 27 | /* |
| 50 | * Use only for very small delays ( < 1 msec). Should probably use a | 28 | * close approximation borrowed from m68knommu to avoid 64-bit math |
| 51 | * lookup table, really, as the multiplications take much too long with | ||
| 52 | * short delays. This is a "reasonable" implementation, though (and the | ||
| 53 | * first constant multiplications gets optimized away if the delay is | ||
| 54 | * a constant) | ||
| 55 | */ | 29 | */ |
| 30 | |||
| 31 | #define HZSCALE (268435456 / (1000000/HZ)) | ||
| 32 | |||
| 56 | static inline void udelay(unsigned long usecs) | 33 | static inline void udelay(unsigned long usecs) |
| 57 | { | 34 | { |
| 58 | extern unsigned long loops_per_jiffy; | 35 | extern unsigned long loops_per_jiffy; |
| 59 | __delay(usecs * loops_per_jiffy / (1000000 / HZ)); | 36 | __delay((((usecs * HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6); |
| 60 | } | 37 | } |
| 61 | 38 | ||
| 62 | #endif | 39 | #endif |
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h index 9477d82fcad2..d4a082ef75b4 100644 --- a/arch/blackfin/include/asm/gpio.h +++ b/arch/blackfin/include/asm/gpio.h | |||
| @@ -27,60 +27,6 @@ | |||
| 27 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 27 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | /* | ||
| 31 | * Number BF537/6/4 BF561 BF533/2/1 | ||
| 32 | * BF527/5/2 | ||
| 33 | * | ||
| 34 | * GPIO_0 PF0 PF0 PF0 | ||
| 35 | * GPIO_1 PF1 PF1 PF1 | ||
| 36 | * GPIO_2 PF2 PF2 PF2 | ||
| 37 | * GPIO_3 PF3 PF3 PF3 | ||
| 38 | * GPIO_4 PF4 PF4 PF4 | ||
| 39 | * GPIO_5 PF5 PF5 PF5 | ||
| 40 | * GPIO_6 PF6 PF6 PF6 | ||
| 41 | * GPIO_7 PF7 PF7 PF7 | ||
| 42 | * GPIO_8 PF8 PF8 PF8 | ||
| 43 | * GPIO_9 PF9 PF9 PF9 | ||
| 44 | * GPIO_10 PF10 PF10 PF10 | ||
| 45 | * GPIO_11 PF11 PF11 PF11 | ||
| 46 | * GPIO_12 PF12 PF12 PF12 | ||
| 47 | * GPIO_13 PF13 PF13 PF13 | ||
| 48 | * GPIO_14 PF14 PF14 PF14 | ||
| 49 | * GPIO_15 PF15 PF15 PF15 | ||
| 50 | * GPIO_16 PG0 PF16 | ||
| 51 | * GPIO_17 PG1 PF17 | ||
| 52 | * GPIO_18 PG2 PF18 | ||
| 53 | * GPIO_19 PG3 PF19 | ||
| 54 | * GPIO_20 PG4 PF20 | ||
| 55 | * GPIO_21 PG5 PF21 | ||
| 56 | * GPIO_22 PG6 PF22 | ||
| 57 | * GPIO_23 PG7 PF23 | ||
| 58 | * GPIO_24 PG8 PF24 | ||
| 59 | * GPIO_25 PG9 PF25 | ||
| 60 | * GPIO_26 PG10 PF26 | ||
| 61 | * GPIO_27 PG11 PF27 | ||
| 62 | * GPIO_28 PG12 PF28 | ||
| 63 | * GPIO_29 PG13 PF29 | ||
| 64 | * GPIO_30 PG14 PF30 | ||
| 65 | * GPIO_31 PG15 PF31 | ||
| 66 | * GPIO_32 PH0 PF32 | ||
| 67 | * GPIO_33 PH1 PF33 | ||
| 68 | * GPIO_34 PH2 PF34 | ||
| 69 | * GPIO_35 PH3 PF35 | ||
| 70 | * GPIO_36 PH4 PF36 | ||
| 71 | * GPIO_37 PH5 PF37 | ||
| 72 | * GPIO_38 PH6 PF38 | ||
| 73 | * GPIO_39 PH7 PF39 | ||
| 74 | * GPIO_40 PH8 PF40 | ||
| 75 | * GPIO_41 PH9 PF41 | ||
| 76 | * GPIO_42 PH10 PF42 | ||
| 77 | * GPIO_43 PH11 PF43 | ||
| 78 | * GPIO_44 PH12 PF44 | ||
| 79 | * GPIO_45 PH13 PF45 | ||
| 80 | * GPIO_46 PH14 PF46 | ||
| 81 | * GPIO_47 PH15 PF47 | ||
| 82 | */ | ||
| 83 | |||
| 84 | #ifndef __ARCH_BLACKFIN_GPIO_H__ | 30 | #ifndef __ARCH_BLACKFIN_GPIO_H__ |
| 85 | #define __ARCH_BLACKFIN_GPIO_H__ | 31 | #define __ARCH_BLACKFIN_GPIO_H__ |
| 86 | 32 | ||
| @@ -295,10 +241,6 @@ int bfin_gpio_direction_output(unsigned gpio, int value); | |||
| 295 | int bfin_gpio_get_value(unsigned gpio); | 241 | int bfin_gpio_get_value(unsigned gpio); |
| 296 | void bfin_gpio_set_value(unsigned gpio, int value); | 242 | void bfin_gpio_set_value(unsigned gpio, int value); |
| 297 | 243 | ||
| 298 | #ifndef BF548_FAMILY | ||
| 299 | #define bfin_gpio_set_value(gpio, value) set_gpio_data(gpio, value) | ||
| 300 | #endif | ||
| 301 | |||
| 302 | #ifdef CONFIG_GPIOLIB | 244 | #ifdef CONFIG_GPIOLIB |
| 303 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | 245 | #include <asm-generic/gpio.h> /* cansleep wrappers */ |
| 304 | 246 | ||
diff --git a/arch/blackfin/include/asm/kgdb.h b/arch/blackfin/include/asm/kgdb.h index 26ebac6646d8..c8b256d2ea30 100644 --- a/arch/blackfin/include/asm/kgdb.h +++ b/arch/blackfin/include/asm/kgdb.h | |||
| @@ -1,32 +1,8 @@ | |||
| 1 | /* | 1 | /* Blackfin KGDB header |
| 2 | * File: include/asm-blackfin/kgdb.h | ||
| 3 | * Based on: | ||
| 4 | * Author: Sonic Zhang | ||
| 5 | * | ||
| 6 | * Created: | ||
| 7 | * Description: | ||
| 8 | * | ||
| 9 | * Rev: $Id: kgdb_bfin_linux-2.6.x.patch 4934 2007-02-13 09:32:11Z sonicz $ | ||
| 10 | * | ||
| 11 | * Modified: | ||
| 12 | * Copyright 2005-2006 Analog Devices Inc. | ||
| 13 | * | ||
| 14 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | ||
| 15 | * | 2 | * |
| 16 | * This program is free software; you can redistribute it and/or modify | 3 | * Copyright 2005-2009 Analog Devices Inc. |
| 17 | * it under the terms of the GNU General Public License as published by | ||
| 18 | * the Free Software Foundation; either version 2 of the License, or | ||
| 19 | * (at your option) any later version. | ||
| 20 | * | 4 | * |
| 21 | * This program is distributed in the hope that it will be useful, | 5 | * Licensed under the GPL-2 or later. |
| 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 24 | * GNU General Public License for more details. | ||
| 25 | * | ||
| 26 | * You should have received a copy of the GNU General Public License | ||
| 27 | * along with this program; if not, see the file COPYING, or write | ||
| 28 | * to the Free Software Foundation, Inc., | ||
| 29 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 30 | */ | 6 | */ |
| 31 | 7 | ||
| 32 | #ifndef __ASM_BLACKFIN_KGDB_H__ | 8 | #ifndef __ASM_BLACKFIN_KGDB_H__ |
| @@ -37,17 +13,18 @@ | |||
| 37 | /* gdb locks */ | 13 | /* gdb locks */ |
| 38 | #define KGDB_MAX_NO_CPUS 8 | 14 | #define KGDB_MAX_NO_CPUS 8 |
| 39 | 15 | ||
| 40 | /************************************************************************/ | 16 | /* |
| 41 | /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ | 17 | * BUFMAX defines the maximum number of characters in inbound/outbound buffers. |
| 42 | /* at least NUMREGBYTES*2 are needed for register packets */ | 18 | * At least NUMREGBYTES*2 are needed for register packets. |
| 43 | /* Longer buffer is needed to list all threads */ | 19 | * Longer buffer is needed to list all threads. |
| 20 | */ | ||
| 44 | #define BUFMAX 2048 | 21 | #define BUFMAX 2048 |
| 45 | 22 | ||
| 46 | /* | 23 | /* |
| 47 | * Note that this register image is different from | 24 | * Note that this register image is different from |
| 48 | * the register image that Linux produces at interrupt time. | 25 | * the register image that Linux produces at interrupt time. |
| 49 | * | 26 | * |
| 50 | * Linux's register image is defined by struct pt_regs in ptrace.h. | 27 | * Linux's register image is defined by struct pt_regs in ptrace.h. |
| 51 | */ | 28 | */ |
| 52 | enum regnames { | 29 | enum regnames { |
| 53 | /* Core Registers */ | 30 | /* Core Registers */ |
| @@ -104,14 +81,14 @@ enum regnames { | |||
| 104 | BFIN_RETX, | 81 | BFIN_RETX, |
| 105 | BFIN_RETN, | 82 | BFIN_RETN, |
| 106 | BFIN_RETE, | 83 | BFIN_RETE, |
| 107 | 84 | ||
| 108 | /* Pseudo Registers */ | 85 | /* Pseudo Registers */ |
| 109 | BFIN_PC, | 86 | BFIN_PC, |
| 110 | BFIN_CC, | 87 | BFIN_CC, |
| 111 | BFIN_EXTRA1, /* Address of .text section. */ | 88 | BFIN_EXTRA1, /* Address of .text section. */ |
| 112 | BFIN_EXTRA2, /* Address of .data section. */ | 89 | BFIN_EXTRA2, /* Address of .data section. */ |
| 113 | BFIN_EXTRA3, /* Address of .bss section. */ | 90 | BFIN_EXTRA3, /* Address of .bss section. */ |
| 114 | BFIN_FDPIC_EXEC, | 91 | BFIN_FDPIC_EXEC, |
| 115 | BFIN_FDPIC_INTERP, | 92 | BFIN_FDPIC_INTERP, |
| 116 | 93 | ||
| 117 | /* MMRs */ | 94 | /* MMRs */ |
| @@ -126,7 +103,7 @@ enum regnames { | |||
| 126 | 103 | ||
| 127 | static inline void arch_kgdb_breakpoint(void) | 104 | static inline void arch_kgdb_breakpoint(void) |
| 128 | { | 105 | { |
| 129 | asm(" EXCPT 2;"); | 106 | asm("EXCPT 2;"); |
| 130 | } | 107 | } |
| 131 | #define BREAK_INSTR_SIZE 2 | 108 | #define BREAK_INSTR_SIZE 2 |
| 132 | #define CACHE_FLUSH_IS_SAFE 1 | 109 | #define CACHE_FLUSH_IS_SAFE 1 |
diff --git a/arch/blackfin/include/asm/mem_init.h b/arch/blackfin/include/asm/mem_init.h index 255a9316ad36..61f7487fbf12 100644 --- a/arch/blackfin/include/asm/mem_init.h +++ b/arch/blackfin/include/asm/mem_init.h | |||
| @@ -115,7 +115,7 @@ | |||
| 115 | #define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num) | 115 | #define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num) |
| 116 | 116 | ||
| 117 | /* Enable SCLK Out */ | 117 | /* Enable SCLK Out */ |
| 118 | #define mem_SDGCTL (0x80000000 | SCTLE | SDRAM_CL | SDRAM_tRAS | SDRAM_tRP | SDRAM_tRCD | SDRAM_tWR | PSS) | 118 | #define mem_SDGCTL (SCTLE | SDRAM_CL | SDRAM_tRAS | SDRAM_tRP | SDRAM_tRCD | SDRAM_tWR | PSS) |
| 119 | #else | 119 | #else |
| 120 | #define mem_SDRRC CONFIG_MEM_SDRRC | 120 | #define mem_SDRRC CONFIG_MEM_SDRRC |
| 121 | #define mem_SDGCTL CONFIG_MEM_SDGCTL | 121 | #define mem_SDGCTL CONFIG_MEM_SDGCTL |
diff --git a/arch/blackfin/include/asm/pda.h b/arch/blackfin/include/asm/pda.h index bd8d4a7efeb2..a67142740df0 100644 --- a/arch/blackfin/include/asm/pda.h +++ b/arch/blackfin/include/asm/pda.h | |||
| @@ -59,6 +59,7 @@ struct blackfin_pda { /* Per-processor Data Area */ | |||
| 59 | unsigned long icplb_fault_addr; | 59 | unsigned long icplb_fault_addr; |
| 60 | unsigned long retx; | 60 | unsigned long retx; |
| 61 | unsigned long seqstat; | 61 | unsigned long seqstat; |
| 62 | unsigned int __nmi_count; /* number of times NMI asserted on this CPU */ | ||
| 62 | }; | 63 | }; |
| 63 | 64 | ||
| 64 | extern struct blackfin_pda cpu_pda[]; | 65 | extern struct blackfin_pda cpu_pda[]; |
diff --git a/arch/blackfin/include/asm/reboot.h b/arch/blackfin/include/asm/reboot.h index 4856d62b7467..ae1e36329bec 100644 --- a/arch/blackfin/include/asm/reboot.h +++ b/arch/blackfin/include/asm/reboot.h | |||
| @@ -15,6 +15,6 @@ extern void native_machine_halt(void); | |||
| 15 | extern void native_machine_power_off(void); | 15 | extern void native_machine_power_off(void); |
| 16 | 16 | ||
| 17 | /* common reboot workarounds */ | 17 | /* common reboot workarounds */ |
| 18 | extern void bfin_gpio_reset_spi0_ssel1(void); | 18 | extern void bfin_reset_boot_spi_cs(unsigned short pin); |
| 19 | 19 | ||
| 20 | #endif | 20 | #endif |
diff --git a/arch/blackfin/kernel/Makefile b/arch/blackfin/kernel/Makefile index 38a233374f07..4a92a86824b7 100644 --- a/arch/blackfin/kernel/Makefile +++ b/arch/blackfin/kernel/Makefile | |||
| @@ -15,6 +15,8 @@ else | |||
| 15 | obj-y += time.o | 15 | obj-y += time.o |
| 16 | endif | 16 | endif |
| 17 | 17 | ||
| 18 | CFLAGS_kgdb_test.o := -mlong-calls -O0 | ||
| 19 | |||
| 18 | obj-$(CONFIG_IPIPE) += ipipe.o | 20 | obj-$(CONFIG_IPIPE) += ipipe.o |
| 19 | obj-$(CONFIG_IPIPE_TRACE_MCOUNT) += mcount.o | 21 | obj-$(CONFIG_IPIPE_TRACE_MCOUNT) += mcount.o |
| 20 | obj-$(CONFIG_BFIN_GPTIMERS) += gptimers.o | 22 | obj-$(CONFIG_BFIN_GPTIMERS) += gptimers.o |
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c index 07e02c0d1c07..8531693fb48d 100644 --- a/arch/blackfin/kernel/bfin_dma_5xx.c +++ b/arch/blackfin/kernel/bfin_dma_5xx.c | |||
| @@ -249,6 +249,13 @@ static void __dma_memcpy(u32 daddr, s16 dmod, u32 saddr, s16 smod, size_t cnt, u | |||
| 249 | 249 | ||
| 250 | spin_lock_irqsave(&mdma_lock, flags); | 250 | spin_lock_irqsave(&mdma_lock, flags); |
| 251 | 251 | ||
| 252 | /* Force a sync in case a previous config reset on this channel | ||
| 253 | * occurred. This is needed so subsequent writes to DMA registers | ||
| 254 | * are not spuriously lost/corrupted. Do it under irq lock and | ||
| 255 | * without the anomaly version (because we are atomic already). | ||
| 256 | */ | ||
| 257 | __builtin_bfin_ssync(); | ||
| 258 | |||
| 252 | if (bfin_read_MDMA_S0_CONFIG()) | 259 | if (bfin_read_MDMA_S0_CONFIG()) |
| 253 | while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE)) | 260 | while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE)) |
| 254 | continue; | 261 | continue; |
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c index 4c14331978f6..51dac55c524a 100644 --- a/arch/blackfin/kernel/bfin_gpio.c +++ b/arch/blackfin/kernel/bfin_gpio.c | |||
| @@ -27,59 +27,6 @@ | |||
| 27 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 27 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | /* | ||
| 31 | * Number BF537/6/4 BF561 BF533/2/1 BF549/8/4/2 | ||
| 32 | * | ||
| 33 | * GPIO_0 PF0 PF0 PF0 PA0...PJ13 | ||
| 34 | * GPIO_1 PF1 PF1 PF1 | ||
| 35 | * GPIO_2 PF2 PF2 PF2 | ||
| 36 | * GPIO_3 PF3 PF3 PF3 | ||
| 37 | * GPIO_4 PF4 PF4 PF4 | ||
| 38 | * GPIO_5 PF5 PF5 PF5 | ||
| 39 | * GPIO_6 PF6 PF6 PF6 | ||
| 40 | * GPIO_7 PF7 PF7 PF7 | ||
| 41 | * GPIO_8 PF8 PF8 PF8 | ||
| 42 | * GPIO_9 PF9 PF9 PF9 | ||
| 43 | * GPIO_10 PF10 PF10 PF10 | ||
| 44 | * GPIO_11 PF11 PF11 PF11 | ||
| 45 | * GPIO_12 PF12 PF12 PF12 | ||
| 46 | * GPIO_13 PF13 PF13 PF13 | ||
| 47 | * GPIO_14 PF14 PF14 PF14 | ||
| 48 | * GPIO_15 PF15 PF15 PF15 | ||
| 49 | * GPIO_16 PG0 PF16 | ||
| 50 | * GPIO_17 PG1 PF17 | ||
| 51 | * GPIO_18 PG2 PF18 | ||
| 52 | * GPIO_19 PG3 PF19 | ||
| 53 | * GPIO_20 PG4 PF20 | ||
| 54 | * GPIO_21 PG5 PF21 | ||
| 55 | * GPIO_22 PG6 PF22 | ||
| 56 | * GPIO_23 PG7 PF23 | ||
| 57 | * GPIO_24 PG8 PF24 | ||
| 58 | * GPIO_25 PG9 PF25 | ||
| 59 | * GPIO_26 PG10 PF26 | ||
| 60 | * GPIO_27 PG11 PF27 | ||
| 61 | * GPIO_28 PG12 PF28 | ||
| 62 | * GPIO_29 PG13 PF29 | ||
| 63 | * GPIO_30 PG14 PF30 | ||
| 64 | * GPIO_31 PG15 PF31 | ||
| 65 | * GPIO_32 PH0 PF32 | ||
| 66 | * GPIO_33 PH1 PF33 | ||
| 67 | * GPIO_34 PH2 PF34 | ||
| 68 | * GPIO_35 PH3 PF35 | ||
| 69 | * GPIO_36 PH4 PF36 | ||
| 70 | * GPIO_37 PH5 PF37 | ||
| 71 | * GPIO_38 PH6 PF38 | ||
| 72 | * GPIO_39 PH7 PF39 | ||
| 73 | * GPIO_40 PH8 PF40 | ||
| 74 | * GPIO_41 PH9 PF41 | ||
| 75 | * GPIO_42 PH10 PF42 | ||
| 76 | * GPIO_43 PH11 PF43 | ||
| 77 | * GPIO_44 PH12 PF44 | ||
| 78 | * GPIO_45 PH13 PF45 | ||
| 79 | * GPIO_46 PH14 PF46 | ||
| 80 | * GPIO_47 PH15 PF47 | ||
| 81 | */ | ||
| 82 | |||
| 83 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
| 84 | #include <linux/module.h> | 31 | #include <linux/module.h> |
| 85 | #include <linux/err.h> | 32 | #include <linux/err.h> |
| @@ -119,62 +66,61 @@ enum { | |||
| 119 | #define AWA_DUMMY_READ(...) do { } while (0) | 66 | #define AWA_DUMMY_READ(...) do { } while (0) |
| 120 | #endif | 67 | #endif |
| 121 | 68 | ||
| 69 | static struct gpio_port_t * const gpio_array[] = { | ||
| 122 | #if defined(BF533_FAMILY) || defined(BF538_FAMILY) | 70 | #if defined(BF533_FAMILY) || defined(BF538_FAMILY) |
| 123 | static struct gpio_port_t *gpio_bankb[] = { | ||
| 124 | (struct gpio_port_t *) FIO_FLAG_D, | 71 | (struct gpio_port_t *) FIO_FLAG_D, |
| 125 | }; | 72 | #elif defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY) |
| 126 | #endif | ||
| 127 | |||
| 128 | #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY) | ||
| 129 | static struct gpio_port_t *gpio_bankb[] = { | ||
| 130 | (struct gpio_port_t *) PORTFIO, | 73 | (struct gpio_port_t *) PORTFIO, |
| 131 | (struct gpio_port_t *) PORTGIO, | 74 | (struct gpio_port_t *) PORTGIO, |
| 132 | (struct gpio_port_t *) PORTHIO, | 75 | (struct gpio_port_t *) PORTHIO, |
| 76 | #elif defined(BF561_FAMILY) | ||
| 77 | (struct gpio_port_t *) FIO0_FLAG_D, | ||
| 78 | (struct gpio_port_t *) FIO1_FLAG_D, | ||
| 79 | (struct gpio_port_t *) FIO2_FLAG_D, | ||
| 80 | #elif defined(BF548_FAMILY) | ||
| 81 | (struct gpio_port_t *)PORTA_FER, | ||
| 82 | (struct gpio_port_t *)PORTB_FER, | ||
| 83 | (struct gpio_port_t *)PORTC_FER, | ||
| 84 | (struct gpio_port_t *)PORTD_FER, | ||
| 85 | (struct gpio_port_t *)PORTE_FER, | ||
| 86 | (struct gpio_port_t *)PORTF_FER, | ||
| 87 | (struct gpio_port_t *)PORTG_FER, | ||
| 88 | (struct gpio_port_t *)PORTH_FER, | ||
| 89 | (struct gpio_port_t *)PORTI_FER, | ||
| 90 | (struct gpio_port_t *)PORTJ_FER, | ||
| 91 | #else | ||
| 92 | # error no gpio arrays defined | ||
| 93 | #endif | ||
| 133 | }; | 94 | }; |
| 134 | 95 | ||
| 135 | static unsigned short *port_fer[] = { | 96 | #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY) |
| 97 | static unsigned short * const port_fer[] = { | ||
| 136 | (unsigned short *) PORTF_FER, | 98 | (unsigned short *) PORTF_FER, |
| 137 | (unsigned short *) PORTG_FER, | 99 | (unsigned short *) PORTG_FER, |
| 138 | (unsigned short *) PORTH_FER, | 100 | (unsigned short *) PORTH_FER, |
| 139 | }; | 101 | }; |
| 140 | #endif | ||
| 141 | 102 | ||
| 142 | #if defined(BF527_FAMILY) || defined(BF518_FAMILY) | 103 | # if !defined(BF537_FAMILY) |
| 143 | static unsigned short *port_mux[] = { | 104 | static unsigned short * const port_mux[] = { |
| 144 | (unsigned short *) PORTF_MUX, | 105 | (unsigned short *) PORTF_MUX, |
| 145 | (unsigned short *) PORTG_MUX, | 106 | (unsigned short *) PORTG_MUX, |
| 146 | (unsigned short *) PORTH_MUX, | 107 | (unsigned short *) PORTH_MUX, |
| 147 | }; | 108 | }; |
| 148 | 109 | ||
| 149 | static const | 110 | static const |
| 150 | u8 pmux_offset[][16] = | 111 | u8 pmux_offset[][16] = { |
| 151 | {{ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 4, 6, 8, 8, 10, 10 }, /* PORTF */ | 112 | # if defined(BF527_FAMILY) |
| 152 | { 0, 0, 0, 0, 0, 2, 2, 4, 4, 6, 8, 10, 10, 10, 12, 12 }, /* PORTG */ | 113 | { 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 4, 6, 8, 8, 10, 10 }, /* PORTF */ |
| 153 | { 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 4, 4, 4, 4, 4 }, /* PORTH */ | 114 | { 0, 0, 0, 0, 0, 2, 2, 4, 4, 6, 8, 10, 10, 10, 12, 12 }, /* PORTG */ |
| 154 | }; | 115 | { 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 4, 4, 4, 4, 4 }, /* PORTH */ |
| 155 | #endif | 116 | # elif defined(BF518_FAMILY) |
| 156 | 117 | { 0, 2, 2, 2, 2, 2, 2, 4, 6, 6, 6, 8, 8, 8, 8, 10 }, /* PORTF */ | |
| 157 | #ifdef BF561_FAMILY | 118 | { 0, 0, 0, 2, 4, 6, 6, 6, 8, 10, 10, 12, 14, 14, 14, 14 }, /* PORTG */ |
| 158 | static struct gpio_port_t *gpio_bankb[] = { | 119 | { 0, 0, 0, 0, 2, 2, 4, 6, 10, 10, 10, 10, 10, 10, 10, 10 }, /* PORTH */ |
| 159 | (struct gpio_port_t *) FIO0_FLAG_D, | 120 | # endif |
| 160 | (struct gpio_port_t *) FIO1_FLAG_D, | ||
| 161 | (struct gpio_port_t *) FIO2_FLAG_D, | ||
| 162 | }; | 121 | }; |
| 163 | #endif | 122 | # endif |
| 164 | 123 | ||
| 165 | #ifdef BF548_FAMILY | ||
| 166 | static struct gpio_port_t *gpio_array[] = { | ||
| 167 | (struct gpio_port_t *)PORTA_FER, | ||
| 168 | (struct gpio_port_t *)PORTB_FER, | ||
| 169 | (struct gpio_port_t *)PORTC_FER, | ||
| 170 | (struct gpio_port_t *)PORTD_FER, | ||
| 171 | (struct gpio_port_t *)PORTE_FER, | ||
| 172 | (struct gpio_port_t *)PORTF_FER, | ||
| 173 | (struct gpio_port_t *)PORTG_FER, | ||
| 174 | (struct gpio_port_t *)PORTH_FER, | ||
| 175 | (struct gpio_port_t *)PORTI_FER, | ||
| 176 | (struct gpio_port_t *)PORTJ_FER, | ||
| 177 | }; | ||
| 178 | #endif | 124 | #endif |
| 179 | 125 | ||
| 180 | static unsigned short reserved_gpio_map[GPIO_BANK_NUM]; | 126 | static unsigned short reserved_gpio_map[GPIO_BANK_NUM]; |
| @@ -188,35 +134,9 @@ static struct str_ident { | |||
| 188 | } str_ident[MAX_RESOURCES]; | 134 | } str_ident[MAX_RESOURCES]; |
| 189 | 135 | ||
| 190 | #if defined(CONFIG_PM) | 136 | #if defined(CONFIG_PM) |
| 191 | #if defined(CONFIG_BF54x) | ||
| 192 | static struct gpio_port_s gpio_bank_saved[GPIO_BANK_NUM]; | ||
| 193 | #else | ||
| 194 | static unsigned short wakeup_map[GPIO_BANK_NUM]; | ||
| 195 | static unsigned char wakeup_flags_map[MAX_BLACKFIN_GPIOS]; | ||
| 196 | static struct gpio_port_s gpio_bank_saved[GPIO_BANK_NUM]; | 137 | static struct gpio_port_s gpio_bank_saved[GPIO_BANK_NUM]; |
| 197 | |||
| 198 | #ifdef BF533_FAMILY | ||
| 199 | static unsigned int sic_iwr_irqs[] = {IRQ_PROG_INTB}; | ||
| 200 | #endif | ||
| 201 | |||
| 202 | #ifdef BF537_FAMILY | ||
| 203 | static unsigned int sic_iwr_irqs[] = {IRQ_PROG_INTB, IRQ_PORTG_INTB, IRQ_MAC_TX}; | ||
| 204 | #endif | ||
| 205 | |||
| 206 | #ifdef BF538_FAMILY | ||
| 207 | static unsigned int sic_iwr_irqs[] = {IRQ_PORTF_INTB}; | ||
| 208 | #endif | 138 | #endif |
| 209 | 139 | ||
| 210 | #if defined(BF527_FAMILY) || defined(BF518_FAMILY) | ||
| 211 | static unsigned int sic_iwr_irqs[] = {IRQ_PORTF_INTB, IRQ_PORTG_INTB, IRQ_PORTH_INTB}; | ||
| 212 | #endif | ||
| 213 | |||
| 214 | #ifdef BF561_FAMILY | ||
| 215 | static unsigned int sic_iwr_irqs[] = {IRQ_PROG0_INTB, IRQ_PROG1_INTB, IRQ_PROG2_INTB}; | ||
| 216 | #endif | ||
| 217 | #endif | ||
| 218 | #endif /* CONFIG_PM */ | ||
| 219 | |||
| 220 | inline int check_gpio(unsigned gpio) | 140 | inline int check_gpio(unsigned gpio) |
| 221 | { | 141 | { |
| 222 | #if defined(BF548_FAMILY) | 142 | #if defined(BF548_FAMILY) |
| @@ -330,9 +250,10 @@ static struct { | |||
| 330 | {.res = P_SPI0_SSEL3, .offset = 0}, | 250 | {.res = P_SPI0_SSEL3, .offset = 0}, |
| 331 | }; | 251 | }; |
| 332 | 252 | ||
| 333 | static void portmux_setup(unsigned short per, unsigned short function) | 253 | static void portmux_setup(unsigned short per) |
| 334 | { | 254 | { |
| 335 | u16 y, offset, muxreg; | 255 | u16 y, offset, muxreg; |
| 256 | u16 function = P_FUNCT2MUX(per); | ||
| 336 | 257 | ||
| 337 | for (y = 0; y < ARRAY_SIZE(port_mux_lut); y++) { | 258 | for (y = 0; y < ARRAY_SIZE(port_mux_lut); y++) { |
| 338 | if (port_mux_lut[y].res == per) { | 259 | if (port_mux_lut[y].res == per) { |
| @@ -353,30 +274,33 @@ static void portmux_setup(unsigned short per, unsigned short function) | |||
| 353 | } | 274 | } |
| 354 | } | 275 | } |
| 355 | #elif defined(BF548_FAMILY) | 276 | #elif defined(BF548_FAMILY) |
| 356 | inline void portmux_setup(unsigned short portno, unsigned short function) | 277 | inline void portmux_setup(unsigned short per) |
| 357 | { | 278 | { |
| 358 | u32 pmux; | 279 | u32 pmux; |
| 280 | u16 ident = P_IDENT(per); | ||
| 281 | u16 function = P_FUNCT2MUX(per); | ||
| 359 | 282 | ||
| 360 | pmux = gpio_array[gpio_bank(portno)]->port_mux; | 283 | pmux = gpio_array[gpio_bank(ident)]->port_mux; |
| 361 | 284 | ||
| 362 | pmux &= ~(0x3 << (2 * gpio_sub_n(portno))); | 285 | pmux &= ~(0x3 << (2 * gpio_sub_n(ident))); |
| 363 | pmux |= (function & 0x3) << (2 * gpio_sub_n(portno)); | 286 | pmux |= (function & 0x3) << (2 * gpio_sub_n(ident)); |
| 364 | 287 | ||
| 365 | gpio_array[gpio_bank(portno)]->port_mux = pmux; | 288 | gpio_array[gpio_bank(ident)]->port_mux = pmux; |
| 366 | } | 289 | } |
| 367 | 290 | ||
| 368 | inline u16 get_portmux(unsigned short portno) | 291 | inline u16 get_portmux(unsigned short per) |
| 369 | { | 292 | { |
| 370 | u32 pmux; | 293 | u32 pmux; |
| 294 | u16 ident = P_IDENT(per); | ||
| 371 | 295 | ||
| 372 | pmux = gpio_array[gpio_bank(portno)]->port_mux; | 296 | pmux = gpio_array[gpio_bank(ident)]->port_mux; |
| 373 | 297 | ||
| 374 | return (pmux >> (2 * gpio_sub_n(portno)) & 0x3); | 298 | return (pmux >> (2 * gpio_sub_n(ident)) & 0x3); |
| 375 | } | 299 | } |
| 376 | #elif defined(BF527_FAMILY) || defined(BF518_FAMILY) | 300 | #elif defined(BF527_FAMILY) || defined(BF518_FAMILY) |
| 377 | inline void portmux_setup(unsigned short portno, unsigned short function) | 301 | inline void portmux_setup(unsigned short per) |
| 378 | { | 302 | { |
| 379 | u16 pmux, ident = P_IDENT(portno); | 303 | u16 pmux, ident = P_IDENT(per), function = P_FUNCT2MUX(per); |
| 380 | u8 offset = pmux_offset[gpio_bank(ident)][gpio_sub_n(ident)]; | 304 | u8 offset = pmux_offset[gpio_bank(ident)][gpio_sub_n(ident)]; |
| 381 | 305 | ||
| 382 | pmux = *port_mux[gpio_bank(ident)]; | 306 | pmux = *port_mux[gpio_bank(ident)]; |
| @@ -424,90 +348,71 @@ void set_gpio_ ## name(unsigned gpio, unsigned short arg) \ | |||
| 424 | unsigned long flags; \ | 348 | unsigned long flags; \ |
| 425 | local_irq_save_hw(flags); \ | 349 | local_irq_save_hw(flags); \ |
| 426 | if (arg) \ | 350 | if (arg) \ |
| 427 | gpio_bankb[gpio_bank(gpio)]->name |= gpio_bit(gpio); \ | 351 | gpio_array[gpio_bank(gpio)]->name |= gpio_bit(gpio); \ |
| 428 | else \ | 352 | else \ |
| 429 | gpio_bankb[gpio_bank(gpio)]->name &= ~gpio_bit(gpio); \ | 353 | gpio_array[gpio_bank(gpio)]->name &= ~gpio_bit(gpio); \ |
| 430 | AWA_DUMMY_READ(name); \ | 354 | AWA_DUMMY_READ(name); \ |
| 431 | local_irq_restore_hw(flags); \ | 355 | local_irq_restore_hw(flags); \ |
| 432 | } \ | 356 | } \ |
| 433 | EXPORT_SYMBOL(set_gpio_ ## name); | 357 | EXPORT_SYMBOL(set_gpio_ ## name); |
| 434 | 358 | ||
| 435 | SET_GPIO(dir) | 359 | SET_GPIO(dir) /* set_gpio_dir() */ |
| 436 | SET_GPIO(inen) | 360 | SET_GPIO(inen) /* set_gpio_inen() */ |
| 437 | SET_GPIO(polar) | 361 | SET_GPIO(polar) /* set_gpio_polar() */ |
| 438 | SET_GPIO(edge) | 362 | SET_GPIO(edge) /* set_gpio_edge() */ |
| 439 | SET_GPIO(both) | 363 | SET_GPIO(both) /* set_gpio_both() */ |
| 440 | 364 | ||
| 441 | 365 | ||
| 442 | #if ANOMALY_05000311 || ANOMALY_05000323 | ||
| 443 | #define SET_GPIO_SC(name) \ | 366 | #define SET_GPIO_SC(name) \ |
| 444 | void set_gpio_ ## name(unsigned gpio, unsigned short arg) \ | 367 | void set_gpio_ ## name(unsigned gpio, unsigned short arg) \ |
| 445 | { \ | 368 | { \ |
| 446 | unsigned long flags; \ | 369 | unsigned long flags; \ |
| 447 | local_irq_save_hw(flags); \ | 370 | if (ANOMALY_05000311 || ANOMALY_05000323) \ |
| 448 | if (arg) \ | 371 | local_irq_save_hw(flags); \ |
| 449 | gpio_bankb[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \ | ||
| 450 | else \ | ||
| 451 | gpio_bankb[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \ | ||
| 452 | AWA_DUMMY_READ(name); \ | ||
| 453 | local_irq_restore_hw(flags); \ | ||
| 454 | } \ | ||
| 455 | EXPORT_SYMBOL(set_gpio_ ## name); | ||
| 456 | #else | ||
| 457 | #define SET_GPIO_SC(name) \ | ||
| 458 | void set_gpio_ ## name(unsigned gpio, unsigned short arg) \ | ||
| 459 | { \ | ||
| 460 | if (arg) \ | 372 | if (arg) \ |
| 461 | gpio_bankb[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \ | 373 | gpio_array[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \ |
| 462 | else \ | 374 | else \ |
| 463 | gpio_bankb[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \ | 375 | gpio_array[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \ |
| 376 | if (ANOMALY_05000311 || ANOMALY_05000323) { \ | ||
| 377 | AWA_DUMMY_READ(name); \ | ||
| 378 | local_irq_restore_hw(flags); \ | ||
| 379 | } \ | ||
| 464 | } \ | 380 | } \ |
| 465 | EXPORT_SYMBOL(set_gpio_ ## name); | 381 | EXPORT_SYMBOL(set_gpio_ ## name); |
| 466 | #endif | ||
| 467 | 382 | ||
| 468 | SET_GPIO_SC(maska) | 383 | SET_GPIO_SC(maska) |
| 469 | SET_GPIO_SC(maskb) | 384 | SET_GPIO_SC(maskb) |
| 470 | SET_GPIO_SC(data) | 385 | SET_GPIO_SC(data) |
| 471 | 386 | ||
| 472 | #if ANOMALY_05000311 || ANOMALY_05000323 | ||
| 473 | void set_gpio_toggle(unsigned gpio) | 387 | void set_gpio_toggle(unsigned gpio) |
| 474 | { | 388 | { |
| 475 | unsigned long flags; | 389 | unsigned long flags; |
| 476 | local_irq_save_hw(flags); | 390 | if (ANOMALY_05000311 || ANOMALY_05000323) |
| 477 | gpio_bankb[gpio_bank(gpio)]->toggle = gpio_bit(gpio); | 391 | local_irq_save_hw(flags); |
| 478 | AWA_DUMMY_READ(toggle); | 392 | gpio_array[gpio_bank(gpio)]->toggle = gpio_bit(gpio); |
| 479 | local_irq_restore_hw(flags); | 393 | if (ANOMALY_05000311 || ANOMALY_05000323) { |
| 480 | } | 394 | AWA_DUMMY_READ(toggle); |
| 481 | #else | 395 | local_irq_restore_hw(flags); |
| 482 | void set_gpio_toggle(unsigned gpio) | 396 | } |
| 483 | { | ||
| 484 | gpio_bankb[gpio_bank(gpio)]->toggle = gpio_bit(gpio); | ||
| 485 | } | 397 | } |
| 486 | #endif | ||
| 487 | EXPORT_SYMBOL(set_gpio_toggle); | 398 | EXPORT_SYMBOL(set_gpio_toggle); |
| 488 | 399 | ||
| 489 | 400 | ||
| 490 | /*Set current PORT date (16-bit word)*/ | 401 | /*Set current PORT date (16-bit word)*/ |
| 491 | 402 | ||
| 492 | #if ANOMALY_05000311 || ANOMALY_05000323 | ||
| 493 | #define SET_GPIO_P(name) \ | 403 | #define SET_GPIO_P(name) \ |
| 494 | void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \ | 404 | void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \ |
| 495 | { \ | 405 | { \ |
| 496 | unsigned long flags; \ | 406 | unsigned long flags; \ |
| 497 | local_irq_save_hw(flags); \ | 407 | if (ANOMALY_05000311 || ANOMALY_05000323) \ |
| 498 | gpio_bankb[gpio_bank(gpio)]->name = arg; \ | 408 | local_irq_save_hw(flags); \ |
| 499 | AWA_DUMMY_READ(name); \ | 409 | gpio_array[gpio_bank(gpio)]->name = arg; \ |
| 500 | local_irq_restore_hw(flags); \ | 410 | if (ANOMALY_05000311 || ANOMALY_05000323) { \ |
| 411 | AWA_DUMMY_READ(name); \ | ||
| 412 | local_irq_restore_hw(flags); \ | ||
| 413 | } \ | ||
| 501 | } \ | 414 | } \ |
| 502 | EXPORT_SYMBOL(set_gpiop_ ## name); | 415 | EXPORT_SYMBOL(set_gpiop_ ## name); |
| 503 | #else | ||
| 504 | #define SET_GPIO_P(name) \ | ||
| 505 | void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \ | ||
| 506 | { \ | ||
| 507 | gpio_bankb[gpio_bank(gpio)]->name = arg; \ | ||
| 508 | } \ | ||
| 509 | EXPORT_SYMBOL(set_gpiop_ ## name); | ||
| 510 | #endif | ||
| 511 | 416 | ||
| 512 | SET_GPIO_P(data) | 417 | SET_GPIO_P(data) |
| 513 | SET_GPIO_P(dir) | 418 | SET_GPIO_P(dir) |
| @@ -519,27 +424,21 @@ SET_GPIO_P(maska) | |||
| 519 | SET_GPIO_P(maskb) | 424 | SET_GPIO_P(maskb) |
| 520 | 425 | ||
| 521 | /* Get a specific bit */ | 426 | /* Get a specific bit */ |
| 522 | #if ANOMALY_05000311 || ANOMALY_05000323 | ||
| 523 | #define GET_GPIO(name) \ | 427 | #define GET_GPIO(name) \ |
| 524 | unsigned short get_gpio_ ## name(unsigned gpio) \ | 428 | unsigned short get_gpio_ ## name(unsigned gpio) \ |
| 525 | { \ | 429 | { \ |
| 526 | unsigned long flags; \ | 430 | unsigned long flags; \ |
| 527 | unsigned short ret; \ | 431 | unsigned short ret; \ |
| 528 | local_irq_save_hw(flags); \ | 432 | if (ANOMALY_05000311 || ANOMALY_05000323) \ |
| 529 | ret = 0x01 & (gpio_bankb[gpio_bank(gpio)]->name >> gpio_sub_n(gpio)); \ | 433 | local_irq_save_hw(flags); \ |
| 530 | AWA_DUMMY_READ(name); \ | 434 | ret = 0x01 & (gpio_array[gpio_bank(gpio)]->name >> gpio_sub_n(gpio)); \ |
| 531 | local_irq_restore_hw(flags); \ | 435 | if (ANOMALY_05000311 || ANOMALY_05000323) { \ |
| 436 | AWA_DUMMY_READ(name); \ | ||
| 437 | local_irq_restore_hw(flags); \ | ||
| 438 | } \ | ||
| 532 | return ret; \ | 439 | return ret; \ |
| 533 | } \ | 440 | } \ |
| 534 | EXPORT_SYMBOL(get_gpio_ ## name); | 441 | EXPORT_SYMBOL(get_gpio_ ## name); |
| 535 | #else | ||
| 536 | #define GET_GPIO(name) \ | ||
| 537 | unsigned short get_gpio_ ## name(unsigned gpio) \ | ||
| 538 | { \ | ||
| 539 | return (0x01 & (gpio_bankb[gpio_bank(gpio)]->name >> gpio_sub_n(gpio))); \ | ||
| 540 | } \ | ||
| 541 | EXPORT_SYMBOL(get_gpio_ ## name); | ||
| 542 | #endif | ||
| 543 | 442 | ||
| 544 | GET_GPIO(data) | 443 | GET_GPIO(data) |
| 545 | GET_GPIO(dir) | 444 | GET_GPIO(dir) |
| @@ -552,27 +451,21 @@ GET_GPIO(maskb) | |||
| 552 | 451 | ||
| 553 | /*Get current PORT date (16-bit word)*/ | 452 | /*Get current PORT date (16-bit word)*/ |
| 554 | 453 | ||
| 555 | #if ANOMALY_05000311 || ANOMALY_05000323 | ||
| 556 | #define GET_GPIO_P(name) \ | 454 | #define GET_GPIO_P(name) \ |
| 557 | unsigned short get_gpiop_ ## name(unsigned gpio) \ | 455 | unsigned short get_gpiop_ ## name(unsigned gpio) \ |
| 558 | { \ | 456 | { \ |
| 559 | unsigned long flags; \ | 457 | unsigned long flags; \ |
| 560 | unsigned short ret; \ | 458 | unsigned short ret; \ |
| 561 | local_irq_save_hw(flags); \ | 459 | if (ANOMALY_05000311 || ANOMALY_05000323) \ |
| 562 | ret = (gpio_bankb[gpio_bank(gpio)]->name); \ | 460 | local_irq_save_hw(flags); \ |
| 563 | AWA_DUMMY_READ(name); \ | 461 | ret = (gpio_array[gpio_bank(gpio)]->name); \ |
| 564 | local_irq_restore_hw(flags); \ | 462 | if (ANOMALY_05000311 || ANOMALY_05000323) { \ |
| 463 | AWA_DUMMY_READ(name); \ | ||
| 464 | local_irq_restore_hw(flags); \ | ||
| 465 | } \ | ||
| 565 | return ret; \ | 466 | return ret; \ |
| 566 | } \ | 467 | } \ |
| 567 | EXPORT_SYMBOL(get_gpiop_ ## name); | 468 | EXPORT_SYMBOL(get_gpiop_ ## name); |
| 568 | #else | ||
| 569 | #define GET_GPIO_P(name) \ | ||
| 570 | unsigned short get_gpiop_ ## name(unsigned gpio) \ | ||
| 571 | { \ | ||
| 572 | return (gpio_bankb[gpio_bank(gpio)]->name);\ | ||
| 573 | } \ | ||
| 574 | EXPORT_SYMBOL(get_gpiop_ ## name); | ||
| 575 | #endif | ||
| 576 | 469 | ||
| 577 | GET_GPIO_P(data) | 470 | GET_GPIO_P(data) |
| 578 | GET_GPIO_P(dir) | 471 | GET_GPIO_P(dir) |
| @@ -585,6 +478,26 @@ GET_GPIO_P(maskb) | |||
| 585 | 478 | ||
| 586 | 479 | ||
| 587 | #ifdef CONFIG_PM | 480 | #ifdef CONFIG_PM |
| 481 | |||
| 482 | static unsigned short wakeup_map[GPIO_BANK_NUM]; | ||
| 483 | static unsigned char wakeup_flags_map[MAX_BLACKFIN_GPIOS]; | ||
| 484 | |||
| 485 | static const unsigned int sic_iwr_irqs[] = { | ||
| 486 | #if defined(BF533_FAMILY) | ||
| 487 | IRQ_PROG_INTB | ||
| 488 | #elif defined(BF537_FAMILY) | ||
| 489 | IRQ_PROG_INTB, IRQ_PORTG_INTB, IRQ_MAC_TX | ||
| 490 | #elif defined(BF538_FAMILY) | ||
| 491 | IRQ_PORTF_INTB | ||
| 492 | #elif defined(BF527_FAMILY) || defined(BF518_FAMILY) | ||
| 493 | IRQ_PORTF_INTB, IRQ_PORTG_INTB, IRQ_PORTH_INTB | ||
| 494 | #elif defined(BF561_FAMILY) | ||
| 495 | IRQ_PROG0_INTB, IRQ_PROG1_INTB, IRQ_PROG2_INTB | ||
| 496 | #else | ||
| 497 | # error no SIC_IWR defined | ||
| 498 | #endif | ||
| 499 | }; | ||
| 500 | |||
| 588 | /*********************************************************** | 501 | /*********************************************************** |
| 589 | * | 502 | * |
| 590 | * FUNCTIONS: Blackfin PM Setup API | 503 | * FUNCTIONS: Blackfin PM Setup API |
| @@ -669,18 +582,18 @@ u32 bfin_pm_standby_setup(void) | |||
| 669 | mask = wakeup_map[gpio_bank(i)]; | 582 | mask = wakeup_map[gpio_bank(i)]; |
| 670 | bank = gpio_bank(i); | 583 | bank = gpio_bank(i); |
| 671 | 584 | ||
| 672 | gpio_bank_saved[bank].maskb = gpio_bankb[bank]->maskb; | 585 | gpio_bank_saved[bank].maskb = gpio_array[bank]->maskb; |
| 673 | gpio_bankb[bank]->maskb = 0; | 586 | gpio_array[bank]->maskb = 0; |
| 674 | 587 | ||
| 675 | if (mask) { | 588 | if (mask) { |
| 676 | #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY) | 589 | #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY) |
| 677 | gpio_bank_saved[bank].fer = *port_fer[bank]; | 590 | gpio_bank_saved[bank].fer = *port_fer[bank]; |
| 678 | #endif | 591 | #endif |
| 679 | gpio_bank_saved[bank].inen = gpio_bankb[bank]->inen; | 592 | gpio_bank_saved[bank].inen = gpio_array[bank]->inen; |
| 680 | gpio_bank_saved[bank].polar = gpio_bankb[bank]->polar; | 593 | gpio_bank_saved[bank].polar = gpio_array[bank]->polar; |
| 681 | gpio_bank_saved[bank].dir = gpio_bankb[bank]->dir; | 594 | gpio_bank_saved[bank].dir = gpio_array[bank]->dir; |
| 682 | gpio_bank_saved[bank].edge = gpio_bankb[bank]->edge; | 595 | gpio_bank_saved[bank].edge = gpio_array[bank]->edge; |
| 683 | gpio_bank_saved[bank].both = gpio_bankb[bank]->both; | 596 | gpio_bank_saved[bank].both = gpio_array[bank]->both; |
| 684 | gpio_bank_saved[bank].reserved = | 597 | gpio_bank_saved[bank].reserved = |
| 685 | reserved_gpio_map[bank]; | 598 | reserved_gpio_map[bank]; |
| 686 | 599 | ||
| @@ -700,7 +613,7 @@ u32 bfin_pm_standby_setup(void) | |||
| 700 | } | 613 | } |
| 701 | 614 | ||
| 702 | bfin_internal_set_wake(sic_iwr_irqs[bank], 1); | 615 | bfin_internal_set_wake(sic_iwr_irqs[bank], 1); |
| 703 | gpio_bankb[bank]->maskb_set = wakeup_map[gpio_bank(i)]; | 616 | gpio_array[bank]->maskb_set = wakeup_map[gpio_bank(i)]; |
| 704 | } | 617 | } |
| 705 | } | 618 | } |
| 706 | 619 | ||
| @@ -721,18 +634,18 @@ void bfin_pm_standby_restore(void) | |||
| 721 | #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY) | 634 | #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY) |
| 722 | *port_fer[bank] = gpio_bank_saved[bank].fer; | 635 | *port_fer[bank] = gpio_bank_saved[bank].fer; |
| 723 | #endif | 636 | #endif |
| 724 | gpio_bankb[bank]->inen = gpio_bank_saved[bank].inen; | 637 | gpio_array[bank]->inen = gpio_bank_saved[bank].inen; |
| 725 | gpio_bankb[bank]->dir = gpio_bank_saved[bank].dir; | 638 | gpio_array[bank]->dir = gpio_bank_saved[bank].dir; |
| 726 | gpio_bankb[bank]->polar = gpio_bank_saved[bank].polar; | 639 | gpio_array[bank]->polar = gpio_bank_saved[bank].polar; |
| 727 | gpio_bankb[bank]->edge = gpio_bank_saved[bank].edge; | 640 | gpio_array[bank]->edge = gpio_bank_saved[bank].edge; |
| 728 | gpio_bankb[bank]->both = gpio_bank_saved[bank].both; | 641 | gpio_array[bank]->both = gpio_bank_saved[bank].both; |
| 729 | 642 | ||
| 730 | reserved_gpio_map[bank] = | 643 | reserved_gpio_map[bank] = |
| 731 | gpio_bank_saved[bank].reserved; | 644 | gpio_bank_saved[bank].reserved; |
| 732 | bfin_internal_set_wake(sic_iwr_irqs[bank], 0); | 645 | bfin_internal_set_wake(sic_iwr_irqs[bank], 0); |
| 733 | } | 646 | } |
| 734 | 647 | ||
| 735 | gpio_bankb[bank]->maskb = gpio_bank_saved[bank].maskb; | 648 | gpio_array[bank]->maskb = gpio_bank_saved[bank].maskb; |
| 736 | } | 649 | } |
| 737 | AWA_DUMMY_READ(maskb); | 650 | AWA_DUMMY_READ(maskb); |
| 738 | } | 651 | } |
| @@ -745,21 +658,21 @@ void bfin_gpio_pm_hibernate_suspend(void) | |||
| 745 | bank = gpio_bank(i); | 658 | bank = gpio_bank(i); |
| 746 | 659 | ||
| 747 | #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY) | 660 | #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY) |
| 748 | gpio_bank_saved[bank].fer = *port_fer[bank]; | 661 | gpio_bank_saved[bank].fer = *port_fer[bank]; |
| 749 | #if defined(BF527_FAMILY) || defined(BF518_FAMILY) | 662 | #if defined(BF527_FAMILY) || defined(BF518_FAMILY) |
| 750 | gpio_bank_saved[bank].mux = *port_mux[bank]; | 663 | gpio_bank_saved[bank].mux = *port_mux[bank]; |
| 751 | #else | 664 | #else |
| 752 | if (bank == 0) | 665 | if (bank == 0) |
| 753 | gpio_bank_saved[bank].mux = bfin_read_PORT_MUX(); | 666 | gpio_bank_saved[bank].mux = bfin_read_PORT_MUX(); |
| 754 | #endif | 667 | #endif |
| 755 | #endif | 668 | #endif |
| 756 | gpio_bank_saved[bank].data = gpio_bankb[bank]->data; | 669 | gpio_bank_saved[bank].data = gpio_array[bank]->data; |
| 757 | gpio_bank_saved[bank].inen = gpio_bankb[bank]->inen; | 670 | gpio_bank_saved[bank].inen = gpio_array[bank]->inen; |
| 758 | gpio_bank_saved[bank].polar = gpio_bankb[bank]->polar; | 671 | gpio_bank_saved[bank].polar = gpio_array[bank]->polar; |
| 759 | gpio_bank_saved[bank].dir = gpio_bankb[bank]->dir; | 672 | gpio_bank_saved[bank].dir = gpio_array[bank]->dir; |
| 760 | gpio_bank_saved[bank].edge = gpio_bankb[bank]->edge; | 673 | gpio_bank_saved[bank].edge = gpio_array[bank]->edge; |
| 761 | gpio_bank_saved[bank].both = gpio_bankb[bank]->both; | 674 | gpio_bank_saved[bank].both = gpio_array[bank]->both; |
| 762 | gpio_bank_saved[bank].maska = gpio_bankb[bank]->maska; | 675 | gpio_bank_saved[bank].maska = gpio_array[bank]->maska; |
| 763 | } | 676 | } |
| 764 | 677 | ||
| 765 | AWA_DUMMY_READ(maska); | 678 | AWA_DUMMY_READ(maska); |
| @@ -770,27 +683,27 @@ void bfin_gpio_pm_hibernate_restore(void) | |||
| 770 | int i, bank; | 683 | int i, bank; |
| 771 | 684 | ||
| 772 | for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { | 685 | for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { |
| 773 | bank = gpio_bank(i); | 686 | bank = gpio_bank(i); |
| 774 | 687 | ||
| 775 | #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY) | 688 | #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY) |
| 776 | #if defined(BF527_FAMILY) || defined(BF518_FAMILY) | 689 | #if defined(BF527_FAMILY) || defined(BF518_FAMILY) |
| 777 | *port_mux[bank] = gpio_bank_saved[bank].mux; | 690 | *port_mux[bank] = gpio_bank_saved[bank].mux; |
| 778 | #else | 691 | #else |
| 779 | if (bank == 0) | 692 | if (bank == 0) |
| 780 | bfin_write_PORT_MUX(gpio_bank_saved[bank].mux); | 693 | bfin_write_PORT_MUX(gpio_bank_saved[bank].mux); |
| 781 | #endif | 694 | #endif |
| 782 | *port_fer[bank] = gpio_bank_saved[bank].fer; | 695 | *port_fer[bank] = gpio_bank_saved[bank].fer; |
| 783 | #endif | 696 | #endif |
| 784 | gpio_bankb[bank]->inen = gpio_bank_saved[bank].inen; | 697 | gpio_array[bank]->inen = gpio_bank_saved[bank].inen; |
| 785 | gpio_bankb[bank]->dir = gpio_bank_saved[bank].dir; | 698 | gpio_array[bank]->dir = gpio_bank_saved[bank].dir; |
| 786 | gpio_bankb[bank]->polar = gpio_bank_saved[bank].polar; | 699 | gpio_array[bank]->polar = gpio_bank_saved[bank].polar; |
| 787 | gpio_bankb[bank]->edge = gpio_bank_saved[bank].edge; | 700 | gpio_array[bank]->edge = gpio_bank_saved[bank].edge; |
| 788 | gpio_bankb[bank]->both = gpio_bank_saved[bank].both; | 701 | gpio_array[bank]->both = gpio_bank_saved[bank].both; |
| 789 | 702 | ||
| 790 | gpio_bankb[bank]->data_set = gpio_bank_saved[bank].data | 703 | gpio_array[bank]->data_set = gpio_bank_saved[bank].data |
| 791 | | gpio_bank_saved[bank].dir; | 704 | | gpio_bank_saved[bank].dir; |
| 792 | 705 | ||
| 793 | gpio_bankb[bank]->maska = gpio_bank_saved[bank].maska; | 706 | gpio_array[bank]->maska = gpio_bank_saved[bank].maska; |
| 794 | } | 707 | } |
| 795 | AWA_DUMMY_READ(maska); | 708 | AWA_DUMMY_READ(maska); |
| 796 | } | 709 | } |
| @@ -817,12 +730,12 @@ void bfin_gpio_pm_hibernate_suspend(void) | |||
| 817 | for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { | 730 | for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { |
| 818 | bank = gpio_bank(i); | 731 | bank = gpio_bank(i); |
| 819 | 732 | ||
| 820 | gpio_bank_saved[bank].fer = gpio_array[bank]->port_fer; | 733 | gpio_bank_saved[bank].fer = gpio_array[bank]->port_fer; |
| 821 | gpio_bank_saved[bank].mux = gpio_array[bank]->port_mux; | 734 | gpio_bank_saved[bank].mux = gpio_array[bank]->port_mux; |
| 822 | gpio_bank_saved[bank].data = gpio_array[bank]->port_data; | 735 | gpio_bank_saved[bank].data = gpio_array[bank]->data; |
| 823 | gpio_bank_saved[bank].data = gpio_array[bank]->port_data; | 736 | gpio_bank_saved[bank].data = gpio_array[bank]->data; |
| 824 | gpio_bank_saved[bank].inen = gpio_array[bank]->port_inen; | 737 | gpio_bank_saved[bank].inen = gpio_array[bank]->inen; |
| 825 | gpio_bank_saved[bank].dir = gpio_array[bank]->port_dir_set; | 738 | gpio_bank_saved[bank].dir = gpio_array[bank]->dir_set; |
| 826 | } | 739 | } |
| 827 | } | 740 | } |
| 828 | 741 | ||
| @@ -831,21 +744,21 @@ void bfin_gpio_pm_hibernate_restore(void) | |||
| 831 | int i, bank; | 744 | int i, bank; |
| 832 | 745 | ||
| 833 | for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { | 746 | for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { |
| 834 | bank = gpio_bank(i); | 747 | bank = gpio_bank(i); |
| 835 | 748 | ||
| 836 | gpio_array[bank]->port_mux = gpio_bank_saved[bank].mux; | 749 | gpio_array[bank]->port_mux = gpio_bank_saved[bank].mux; |
| 837 | gpio_array[bank]->port_fer = gpio_bank_saved[bank].fer; | 750 | gpio_array[bank]->port_fer = gpio_bank_saved[bank].fer; |
| 838 | gpio_array[bank]->port_inen = gpio_bank_saved[bank].inen; | 751 | gpio_array[bank]->inen = gpio_bank_saved[bank].inen; |
| 839 | gpio_array[bank]->port_dir_set = gpio_bank_saved[bank].dir; | 752 | gpio_array[bank]->dir_set = gpio_bank_saved[bank].dir; |
| 840 | gpio_array[bank]->port_set = gpio_bank_saved[bank].data | 753 | gpio_array[bank]->data_set = gpio_bank_saved[bank].data |
| 841 | | gpio_bank_saved[bank].dir; | 754 | | gpio_bank_saved[bank].dir; |
| 842 | } | 755 | } |
| 843 | } | 756 | } |
| 844 | #endif | 757 | #endif |
| 845 | 758 | ||
| 846 | unsigned short get_gpio_dir(unsigned gpio) | 759 | unsigned short get_gpio_dir(unsigned gpio) |
| 847 | { | 760 | { |
| 848 | return (0x01 & (gpio_array[gpio_bank(gpio)]->port_dir_clear >> gpio_sub_n(gpio))); | 761 | return (0x01 & (gpio_array[gpio_bank(gpio)]->dir_clear >> gpio_sub_n(gpio))); |
| 849 | } | 762 | } |
| 850 | EXPORT_SYMBOL(get_gpio_dir); | 763 | EXPORT_SYMBOL(get_gpio_dir); |
| 851 | 764 | ||
| @@ -905,9 +818,7 @@ int peripheral_request(unsigned short per, const char *label) | |||
| 905 | */ | 818 | */ |
| 906 | 819 | ||
| 907 | #ifdef BF548_FAMILY | 820 | #ifdef BF548_FAMILY |
| 908 | u16 funct = get_portmux(ident); | 821 | if (!((per & P_MAYSHARE) && get_portmux(per) == P_FUNCT2MUX(per))) { |
| 909 | |||
| 910 | if (!((per & P_MAYSHARE) && (funct == P_FUNCT2MUX(per)))) { | ||
| 911 | #else | 822 | #else |
| 912 | if (!(per & P_MAYSHARE)) { | 823 | if (!(per & P_MAYSHARE)) { |
| 913 | #endif | 824 | #endif |
| @@ -931,11 +842,7 @@ int peripheral_request(unsigned short per, const char *label) | |||
| 931 | anyway: | 842 | anyway: |
| 932 | reserved_peri_map[gpio_bank(ident)] |= gpio_bit(ident); | 843 | reserved_peri_map[gpio_bank(ident)] |= gpio_bit(ident); |
| 933 | 844 | ||
| 934 | #ifdef BF548_FAMILY | 845 | portmux_setup(per); |
| 935 | portmux_setup(ident, P_FUNCT2MUX(per)); | ||
| 936 | #else | ||
| 937 | portmux_setup(per, P_FUNCT2MUX(per)); | ||
| 938 | #endif | ||
| 939 | port_setup(ident, PERIPHERAL_USAGE); | 846 | port_setup(ident, PERIPHERAL_USAGE); |
| 940 | 847 | ||
| 941 | local_irq_restore_hw(flags); | 848 | local_irq_restore_hw(flags); |
| @@ -977,9 +884,6 @@ void peripheral_free(unsigned short per) | |||
| 977 | if (!(per & P_DEFINED)) | 884 | if (!(per & P_DEFINED)) |
| 978 | return; | 885 | return; |
| 979 | 886 | ||
| 980 | if (check_gpio(ident) < 0) | ||
| 981 | return; | ||
| 982 | |||
| 983 | local_irq_save_hw(flags); | 887 | local_irq_save_hw(flags); |
| 984 | 888 | ||
| 985 | if (unlikely(!(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident)))) { | 889 | if (unlikely(!(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident)))) { |
| @@ -1056,9 +960,15 @@ int bfin_gpio_request(unsigned gpio, const char *label) | |||
| 1056 | local_irq_restore_hw(flags); | 960 | local_irq_restore_hw(flags); |
| 1057 | return -EBUSY; | 961 | return -EBUSY; |
| 1058 | } | 962 | } |
| 1059 | if (unlikely(reserved_gpio_irq_map[gpio_bank(gpio)] & gpio_bit(gpio))) | 963 | if (unlikely(reserved_gpio_irq_map[gpio_bank(gpio)] & gpio_bit(gpio))) { |
| 1060 | printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved as gpio-irq!" | 964 | printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved as gpio-irq!" |
| 1061 | " (Documentation/blackfin/bfin-gpio-notes.txt)\n", gpio); | 965 | " (Documentation/blackfin/bfin-gpio-notes.txt)\n", gpio); |
| 966 | } | ||
| 967 | #ifndef BF548_FAMILY | ||
| 968 | else { /* Reset POLAR setting when acquiring a gpio for the first time */ | ||
| 969 | set_gpio_polar(gpio, 0); | ||
| 970 | } | ||
| 971 | #endif | ||
| 1062 | 972 | ||
| 1063 | reserved_gpio_map[gpio_bank(gpio)] |= gpio_bit(gpio); | 973 | reserved_gpio_map[gpio_bank(gpio)] |= gpio_bit(gpio); |
| 1064 | set_label(gpio, label); | 974 | set_label(gpio, label); |
| @@ -1078,6 +988,8 @@ void bfin_gpio_free(unsigned gpio) | |||
| 1078 | if (check_gpio(gpio) < 0) | 988 | if (check_gpio(gpio) < 0) |
| 1079 | return; | 989 | return; |
| 1080 | 990 | ||
| 991 | might_sleep(); | ||
| 992 | |||
| 1081 | local_irq_save_hw(flags); | 993 | local_irq_save_hw(flags); |
| 1082 | 994 | ||
| 1083 | if (unlikely(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio)))) { | 995 | if (unlikely(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio)))) { |
| @@ -1158,8 +1070,16 @@ void bfin_gpio_irq_free(unsigned gpio) | |||
| 1158 | local_irq_restore_hw(flags); | 1070 | local_irq_restore_hw(flags); |
| 1159 | } | 1071 | } |
| 1160 | 1072 | ||
| 1161 | 1073 | static inline void __bfin_gpio_direction_input(unsigned gpio) | |
| 1074 | { | ||
| 1162 | #ifdef BF548_FAMILY | 1075 | #ifdef BF548_FAMILY |
| 1076 | gpio_array[gpio_bank(gpio)]->dir_clear = gpio_bit(gpio); | ||
| 1077 | #else | ||
| 1078 | gpio_array[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio); | ||
| 1079 | #endif | ||
| 1080 | gpio_array[gpio_bank(gpio)]->inen |= gpio_bit(gpio); | ||
| 1081 | } | ||
| 1082 | |||
| 1163 | int bfin_gpio_direction_input(unsigned gpio) | 1083 | int bfin_gpio_direction_input(unsigned gpio) |
| 1164 | { | 1084 | { |
| 1165 | unsigned long flags; | 1085 | unsigned long flags; |
| @@ -1170,125 +1090,85 @@ int bfin_gpio_direction_input(unsigned gpio) | |||
| 1170 | } | 1090 | } |
| 1171 | 1091 | ||
| 1172 | local_irq_save_hw(flags); | 1092 | local_irq_save_hw(flags); |
| 1173 | gpio_array[gpio_bank(gpio)]->port_dir_clear = gpio_bit(gpio); | 1093 | __bfin_gpio_direction_input(gpio); |
| 1174 | gpio_array[gpio_bank(gpio)]->port_inen |= gpio_bit(gpio); | 1094 | AWA_DUMMY_READ(inen); |
| 1175 | local_irq_restore_hw(flags); | 1095 | local_irq_restore_hw(flags); |
| 1176 | 1096 | ||
| 1177 | return 0; | 1097 | return 0; |
| 1178 | } | 1098 | } |
| 1179 | EXPORT_SYMBOL(bfin_gpio_direction_input); | 1099 | EXPORT_SYMBOL(bfin_gpio_direction_input); |
| 1180 | 1100 | ||
| 1181 | int bfin_gpio_direction_output(unsigned gpio, int value) | 1101 | void bfin_gpio_irq_prepare(unsigned gpio) |
| 1182 | { | 1102 | { |
| 1103 | #ifdef BF548_FAMILY | ||
| 1183 | unsigned long flags; | 1104 | unsigned long flags; |
| 1105 | #endif | ||
| 1184 | 1106 | ||
| 1185 | if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) { | 1107 | port_setup(gpio, GPIO_USAGE); |
| 1186 | gpio_error(gpio); | ||
| 1187 | return -EINVAL; | ||
| 1188 | } | ||
| 1189 | 1108 | ||
| 1109 | #ifdef BF548_FAMILY | ||
| 1190 | local_irq_save_hw(flags); | 1110 | local_irq_save_hw(flags); |
| 1191 | gpio_array[gpio_bank(gpio)]->port_inen &= ~gpio_bit(gpio); | 1111 | __bfin_gpio_direction_input(gpio); |
| 1192 | gpio_set_value(gpio, value); | ||
| 1193 | gpio_array[gpio_bank(gpio)]->port_dir_set = gpio_bit(gpio); | ||
| 1194 | local_irq_restore_hw(flags); | 1112 | local_irq_restore_hw(flags); |
| 1195 | 1113 | #endif | |
| 1196 | return 0; | ||
| 1197 | } | 1114 | } |
| 1198 | EXPORT_SYMBOL(bfin_gpio_direction_output); | ||
| 1199 | 1115 | ||
| 1200 | void bfin_gpio_set_value(unsigned gpio, int arg) | 1116 | void bfin_gpio_set_value(unsigned gpio, int arg) |
| 1201 | { | 1117 | { |
| 1202 | if (arg) | 1118 | if (arg) |
| 1203 | gpio_array[gpio_bank(gpio)]->port_set = gpio_bit(gpio); | 1119 | gpio_array[gpio_bank(gpio)]->data_set = gpio_bit(gpio); |
| 1204 | else | 1120 | else |
| 1205 | gpio_array[gpio_bank(gpio)]->port_clear = gpio_bit(gpio); | 1121 | gpio_array[gpio_bank(gpio)]->data_clear = gpio_bit(gpio); |
| 1206 | } | 1122 | } |
| 1207 | EXPORT_SYMBOL(bfin_gpio_set_value); | 1123 | EXPORT_SYMBOL(bfin_gpio_set_value); |
| 1208 | 1124 | ||
| 1209 | int bfin_gpio_get_value(unsigned gpio) | 1125 | int bfin_gpio_direction_output(unsigned gpio, int value) |
| 1210 | { | ||
| 1211 | return (1 & (gpio_array[gpio_bank(gpio)]->port_data >> gpio_sub_n(gpio))); | ||
| 1212 | } | ||
| 1213 | EXPORT_SYMBOL(bfin_gpio_get_value); | ||
| 1214 | |||
| 1215 | void bfin_gpio_irq_prepare(unsigned gpio) | ||
| 1216 | { | 1126 | { |
| 1217 | unsigned long flags; | 1127 | unsigned long flags; |
| 1218 | 1128 | ||
| 1219 | port_setup(gpio, GPIO_USAGE); | 1129 | if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) { |
| 1130 | gpio_error(gpio); | ||
| 1131 | return -EINVAL; | ||
| 1132 | } | ||
| 1220 | 1133 | ||
| 1221 | local_irq_save_hw(flags); | 1134 | local_irq_save_hw(flags); |
| 1222 | gpio_array[gpio_bank(gpio)]->port_dir_clear = gpio_bit(gpio); | ||
| 1223 | gpio_array[gpio_bank(gpio)]->port_inen |= gpio_bit(gpio); | ||
| 1224 | local_irq_restore_hw(flags); | ||
| 1225 | } | ||
| 1226 | 1135 | ||
| 1136 | gpio_array[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio); | ||
| 1137 | gpio_set_value(gpio, value); | ||
| 1138 | #ifdef BF548_FAMILY | ||
| 1139 | gpio_array[gpio_bank(gpio)]->dir_set = gpio_bit(gpio); | ||
| 1227 | #else | 1140 | #else |
| 1141 | gpio_array[gpio_bank(gpio)]->dir |= gpio_bit(gpio); | ||
| 1142 | #endif | ||
| 1143 | |||
| 1144 | AWA_DUMMY_READ(dir); | ||
| 1145 | local_irq_restore_hw(flags); | ||
| 1146 | |||
| 1147 | return 0; | ||
| 1148 | } | ||
| 1149 | EXPORT_SYMBOL(bfin_gpio_direction_output); | ||
| 1228 | 1150 | ||
| 1229 | int bfin_gpio_get_value(unsigned gpio) | 1151 | int bfin_gpio_get_value(unsigned gpio) |
| 1230 | { | 1152 | { |
| 1153 | #ifdef BF548_FAMILY | ||
| 1154 | return (1 & (gpio_array[gpio_bank(gpio)]->data >> gpio_sub_n(gpio))); | ||
| 1155 | #else | ||
| 1231 | unsigned long flags; | 1156 | unsigned long flags; |
| 1232 | int ret; | ||
| 1233 | 1157 | ||
| 1234 | if (unlikely(get_gpio_edge(gpio))) { | 1158 | if (unlikely(get_gpio_edge(gpio))) { |
| 1159 | int ret; | ||
| 1235 | local_irq_save_hw(flags); | 1160 | local_irq_save_hw(flags); |
| 1236 | set_gpio_edge(gpio, 0); | 1161 | set_gpio_edge(gpio, 0); |
| 1237 | ret = get_gpio_data(gpio); | 1162 | ret = get_gpio_data(gpio); |
| 1238 | set_gpio_edge(gpio, 1); | 1163 | set_gpio_edge(gpio, 1); |
| 1239 | local_irq_restore_hw(flags); | 1164 | local_irq_restore_hw(flags); |
| 1240 | |||
| 1241 | return ret; | 1165 | return ret; |
| 1242 | } else | 1166 | } else |
| 1243 | return get_gpio_data(gpio); | 1167 | return get_gpio_data(gpio); |
| 1168 | #endif | ||
| 1244 | } | 1169 | } |
| 1245 | EXPORT_SYMBOL(bfin_gpio_get_value); | 1170 | EXPORT_SYMBOL(bfin_gpio_get_value); |
| 1246 | 1171 | ||
| 1247 | |||
| 1248 | int bfin_gpio_direction_input(unsigned gpio) | ||
| 1249 | { | ||
| 1250 | unsigned long flags; | ||
| 1251 | |||
| 1252 | if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) { | ||
| 1253 | gpio_error(gpio); | ||
| 1254 | return -EINVAL; | ||
| 1255 | } | ||
| 1256 | |||
| 1257 | local_irq_save_hw(flags); | ||
| 1258 | gpio_bankb[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio); | ||
| 1259 | gpio_bankb[gpio_bank(gpio)]->inen |= gpio_bit(gpio); | ||
| 1260 | AWA_DUMMY_READ(inen); | ||
| 1261 | local_irq_restore_hw(flags); | ||
| 1262 | |||
| 1263 | return 0; | ||
| 1264 | } | ||
| 1265 | EXPORT_SYMBOL(bfin_gpio_direction_input); | ||
| 1266 | |||
| 1267 | int bfin_gpio_direction_output(unsigned gpio, int value) | ||
| 1268 | { | ||
| 1269 | unsigned long flags; | ||
| 1270 | |||
| 1271 | if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) { | ||
| 1272 | gpio_error(gpio); | ||
| 1273 | return -EINVAL; | ||
| 1274 | } | ||
| 1275 | |||
| 1276 | local_irq_save_hw(flags); | ||
| 1277 | gpio_bankb[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio); | ||
| 1278 | |||
| 1279 | if (value) | ||
| 1280 | gpio_bankb[gpio_bank(gpio)]->data_set = gpio_bit(gpio); | ||
| 1281 | else | ||
| 1282 | gpio_bankb[gpio_bank(gpio)]->data_clear = gpio_bit(gpio); | ||
| 1283 | |||
| 1284 | gpio_bankb[gpio_bank(gpio)]->dir |= gpio_bit(gpio); | ||
| 1285 | AWA_DUMMY_READ(dir); | ||
| 1286 | local_irq_restore_hw(flags); | ||
| 1287 | |||
| 1288 | return 0; | ||
| 1289 | } | ||
| 1290 | EXPORT_SYMBOL(bfin_gpio_direction_output); | ||
| 1291 | |||
| 1292 | /* If we are booting from SPI and our board lacks a strong enough pull up, | 1172 | /* If we are booting from SPI and our board lacks a strong enough pull up, |
| 1293 | * the core can reset and execute the bootrom faster than the resistor can | 1173 | * the core can reset and execute the bootrom faster than the resistor can |
| 1294 | * pull the signal logically high. To work around this (common) error in | 1174 | * pull the signal logically high. To work around this (common) error in |
| @@ -1299,23 +1179,15 @@ EXPORT_SYMBOL(bfin_gpio_direction_output); | |||
| 1299 | * lives here as we need to force all the GPIO states w/out going through | 1179 | * lives here as we need to force all the GPIO states w/out going through |
| 1300 | * BUG() checks and such. | 1180 | * BUG() checks and such. |
| 1301 | */ | 1181 | */ |
| 1302 | void bfin_gpio_reset_spi0_ssel1(void) | 1182 | void bfin_reset_boot_spi_cs(unsigned short pin) |
| 1303 | { | 1183 | { |
| 1304 | u16 gpio = P_IDENT(P_SPI0_SSEL1); | 1184 | unsigned short gpio = P_IDENT(pin); |
| 1305 | |||
| 1306 | port_setup(gpio, GPIO_USAGE); | 1185 | port_setup(gpio, GPIO_USAGE); |
| 1307 | gpio_bankb[gpio_bank(gpio)]->data_set = gpio_bit(gpio); | 1186 | gpio_array[gpio_bank(gpio)]->data_set = gpio_bit(gpio); |
| 1308 | AWA_DUMMY_READ(data_set); | 1187 | AWA_DUMMY_READ(data_set); |
| 1309 | udelay(1); | 1188 | udelay(1); |
| 1310 | } | 1189 | } |
| 1311 | 1190 | ||
| 1312 | void bfin_gpio_irq_prepare(unsigned gpio) | ||
| 1313 | { | ||
| 1314 | port_setup(gpio, GPIO_USAGE); | ||
| 1315 | } | ||
| 1316 | |||
| 1317 | #endif /*BF548_FAMILY */ | ||
| 1318 | |||
| 1319 | #if defined(CONFIG_PROC_FS) | 1191 | #if defined(CONFIG_PROC_FS) |
| 1320 | static int gpio_proc_read(char *buf, char **start, off_t offset, | 1192 | static int gpio_proc_read(char *buf, char **start, off_t offset, |
| 1321 | int len, int *unused_i, void *unused_v) | 1193 | int len, int *unused_i, void *unused_v) |
| @@ -1369,11 +1241,7 @@ int bfin_gpiolib_get_value(struct gpio_chip *chip, unsigned gpio) | |||
| 1369 | 1241 | ||
| 1370 | void bfin_gpiolib_set_value(struct gpio_chip *chip, unsigned gpio, int value) | 1242 | void bfin_gpiolib_set_value(struct gpio_chip *chip, unsigned gpio, int value) |
| 1371 | { | 1243 | { |
| 1372 | #ifdef BF548_FAMILY | ||
| 1373 | return bfin_gpio_set_value(gpio, value); | 1244 | return bfin_gpio_set_value(gpio, value); |
| 1374 | #else | ||
| 1375 | return set_gpio_data(gpio, value); | ||
| 1376 | #endif | ||
| 1377 | } | 1245 | } |
| 1378 | 1246 | ||
| 1379 | int bfin_gpiolib_gpio_request(struct gpio_chip *chip, unsigned gpio) | 1247 | int bfin_gpiolib_gpio_request(struct gpio_chip *chip, unsigned gpio) |
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbinit.c b/arch/blackfin/kernel/cplb-mpu/cplbinit.c index bdb958486e76..3e329a6ce041 100644 --- a/arch/blackfin/kernel/cplb-mpu/cplbinit.c +++ b/arch/blackfin/kernel/cplb-mpu/cplbinit.c | |||
| @@ -63,10 +63,8 @@ void __init generate_cplb_tables_cpu(unsigned int cpu) | |||
| 63 | dcplb_tbl[cpu][i_d].addr = 0; | 63 | dcplb_tbl[cpu][i_d].addr = 0; |
| 64 | dcplb_tbl[cpu][i_d++].data = SDRAM_OOPS | PAGE_SIZE_1KB; | 64 | dcplb_tbl[cpu][i_d++].data = SDRAM_OOPS | PAGE_SIZE_1KB; |
| 65 | 65 | ||
| 66 | #if 0 | ||
| 67 | icplb_tbl[cpu][i_i].addr = 0; | 66 | icplb_tbl[cpu][i_i].addr = 0; |
| 68 | icplb_tbl[cpu][i_i++].data = i_cache | CPLB_USER_RD | PAGE_SIZE_4KB; | 67 | icplb_tbl[cpu][i_i++].data = i_cache | CPLB_USER_RD | PAGE_SIZE_1KB; |
| 69 | #endif | ||
| 70 | 68 | ||
| 71 | /* Cover kernel memory with 4M pages. */ | 69 | /* Cover kernel memory with 4M pages. */ |
| 72 | addr = 0; | 70 | addr = 0; |
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbmgr.c b/arch/blackfin/kernel/cplb-nompu/cplbmgr.c index 376249ab2694..8cbb47c7b663 100644 --- a/arch/blackfin/kernel/cplb-nompu/cplbmgr.c +++ b/arch/blackfin/kernel/cplb-nompu/cplbmgr.c | |||
| @@ -163,12 +163,14 @@ MGR_ATTR static int icplb_miss(int cpu) | |||
| 163 | nr_icplb_supv_miss[cpu]++; | 163 | nr_icplb_supv_miss[cpu]++; |
| 164 | 164 | ||
| 165 | base = 0; | 165 | base = 0; |
| 166 | for (idx = 0; idx < icplb_nr_bounds; idx++) { | 166 | idx = 0; |
| 167 | do { | ||
| 167 | eaddr = icplb_bounds[idx].eaddr; | 168 | eaddr = icplb_bounds[idx].eaddr; |
| 168 | if (addr < eaddr) | 169 | if (addr < eaddr) |
| 169 | break; | 170 | break; |
| 170 | base = eaddr; | 171 | base = eaddr; |
| 171 | } | 172 | } while (++idx < icplb_nr_bounds); |
| 173 | |||
| 172 | if (unlikely(idx == icplb_nr_bounds)) | 174 | if (unlikely(idx == icplb_nr_bounds)) |
| 173 | return CPLB_NO_ADDR_MATCH; | 175 | return CPLB_NO_ADDR_MATCH; |
| 174 | 176 | ||
| @@ -208,12 +210,14 @@ MGR_ATTR static int dcplb_miss(int cpu) | |||
| 208 | nr_dcplb_supv_miss[cpu]++; | 210 | nr_dcplb_supv_miss[cpu]++; |
| 209 | 211 | ||
| 210 | base = 0; | 212 | base = 0; |
| 211 | for (idx = 0; idx < dcplb_nr_bounds; idx++) { | 213 | idx = 0; |
| 214 | do { | ||
| 212 | eaddr = dcplb_bounds[idx].eaddr; | 215 | eaddr = dcplb_bounds[idx].eaddr; |
| 213 | if (addr < eaddr) | 216 | if (addr < eaddr) |
| 214 | break; | 217 | break; |
| 215 | base = eaddr; | 218 | base = eaddr; |
| 216 | } | 219 | } while (++idx < dcplb_nr_bounds); |
| 220 | |||
| 217 | if (unlikely(idx == dcplb_nr_bounds)) | 221 | if (unlikely(idx == dcplb_nr_bounds)) |
| 218 | return CPLB_NO_ADDR_MATCH; | 222 | return CPLB_NO_ADDR_MATCH; |
| 219 | 223 | ||
diff --git a/arch/blackfin/kernel/irqchip.c b/arch/blackfin/kernel/irqchip.c index ab8209cbbad0..75724eee6494 100644 --- a/arch/blackfin/kernel/irqchip.c +++ b/arch/blackfin/kernel/irqchip.c | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
| 36 | #include <linux/irq.h> | 36 | #include <linux/irq.h> |
| 37 | #include <asm/trace.h> | 37 | #include <asm/trace.h> |
| 38 | #include <asm/pda.h> | ||
| 38 | 39 | ||
| 39 | static atomic_t irq_err_count; | 40 | static atomic_t irq_err_count; |
| 40 | static spinlock_t irq_controller_lock; | 41 | static spinlock_t irq_controller_lock; |
| @@ -91,8 +92,13 @@ int show_interrupts(struct seq_file *p, void *v) | |||
| 91 | seq_putc(p, '\n'); | 92 | seq_putc(p, '\n'); |
| 92 | skip: | 93 | skip: |
| 93 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | 94 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); |
| 94 | } else if (i == NR_IRQS) | 95 | } else if (i == NR_IRQS) { |
| 96 | seq_printf(p, "NMI: "); | ||
| 97 | for_each_online_cpu(j) | ||
| 98 | seq_printf(p, "%10u ", cpu_pda[j].__nmi_count); | ||
| 99 | seq_printf(p, " CORE Non Maskable Interrupt\n"); | ||
| 95 | seq_printf(p, "Err: %10u\n", atomic_read(&irq_err_count)); | 100 | seq_printf(p, "Err: %10u\n", atomic_read(&irq_err_count)); |
| 101 | } | ||
| 96 | return 0; | 102 | return 0; |
| 97 | } | 103 | } |
| 98 | 104 | ||
diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c index eeee8cb43360..53d08dee8531 100644 --- a/arch/blackfin/kernel/reboot.c +++ b/arch/blackfin/kernel/reboot.c | |||
| @@ -20,8 +20,8 @@ | |||
| 20 | * reset while the Core B bit (on dual core parts) is cleared by | 20 | * reset while the Core B bit (on dual core parts) is cleared by |
| 21 | * the core reset. | 21 | * the core reset. |
| 22 | */ | 22 | */ |
| 23 | __attribute__((l1_text)) | 23 | __attribute__ ((__l1_text__, __noreturn__)) |
| 24 | static void _bfin_reset(void) | 24 | static void bfin_reset(void) |
| 25 | { | 25 | { |
| 26 | /* Wait for completion of "system" events such as cache line | 26 | /* Wait for completion of "system" events such as cache line |
| 27 | * line fills so that we avoid infinite stalls later on as | 27 | * line fills so that we avoid infinite stalls later on as |
| @@ -30,7 +30,11 @@ static void _bfin_reset(void) | |||
| 30 | */ | 30 | */ |
| 31 | __builtin_bfin_ssync(); | 31 | __builtin_bfin_ssync(); |
| 32 | 32 | ||
| 33 | while (1) { | 33 | /* The bootrom checks to see how it was reset and will |
| 34 | * automatically perform a software reset for us when | ||
| 35 | * it starts executing after the core reset. | ||
| 36 | */ | ||
| 37 | if (ANOMALY_05000353 || ANOMALY_05000386) { | ||
| 34 | /* Initiate System software reset. */ | 38 | /* Initiate System software reset. */ |
| 35 | bfin_write_SWRST(0x7); | 39 | bfin_write_SWRST(0x7); |
| 36 | 40 | ||
| @@ -50,6 +54,11 @@ static void _bfin_reset(void) | |||
| 50 | /* Clear System software reset */ | 54 | /* Clear System software reset */ |
| 51 | bfin_write_SWRST(0); | 55 | bfin_write_SWRST(0); |
| 52 | 56 | ||
| 57 | /* The BF526 ROM will crash during reset */ | ||
| 58 | #if defined(__ADSPBF522__) || defined(__ADSPBF524__) || defined(__ADSPBF526__) | ||
| 59 | bfin_read_SWRST(); | ||
| 60 | #endif | ||
| 61 | |||
| 53 | /* Wait for the SWRST write to complete. Cannot rely on SSYNC | 62 | /* Wait for the SWRST write to complete. Cannot rely on SSYNC |
| 54 | * though as the System state is all reset now. | 63 | * though as the System state is all reset now. |
| 55 | */ | 64 | */ |
| @@ -60,22 +69,11 @@ static void _bfin_reset(void) | |||
| 60 | : "a" (15 * 1) | 69 | : "a" (15 * 1) |
| 61 | : "LC1", "LB1", "LT1" | 70 | : "LC1", "LB1", "LT1" |
| 62 | ); | 71 | ); |
| 72 | } | ||
| 63 | 73 | ||
| 74 | while (1) | ||
| 64 | /* Issue core reset */ | 75 | /* Issue core reset */ |
| 65 | asm("raise 1"); | 76 | asm("raise 1"); |
| 66 | } | ||
| 67 | } | ||
| 68 | |||
| 69 | static void bfin_reset(void) | ||
| 70 | { | ||
| 71 | if (ANOMALY_05000353 || ANOMALY_05000386) | ||
| 72 | _bfin_reset(); | ||
| 73 | else | ||
| 74 | /* the bootrom checks to see how it was reset and will | ||
| 75 | * automatically perform a software reset for us when | ||
| 76 | * it starts executing boot | ||
| 77 | */ | ||
| 78 | asm("raise 1;"); | ||
| 79 | } | 77 | } |
| 80 | 78 | ||
| 81 | __attribute__((weak)) | 79 | __attribute__((weak)) |
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c index b2a811347b65..e5c116230800 100644 --- a/arch/blackfin/kernel/setup.c +++ b/arch/blackfin/kernel/setup.c | |||
| @@ -60,7 +60,7 @@ void __initdata *init_retx, *init_saved_retx, *init_saved_seqstat, | |||
| 60 | #define BFIN_MEMMAP_MAX 128 /* number of entries in bfin_memmap */ | 60 | #define BFIN_MEMMAP_MAX 128 /* number of entries in bfin_memmap */ |
| 61 | #define BFIN_MEMMAP_RAM 1 | 61 | #define BFIN_MEMMAP_RAM 1 |
| 62 | #define BFIN_MEMMAP_RESERVED 2 | 62 | #define BFIN_MEMMAP_RESERVED 2 |
| 63 | struct bfin_memmap { | 63 | static struct bfin_memmap { |
| 64 | int nr_map; | 64 | int nr_map; |
| 65 | struct bfin_memmap_entry { | 65 | struct bfin_memmap_entry { |
| 66 | unsigned long long addr; /* start of memory segment */ | 66 | unsigned long long addr; /* start of memory segment */ |
| @@ -824,7 +824,15 @@ void __init setup_arch(char **cmdline_p) | |||
| 824 | flash_probe(); | 824 | flash_probe(); |
| 825 | #endif | 825 | #endif |
| 826 | 826 | ||
| 827 | printk(KERN_INFO "Boot Mode: %i\n", bfin_read_SYSCR() & 0xF); | ||
| 828 | |||
| 829 | /* Newer parts mirror SWRST bits in SYSCR */ | ||
| 830 | #if defined(CONFIG_BF53x) || defined(CONFIG_BF561) || \ | ||
| 831 | defined(CONFIG_BF538) || defined(CONFIG_BF539) | ||
| 827 | _bfin_swrst = bfin_read_SWRST(); | 832 | _bfin_swrst = bfin_read_SWRST(); |
| 833 | #else | ||
| 834 | _bfin_swrst = bfin_read_SYSCR(); | ||
| 835 | #endif | ||
| 828 | 836 | ||
| 829 | #ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT | 837 | #ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT |
| 830 | bfin_write_SWRST(_bfin_swrst & ~DOUBLE_FAULT); | 838 | bfin_write_SWRST(_bfin_swrst & ~DOUBLE_FAULT); |
| @@ -853,7 +861,7 @@ void __init setup_arch(char **cmdline_p) | |||
| 853 | else if (_bfin_swrst & RESET_SOFTWARE) | 861 | else if (_bfin_swrst & RESET_SOFTWARE) |
| 854 | printk(KERN_NOTICE "Reset caused by Software reset\n"); | 862 | printk(KERN_NOTICE "Reset caused by Software reset\n"); |
| 855 | 863 | ||
| 856 | printk(KERN_INFO "Blackfin support (C) 2004-2008 Analog Devices, Inc.\n"); | 864 | printk(KERN_INFO "Blackfin support (C) 2004-2009 Analog Devices, Inc.\n"); |
| 857 | if (bfin_compiled_revid() == 0xffff) | 865 | if (bfin_compiled_revid() == 0xffff) |
| 858 | printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU); | 866 | printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU); |
| 859 | else if (bfin_compiled_revid() == -1) | 867 | else if (bfin_compiled_revid() == -1) |
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c index 5b0667da8d05..ffe7fb53eccb 100644 --- a/arch/blackfin/kernel/traps.c +++ b/arch/blackfin/kernel/traps.c | |||
| @@ -673,6 +673,14 @@ static void decode_instruction(unsigned short *address) | |||
| 673 | verbose_printk("RTI"); | 673 | verbose_printk("RTI"); |
| 674 | else if (opcode == 0x0012) | 674 | else if (opcode == 0x0012) |
| 675 | verbose_printk("RTX"); | 675 | verbose_printk("RTX"); |
| 676 | else if (opcode == 0x0013) | ||
| 677 | verbose_printk("RTN"); | ||
| 678 | else if (opcode == 0x0014) | ||
| 679 | verbose_printk("RTE"); | ||
| 680 | else if (opcode == 0x0025) | ||
| 681 | verbose_printk("EMUEXCPT"); | ||
| 682 | else if (opcode == 0x0040 && opcode <= 0x0047) | ||
| 683 | verbose_printk("STI R%i", opcode & 7); | ||
| 676 | else if (opcode >= 0x0050 && opcode <= 0x0057) | 684 | else if (opcode >= 0x0050 && opcode <= 0x0057) |
| 677 | verbose_printk("JUMP (P%i)", opcode & 7); | 685 | verbose_printk("JUMP (P%i)", opcode & 7); |
| 678 | else if (opcode >= 0x0060 && opcode <= 0x0067) | 686 | else if (opcode >= 0x0060 && opcode <= 0x0067) |
| @@ -681,6 +689,10 @@ static void decode_instruction(unsigned short *address) | |||
| 681 | verbose_printk("CALL (PC+P%i)", opcode & 7); | 689 | verbose_printk("CALL (PC+P%i)", opcode & 7); |
| 682 | else if (opcode >= 0x0080 && opcode <= 0x0087) | 690 | else if (opcode >= 0x0080 && opcode <= 0x0087) |
| 683 | verbose_printk("JUMP (PC+P%i)", opcode & 7); | 691 | verbose_printk("JUMP (PC+P%i)", opcode & 7); |
| 692 | else if (opcode >= 0x0090 && opcode <= 0x009F) | ||
| 693 | verbose_printk("RAISE 0x%x", opcode & 0xF); | ||
| 694 | else if (opcode >= 0x00A0 && opcode <= 0x00AF) | ||
| 695 | verbose_printk("EXCPT 0x%x", opcode & 0xF); | ||
| 684 | else if ((opcode >= 0x1000 && opcode <= 0x13FF) || (opcode >= 0x1800 && opcode <= 0x1BFF)) | 696 | else if ((opcode >= 0x1000 && opcode <= 0x13FF) || (opcode >= 0x1800 && opcode <= 0x1BFF)) |
| 685 | verbose_printk("IF !CC JUMP"); | 697 | verbose_printk("IF !CC JUMP"); |
| 686 | else if ((opcode >= 0x1400 && opcode <= 0x17ff) || (opcode >= 0x1c00 && opcode <= 0x1fff)) | 698 | else if ((opcode >= 0x1400 && opcode <= 0x17ff) || (opcode >= 0x1c00 && opcode <= 0x1fff)) |
| @@ -820,11 +832,8 @@ void show_stack(struct task_struct *task, unsigned long *stack) | |||
| 820 | decode_address(buf, (unsigned int)stack); | 832 | decode_address(buf, (unsigned int)stack); |
| 821 | printk(KERN_NOTICE " SP: [0x%p] %s\n", stack, buf); | 833 | printk(KERN_NOTICE " SP: [0x%p] %s\n", stack, buf); |
| 822 | 834 | ||
| 823 | addr = (unsigned int *)((unsigned int)stack & ~0x3F); | ||
| 824 | |||
| 825 | /* First thing is to look for a frame pointer */ | 835 | /* First thing is to look for a frame pointer */ |
| 826 | for (addr = (unsigned int *)((unsigned int)stack & ~0xF), i = 0; | 836 | for (addr = (unsigned int *)((unsigned int)stack & ~0xF); addr < endstack; addr++) { |
| 827 | addr < endstack; addr++, i++) { | ||
| 828 | if (*addr & 0x1) | 837 | if (*addr & 0x1) |
| 829 | continue; | 838 | continue; |
| 830 | ins_addr = (unsigned short *)*addr; | 839 | ins_addr = (unsigned short *)*addr; |
| @@ -834,7 +843,8 @@ void show_stack(struct task_struct *task, unsigned long *stack) | |||
| 834 | 843 | ||
| 835 | if (fp) { | 844 | if (fp) { |
| 836 | /* Let's check to see if it is a frame pointer */ | 845 | /* Let's check to see if it is a frame pointer */ |
| 837 | while (fp >= (addr - 1) && fp < endstack && fp) | 846 | while (fp >= (addr - 1) && fp < endstack |
| 847 | && fp && ((unsigned int) fp & 0x3) == 0) | ||
| 838 | fp = (unsigned int *)*fp; | 848 | fp = (unsigned int *)*fp; |
| 839 | if (fp == 0 || fp == endstack) { | 849 | if (fp == 0 || fp == endstack) { |
| 840 | fp = addr - 1; | 850 | fp = addr - 1; |
| @@ -1052,8 +1062,9 @@ void show_regs(struct pt_regs *fp) | |||
| 1052 | char buf [150]; | 1062 | char buf [150]; |
| 1053 | struct irqaction *action; | 1063 | struct irqaction *action; |
| 1054 | unsigned int i; | 1064 | unsigned int i; |
| 1055 | unsigned long flags; | 1065 | unsigned long flags = 0; |
| 1056 | unsigned int cpu = smp_processor_id(); | 1066 | unsigned int cpu = smp_processor_id(); |
| 1067 | unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic(); | ||
| 1057 | 1068 | ||
| 1058 | verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\t\t%s\n", print_tainted()); | 1069 | verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\t\t%s\n", print_tainted()); |
| 1059 | verbose_printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n", | 1070 | verbose_printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n", |
| @@ -1073,17 +1084,22 @@ void show_regs(struct pt_regs *fp) | |||
| 1073 | } | 1084 | } |
| 1074 | verbose_printk(KERN_NOTICE " EXCAUSE : 0x%lx\n", | 1085 | verbose_printk(KERN_NOTICE " EXCAUSE : 0x%lx\n", |
| 1075 | fp->seqstat & SEQSTAT_EXCAUSE); | 1086 | fp->seqstat & SEQSTAT_EXCAUSE); |
| 1076 | for (i = 6; i <= 15 ; i++) { | 1087 | for (i = 2; i <= 15 ; i++) { |
| 1077 | if (fp->ipend & (1 << i)) { | 1088 | if (fp->ipend & (1 << i)) { |
| 1078 | decode_address(buf, bfin_read32(EVT0 + 4*i)); | 1089 | if (i != 4) { |
| 1079 | verbose_printk(KERN_NOTICE " physical IVG%i asserted : %s\n", i, buf); | 1090 | decode_address(buf, bfin_read32(EVT0 + 4*i)); |
| 1091 | verbose_printk(KERN_NOTICE " physical IVG%i asserted : %s\n", i, buf); | ||
| 1092 | } else | ||
| 1093 | verbose_printk(KERN_NOTICE " interrupts disabled\n"); | ||
| 1080 | } | 1094 | } |
| 1081 | } | 1095 | } |
| 1082 | 1096 | ||
| 1083 | /* if no interrupts are going off, don't print this out */ | 1097 | /* if no interrupts are going off, don't print this out */ |
| 1084 | if (fp->ipend & ~0x3F) { | 1098 | if (fp->ipend & ~0x3F) { |
| 1085 | for (i = 0; i < (NR_IRQS - 1); i++) { | 1099 | for (i = 0; i < (NR_IRQS - 1); i++) { |
| 1086 | spin_lock_irqsave(&irq_desc[i].lock, flags); | 1100 | if (!in_atomic) |
| 1101 | spin_lock_irqsave(&irq_desc[i].lock, flags); | ||
| 1102 | |||
| 1087 | action = irq_desc[i].action; | 1103 | action = irq_desc[i].action; |
| 1088 | if (!action) | 1104 | if (!action) |
| 1089 | goto unlock; | 1105 | goto unlock; |
| @@ -1096,7 +1112,8 @@ void show_regs(struct pt_regs *fp) | |||
| 1096 | } | 1112 | } |
| 1097 | verbose_printk("\n"); | 1113 | verbose_printk("\n"); |
| 1098 | unlock: | 1114 | unlock: |
| 1099 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | 1115 | if (!in_atomic) |
| 1116 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | ||
| 1100 | } | 1117 | } |
| 1101 | } | 1118 | } |
| 1102 | 1119 | ||
diff --git a/arch/blackfin/mach-bf518/boards/ezbrd.c b/arch/blackfin/mach-bf518/boards/ezbrd.c index 15f1351c8645..0e175342112e 100644 --- a/arch/blackfin/mach-bf518/boards/ezbrd.c +++ b/arch/blackfin/mach-bf518/boards/ezbrd.c | |||
| @@ -46,6 +46,7 @@ | |||
| 46 | #include <asm/dpmc.h> | 46 | #include <asm/dpmc.h> |
| 47 | #include <asm/bfin_sdh.h> | 47 | #include <asm/bfin_sdh.h> |
| 48 | #include <linux/spi/ad7877.h> | 48 | #include <linux/spi/ad7877.h> |
| 49 | #include <net/dsa.h> | ||
| 49 | 50 | ||
| 50 | /* | 51 | /* |
| 51 | * Name the Board for the /proc/cpuinfo | 52 | * Name the Board for the /proc/cpuinfo |
| @@ -104,8 +105,31 @@ static struct platform_device rtc_device = { | |||
| 104 | #endif | 105 | #endif |
| 105 | 106 | ||
| 106 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 107 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 108 | static struct platform_device bfin_mii_bus = { | ||
| 109 | .name = "bfin_mii_bus", | ||
| 110 | }; | ||
| 111 | |||
| 107 | static struct platform_device bfin_mac_device = { | 112 | static struct platform_device bfin_mac_device = { |
| 108 | .name = "bfin_mac", | 113 | .name = "bfin_mac", |
| 114 | .dev.platform_data = &bfin_mii_bus, | ||
| 115 | }; | ||
| 116 | #endif | ||
| 117 | |||
| 118 | #if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE) | ||
| 119 | static struct dsa_platform_data ksz8893m_switch_data = { | ||
| 120 | .mii_bus = &bfin_mii_bus.dev, | ||
| 121 | .netdev = &bfin_mac_device.dev, | ||
| 122 | .port_names[0] = NULL, | ||
| 123 | .port_names[1] = "eth%d", | ||
| 124 | .port_names[2] = "eth%d", | ||
| 125 | .port_names[3] = "cpu", | ||
| 126 | }; | ||
| 127 | |||
| 128 | static struct platform_device ksz8893m_switch_device = { | ||
| 129 | .name = "dsa", | ||
| 130 | .id = 0, | ||
| 131 | .num_resources = 0, | ||
| 132 | .dev.platform_data = &ksz8893m_switch_data, | ||
| 109 | }; | 133 | }; |
| 110 | #endif | 134 | #endif |
| 111 | 135 | ||
| @@ -147,6 +171,15 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = { | |||
| 147 | }; | 171 | }; |
| 148 | #endif | 172 | #endif |
| 149 | 173 | ||
| 174 | #if defined(CONFIG_NET_DSA_KSZ8893M) \ | ||
| 175 | || defined(CONFIG_NET_DSA_KSZ8893M_MODULE) | ||
| 176 | /* SPI SWITCH CHIP */ | ||
| 177 | static struct bfin5xx_spi_chip spi_switch_info = { | ||
| 178 | .enable_dma = 0, | ||
| 179 | .bits_per_word = 8, | ||
| 180 | }; | ||
| 181 | #endif | ||
| 182 | |||
| 150 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) | 183 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) |
| 151 | static struct bfin5xx_spi_chip spi_mmc_chip_info = { | 184 | static struct bfin5xx_spi_chip spi_mmc_chip_info = { |
| 152 | .enable_dma = 1, | 185 | .enable_dma = 1, |
| @@ -226,6 +259,19 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = { | |||
| 226 | }, | 259 | }, |
| 227 | #endif | 260 | #endif |
| 228 | 261 | ||
| 262 | #if defined(CONFIG_NET_DSA_KSZ8893M) \ | ||
| 263 | || defined(CONFIG_NET_DSA_KSZ8893M_MODULE) | ||
| 264 | { | ||
| 265 | .modalias = "ksz8893m", | ||
| 266 | .max_speed_hz = 5000000, | ||
| 267 | .bus_num = 0, | ||
| 268 | .chip_select = 1, | ||
| 269 | .platform_data = NULL, | ||
| 270 | .controller_data = &spi_switch_info, | ||
| 271 | .mode = SPI_MODE_3, | ||
| 272 | }, | ||
| 273 | #endif | ||
| 274 | |||
| 229 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) | 275 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) |
| 230 | { | 276 | { |
| 231 | .modalias = "spi_mmc_dummy", | 277 | .modalias = "spi_mmc_dummy", |
| @@ -473,7 +519,6 @@ static struct platform_device i2c_bfin_twi_device = { | |||
| 473 | }; | 519 | }; |
| 474 | #endif | 520 | #endif |
| 475 | 521 | ||
| 476 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 477 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | 522 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { |
| 478 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) | 523 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) |
| 479 | { | 524 | { |
| @@ -487,7 +532,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | |||
| 487 | }, | 532 | }, |
| 488 | #endif | 533 | #endif |
| 489 | }; | 534 | }; |
| 490 | #endif | ||
| 491 | 535 | ||
| 492 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) | 536 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 493 | static struct platform_device bfin_sport0_uart_device = { | 537 | static struct platform_device bfin_sport0_uart_device = { |
| @@ -584,9 +628,14 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
| 584 | #endif | 628 | #endif |
| 585 | 629 | ||
| 586 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 630 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 631 | &bfin_mii_bus, | ||
| 587 | &bfin_mac_device, | 632 | &bfin_mac_device, |
| 588 | #endif | 633 | #endif |
| 589 | 634 | ||
| 635 | #if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE) | ||
| 636 | &ksz8893m_switch_device, | ||
| 637 | #endif | ||
| 638 | |||
| 590 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) | 639 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 591 | &bfin_spi0_device, | 640 | &bfin_spi0_device, |
| 592 | &bfin_spi1_device, | 641 | &bfin_spi1_device, |
| @@ -632,12 +681,8 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
| 632 | static int __init ezbrd_init(void) | 681 | static int __init ezbrd_init(void) |
| 633 | { | 682 | { |
| 634 | printk(KERN_INFO "%s(): registering device resources\n", __func__); | 683 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
| 635 | |||
| 636 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 637 | i2c_register_board_info(0, bfin_i2c_board_info, | 684 | i2c_register_board_info(0, bfin_i2c_board_info, |
| 638 | ARRAY_SIZE(bfin_i2c_board_info)); | 685 | ARRAY_SIZE(bfin_i2c_board_info)); |
| 639 | #endif | ||
| 640 | |||
| 641 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); | 686 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
| 642 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); | 687 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); |
| 643 | return 0; | 688 | return 0; |
| @@ -649,7 +694,7 @@ void native_machine_restart(char *cmd) | |||
| 649 | { | 694 | { |
| 650 | /* workaround reboot hang when booting from SPI */ | 695 | /* workaround reboot hang when booting from SPI */ |
| 651 | if ((bfin_read_SYSCR() & 0x7) == 0x3) | 696 | if ((bfin_read_SYSCR() & 0x7) == 0x3) |
| 652 | bfin_gpio_reset_spi0_ssel1(); | 697 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); |
| 653 | } | 698 | } |
| 654 | 699 | ||
| 655 | void bfin_get_ether_addr(char *addr) | 700 | void bfin_get_ether_addr(char *addr) |
diff --git a/arch/blackfin/mach-bf518/include/mach/portmux.h b/arch/blackfin/mach-bf518/include/mach/portmux.h index ac16d54734d4..f618b487b2b0 100644 --- a/arch/blackfin/mach-bf518/include/mach/portmux.h +++ b/arch/blackfin/mach-bf518/include/mach/portmux.h | |||
| @@ -103,6 +103,8 @@ | |||
| 103 | #define P_SPI1_SSEL4 (P_DEFINED | P_IDENT(GPIO_PF8) | P_FUNCT(2)) | 103 | #define P_SPI1_SSEL4 (P_DEFINED | P_IDENT(GPIO_PF8) | P_FUNCT(2)) |
| 104 | #define P_SPI1_SSEL5 (P_DEFINED | P_IDENT(GPIO_PG11) | P_FUNCT(2)) | 104 | #define P_SPI1_SSEL5 (P_DEFINED | P_IDENT(GPIO_PG11) | P_FUNCT(2)) |
| 105 | 105 | ||
| 106 | #define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2 | ||
| 107 | |||
| 106 | /* SPORT Port Mux */ | 108 | /* SPORT Port Mux */ |
| 107 | #define P_SPORT0_DRPRI (P_DEFINED | P_IDENT(GPIO_PG3) | P_FUNCT(0)) | 109 | #define P_SPORT0_DRPRI (P_DEFINED | P_IDENT(GPIO_PG3) | P_FUNCT(0)) |
| 108 | #define P_SPORT0_RSCLK (P_DEFINED | P_IDENT(GPIO_PG4) | P_FUNCT(0)) | 110 | #define P_SPORT0_RSCLK (P_DEFINED | P_IDENT(GPIO_PG4) | P_FUNCT(0)) |
diff --git a/arch/blackfin/mach-bf527/boards/cm_bf527.c b/arch/blackfin/mach-bf527/boards/cm_bf527.c index a2c3578f4b6c..856c097b5317 100644 --- a/arch/blackfin/mach-bf527/boards/cm_bf527.c +++ b/arch/blackfin/mach-bf527/boards/cm_bf527.c | |||
| @@ -403,8 +403,13 @@ static struct platform_device isp1362_hcd_device = { | |||
| 403 | #endif | 403 | #endif |
| 404 | 404 | ||
| 405 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 405 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 406 | static struct platform_device bfin_mii_bus = { | ||
| 407 | .name = "bfin_mii_bus", | ||
| 408 | }; | ||
| 409 | |||
| 406 | static struct platform_device bfin_mac_device = { | 410 | static struct platform_device bfin_mac_device = { |
| 407 | .name = "bfin_mac", | 411 | .name = "bfin_mac", |
| 412 | .dev.platform_data = &bfin_mii_bus, | ||
| 408 | }; | 413 | }; |
| 409 | #endif | 414 | #endif |
| 410 | 415 | ||
| @@ -793,7 +798,6 @@ static struct platform_device i2c_bfin_twi_device = { | |||
| 793 | }; | 798 | }; |
| 794 | #endif | 799 | #endif |
| 795 | 800 | ||
| 796 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 797 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | 801 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { |
| 798 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) | 802 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) |
| 799 | { | 803 | { |
| @@ -809,7 +813,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | |||
| 809 | }, | 813 | }, |
| 810 | #endif | 814 | #endif |
| 811 | }; | 815 | }; |
| 812 | #endif | ||
| 813 | 816 | ||
| 814 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) | 817 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 815 | static struct platform_device bfin_sport0_uart_device = { | 818 | static struct platform_device bfin_sport0_uart_device = { |
| @@ -920,6 +923,7 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
| 920 | #endif | 923 | #endif |
| 921 | 924 | ||
| 922 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 925 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 926 | &bfin_mii_bus, | ||
| 923 | &bfin_mac_device, | 927 | &bfin_mac_device, |
| 924 | #endif | 928 | #endif |
| 925 | 929 | ||
| @@ -968,27 +972,23 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
| 968 | &bfin_gpios_device, | 972 | &bfin_gpios_device, |
| 969 | }; | 973 | }; |
| 970 | 974 | ||
| 971 | static int __init stamp_init(void) | 975 | static int __init cm_init(void) |
| 972 | { | 976 | { |
| 973 | printk(KERN_INFO "%s(): registering device resources\n", __func__); | 977 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
| 974 | |||
| 975 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 976 | i2c_register_board_info(0, bfin_i2c_board_info, | 978 | i2c_register_board_info(0, bfin_i2c_board_info, |
| 977 | ARRAY_SIZE(bfin_i2c_board_info)); | 979 | ARRAY_SIZE(bfin_i2c_board_info)); |
| 978 | #endif | ||
| 979 | |||
| 980 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); | 980 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
| 981 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); | 981 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); |
| 982 | return 0; | 982 | return 0; |
| 983 | } | 983 | } |
| 984 | 984 | ||
| 985 | arch_initcall(stamp_init); | 985 | arch_initcall(cm_init); |
| 986 | 986 | ||
| 987 | void native_machine_restart(char *cmd) | 987 | void native_machine_restart(char *cmd) |
| 988 | { | 988 | { |
| 989 | /* workaround reboot hang when booting from SPI */ | 989 | /* workaround reboot hang when booting from SPI */ |
| 990 | if ((bfin_read_SYSCR() & 0x7) == 0x3) | 990 | if ((bfin_read_SYSCR() & 0x7) == 0x3) |
| 991 | bfin_gpio_reset_spi0_ssel1(); | 991 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); |
| 992 | } | 992 | } |
| 993 | 993 | ||
| 994 | void bfin_get_ether_addr(char *addr) | 994 | void bfin_get_ether_addr(char *addr) |
diff --git a/arch/blackfin/mach-bf527/boards/ezbrd.c b/arch/blackfin/mach-bf527/boards/ezbrd.c index 0314bd3355eb..83606fcdde27 100644 --- a/arch/blackfin/mach-bf527/boards/ezbrd.c +++ b/arch/blackfin/mach-bf527/boards/ezbrd.c | |||
| @@ -208,8 +208,13 @@ static struct platform_device rtc_device = { | |||
| 208 | 208 | ||
| 209 | 209 | ||
| 210 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 210 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 211 | static struct platform_device bfin_mii_bus = { | ||
| 212 | .name = "bfin_mii_bus", | ||
| 213 | }; | ||
| 214 | |||
| 211 | static struct platform_device bfin_mac_device = { | 215 | static struct platform_device bfin_mac_device = { |
| 212 | .name = "bfin_mac", | 216 | .name = "bfin_mac", |
| 217 | .dev.platform_data = &bfin_mii_bus, | ||
| 213 | }; | 218 | }; |
| 214 | #endif | 219 | #endif |
| 215 | 220 | ||
| @@ -590,7 +595,6 @@ static struct platform_device i2c_bfin_twi_device = { | |||
| 590 | }; | 595 | }; |
| 591 | #endif | 596 | #endif |
| 592 | 597 | ||
| 593 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 594 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | 598 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { |
| 595 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) | 599 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) |
| 596 | { | 600 | { |
| @@ -604,7 +608,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | |||
| 604 | }, | 608 | }, |
| 605 | #endif | 609 | #endif |
| 606 | }; | 610 | }; |
| 607 | #endif | ||
| 608 | 611 | ||
| 609 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) | 612 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 610 | static struct platform_device bfin_sport0_uart_device = { | 613 | static struct platform_device bfin_sport0_uart_device = { |
| @@ -720,6 +723,7 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
| 720 | #endif | 723 | #endif |
| 721 | 724 | ||
| 722 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 725 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 726 | &bfin_mii_bus, | ||
| 723 | &bfin_mac_device, | 727 | &bfin_mac_device, |
| 724 | #endif | 728 | #endif |
| 725 | 729 | ||
| @@ -764,27 +768,23 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
| 764 | &bfin_gpios_device, | 768 | &bfin_gpios_device, |
| 765 | }; | 769 | }; |
| 766 | 770 | ||
| 767 | static int __init stamp_init(void) | 771 | static int __init ezbrd_init(void) |
| 768 | { | 772 | { |
| 769 | printk(KERN_INFO "%s(): registering device resources\n", __func__); | 773 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
| 770 | |||
| 771 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 772 | i2c_register_board_info(0, bfin_i2c_board_info, | 774 | i2c_register_board_info(0, bfin_i2c_board_info, |
| 773 | ARRAY_SIZE(bfin_i2c_board_info)); | 775 | ARRAY_SIZE(bfin_i2c_board_info)); |
| 774 | #endif | ||
| 775 | |||
| 776 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); | 776 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
| 777 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); | 777 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); |
| 778 | return 0; | 778 | return 0; |
| 779 | } | 779 | } |
| 780 | 780 | ||
| 781 | arch_initcall(stamp_init); | 781 | arch_initcall(ezbrd_init); |
| 782 | 782 | ||
| 783 | void native_machine_restart(char *cmd) | 783 | void native_machine_restart(char *cmd) |
| 784 | { | 784 | { |
| 785 | /* workaround reboot hang when booting from SPI */ | 785 | /* workaround reboot hang when booting from SPI */ |
| 786 | if ((bfin_read_SYSCR() & 0x7) == 0x3) | 786 | if ((bfin_read_SYSCR() & 0x7) == 0x3) |
| 787 | bfin_gpio_reset_spi0_ssel1(); | 787 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); |
| 788 | } | 788 | } |
| 789 | 789 | ||
| 790 | void bfin_get_ether_addr(char *addr) | 790 | void bfin_get_ether_addr(char *addr) |
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c index 9454fb7b18c3..d0864111ef59 100644 --- a/arch/blackfin/mach-bf527/boards/ezkit.c +++ b/arch/blackfin/mach-bf527/boards/ezkit.c | |||
| @@ -425,8 +425,13 @@ static struct platform_device isp1362_hcd_device = { | |||
| 425 | #endif | 425 | #endif |
| 426 | 426 | ||
| 427 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 427 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 428 | static struct platform_device bfin_mii_bus = { | ||
| 429 | .name = "bfin_mii_bus", | ||
| 430 | }; | ||
| 431 | |||
| 428 | static struct platform_device bfin_mac_device = { | 432 | static struct platform_device bfin_mac_device = { |
| 429 | .name = "bfin_mac", | 433 | .name = "bfin_mac", |
| 434 | .dev.platform_data = &bfin_mii_bus, | ||
| 430 | }; | 435 | }; |
| 431 | #endif | 436 | #endif |
| 432 | 437 | ||
| @@ -830,7 +835,6 @@ static struct platform_device i2c_bfin_twi_device = { | |||
| 830 | }; | 835 | }; |
| 831 | #endif | 836 | #endif |
| 832 | 837 | ||
| 833 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 834 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | 838 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { |
| 835 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) | 839 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) |
| 836 | { | 840 | { |
| @@ -844,7 +848,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | |||
| 844 | }, | 848 | }, |
| 845 | #endif | 849 | #endif |
| 846 | }; | 850 | }; |
| 847 | #endif | ||
| 848 | 851 | ||
| 849 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) | 852 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 850 | static struct platform_device bfin_sport0_uart_device = { | 853 | static struct platform_device bfin_sport0_uart_device = { |
| @@ -988,6 +991,7 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
| 988 | #endif | 991 | #endif |
| 989 | 992 | ||
| 990 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 993 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 994 | &bfin_mii_bus, | ||
| 991 | &bfin_mac_device, | 995 | &bfin_mac_device, |
| 992 | #endif | 996 | #endif |
| 993 | 997 | ||
| @@ -1048,27 +1052,23 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
| 1048 | &bfin_gpios_device, | 1052 | &bfin_gpios_device, |
| 1049 | }; | 1053 | }; |
| 1050 | 1054 | ||
| 1051 | static int __init stamp_init(void) | 1055 | static int __init ezkit_init(void) |
| 1052 | { | 1056 | { |
| 1053 | printk(KERN_INFO "%s(): registering device resources\n", __func__); | 1057 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
| 1054 | |||
| 1055 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 1056 | i2c_register_board_info(0, bfin_i2c_board_info, | 1058 | i2c_register_board_info(0, bfin_i2c_board_info, |
| 1057 | ARRAY_SIZE(bfin_i2c_board_info)); | 1059 | ARRAY_SIZE(bfin_i2c_board_info)); |
| 1058 | #endif | ||
| 1059 | |||
| 1060 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); | 1060 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
| 1061 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); | 1061 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); |
| 1062 | return 0; | 1062 | return 0; |
| 1063 | } | 1063 | } |
| 1064 | 1064 | ||
| 1065 | arch_initcall(stamp_init); | 1065 | arch_initcall(ezkit_init); |
| 1066 | 1066 | ||
| 1067 | void native_machine_restart(char *cmd) | 1067 | void native_machine_restart(char *cmd) |
| 1068 | { | 1068 | { |
| 1069 | /* workaround reboot hang when booting from SPI */ | 1069 | /* workaround reboot hang when booting from SPI */ |
| 1070 | if ((bfin_read_SYSCR() & 0x7) == 0x3) | 1070 | if ((bfin_read_SYSCR() & 0x7) == 0x3) |
| 1071 | bfin_gpio_reset_spi0_ssel1(); | 1071 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); |
| 1072 | } | 1072 | } |
| 1073 | 1073 | ||
| 1074 | void bfin_get_ether_addr(char *addr) | 1074 | void bfin_get_ether_addr(char *addr) |
diff --git a/arch/blackfin/mach-bf527/include/mach/portmux.h b/arch/blackfin/mach-bf527/include/mach/portmux.h index 7f6da2c386bb..72b1652be4da 100644 --- a/arch/blackfin/mach-bf527/include/mach/portmux.h +++ b/arch/blackfin/mach-bf527/include/mach/portmux.h | |||
| @@ -73,6 +73,8 @@ | |||
| 73 | 73 | ||
| 74 | #define P_HWAIT (P_DONTCARE) | 74 | #define P_HWAIT (P_DONTCARE) |
| 75 | 75 | ||
| 76 | #define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL1 | ||
| 77 | |||
| 76 | #define P_SPI0_SS (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(0)) | 78 | #define P_SPI0_SS (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(0)) |
| 77 | #define P_SPI0_SSEL1 (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(2)) | 79 | #define P_SPI0_SSEL1 (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(2)) |
| 78 | #define P_SPI0_SCK (P_DEFINED | P_IDENT(GPIO_PG2) | P_FUNCT(2)) | 80 | #define P_SPI0_SCK (P_DEFINED | P_IDENT(GPIO_PG2) | P_FUNCT(2)) |
diff --git a/arch/blackfin/mach-bf533/boards/blackstamp.c b/arch/blackfin/mach-bf533/boards/blackstamp.c index 6ee607c259ac..015c18f85e7f 100644 --- a/arch/blackfin/mach-bf533/boards/blackstamp.c +++ b/arch/blackfin/mach-bf533/boards/blackstamp.c | |||
| @@ -309,10 +309,8 @@ static struct platform_device i2c_gpio_device = { | |||
| 309 | }; | 309 | }; |
| 310 | #endif | 310 | #endif |
| 311 | 311 | ||
| 312 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 313 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | 312 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { |
| 314 | }; | 313 | }; |
| 315 | #endif | ||
| 316 | 314 | ||
| 317 | static const unsigned int cclk_vlev_datasheet[] = | 315 | static const unsigned int cclk_vlev_datasheet[] = |
| 318 | { | 316 | { |
| @@ -390,10 +388,8 @@ static int __init blackstamp_init(void) | |||
| 390 | 388 | ||
| 391 | printk(KERN_INFO "%s(): registering device resources\n", __func__); | 389 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
| 392 | 390 | ||
| 393 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 394 | i2c_register_board_info(0, bfin_i2c_board_info, | 391 | i2c_register_board_info(0, bfin_i2c_board_info, |
| 395 | ARRAY_SIZE(bfin_i2c_board_info)); | 392 | ARRAY_SIZE(bfin_i2c_board_info)); |
| 396 | #endif | ||
| 397 | 393 | ||
| 398 | ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); | 394 | ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
| 399 | if (ret < 0) | 395 | if (ret < 0) |
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c index 07f9ad1e189c..db96f33f72e2 100644 --- a/arch/blackfin/mach-bf533/boards/stamp.c +++ b/arch/blackfin/mach-bf533/boards/stamp.c | |||
| @@ -441,7 +441,6 @@ static struct platform_device i2c_gpio_device = { | |||
| 441 | }; | 441 | }; |
| 442 | #endif | 442 | #endif |
| 443 | 443 | ||
| 444 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 445 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | 444 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { |
| 446 | #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) | 445 | #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) |
| 447 | { | 446 | { |
| @@ -461,7 +460,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | |||
| 461 | }, | 460 | }, |
| 462 | #endif | 461 | #endif |
| 463 | }; | 462 | }; |
| 464 | #endif | ||
| 465 | 463 | ||
| 466 | static const unsigned int cclk_vlev_datasheet[] = | 464 | static const unsigned int cclk_vlev_datasheet[] = |
| 467 | { | 465 | { |
| @@ -550,10 +548,8 @@ static int __init stamp_init(void) | |||
| 550 | 548 | ||
| 551 | printk(KERN_INFO "%s(): registering device resources\n", __func__); | 549 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
| 552 | 550 | ||
| 553 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 554 | i2c_register_board_info(0, bfin_i2c_board_info, | 551 | i2c_register_board_info(0, bfin_i2c_board_info, |
| 555 | ARRAY_SIZE(bfin_i2c_board_info)); | 552 | ARRAY_SIZE(bfin_i2c_board_info)); |
| 556 | #endif | ||
| 557 | 553 | ||
| 558 | ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); | 554 | ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
| 559 | if (ret < 0) | 555 | if (ret < 0) |
diff --git a/arch/blackfin/mach-bf533/include/mach/portmux.h b/arch/blackfin/mach-bf533/include/mach/portmux.h index 685a2651dcda..2f59ce0b0cb5 100644 --- a/arch/blackfin/mach-bf533/include/mach/portmux.h +++ b/arch/blackfin/mach-bf533/include/mach/portmux.h | |||
| @@ -54,14 +54,11 @@ | |||
| 54 | #define P_SPI0_SSEL2 (P_DEFINED | P_IDENT(GPIO_PF2)) | 54 | #define P_SPI0_SSEL2 (P_DEFINED | P_IDENT(GPIO_PF2)) |
| 55 | #define P_SPI0_SSEL1 (P_DEFINED | P_IDENT(GPIO_PF1)) | 55 | #define P_SPI0_SSEL1 (P_DEFINED | P_IDENT(GPIO_PF1)) |
| 56 | #define P_SPI0_SS (P_DEFINED | P_IDENT(GPIO_PF0)) | 56 | #define P_SPI0_SS (P_DEFINED | P_IDENT(GPIO_PF0)) |
| 57 | #define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2 | ||
| 57 | 58 | ||
| 58 | #define P_TMR2 (P_DONTCARE) | 59 | #define P_TMR2 (P_DONTCARE) |
| 59 | #define P_TMR1 (P_DONTCARE) | 60 | #define P_TMR1 (P_DONTCARE) |
| 60 | #define P_TMR0 (P_DONTCARE) | 61 | #define P_TMR0 (P_DONTCARE) |
| 61 | #define P_TMRCLK (P_DEFINED | P_IDENT(GPIO_PF1)) | 62 | #define P_TMRCLK (P_DEFINED | P_IDENT(GPIO_PF1)) |
| 62 | 63 | ||
| 63 | |||
| 64 | |||
| 65 | |||
| 66 | |||
| 67 | #endif /* _MACH_PORTMUX_H_ */ | 64 | #endif /* _MACH_PORTMUX_H_ */ |
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537.c b/arch/blackfin/mach-bf537/boards/cm_bf537.c index 6ac8e4d5bd38..9cd8fb2a30d3 100644 --- a/arch/blackfin/mach-bf537/boards/cm_bf537.c +++ b/arch/blackfin/mach-bf537/boards/cm_bf537.c | |||
| @@ -479,8 +479,13 @@ static struct platform_device bfin_sport1_uart_device = { | |||
| 479 | #endif | 479 | #endif |
| 480 | 480 | ||
| 481 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 481 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 482 | static struct platform_device bfin_mii_bus = { | ||
| 483 | .name = "bfin_mii_bus", | ||
| 484 | }; | ||
| 485 | |||
| 482 | static struct platform_device bfin_mac_device = { | 486 | static struct platform_device bfin_mac_device = { |
| 483 | .name = "bfin_mac", | 487 | .name = "bfin_mac", |
| 488 | .dev.platform_data = &bfin_mii_bus, | ||
| 484 | }; | 489 | }; |
| 485 | #endif | 490 | #endif |
| 486 | 491 | ||
| @@ -591,6 +596,7 @@ static struct platform_device *cm_bf537_devices[] __initdata = { | |||
| 591 | #endif | 596 | #endif |
| 592 | 597 | ||
| 593 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 598 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 599 | &bfin_mii_bus, | ||
| 594 | &bfin_mac_device, | 600 | &bfin_mac_device, |
| 595 | #endif | 601 | #endif |
| 596 | 602 | ||
diff --git a/arch/blackfin/mach-bf537/boards/generic_board.c b/arch/blackfin/mach-bf537/boards/generic_board.c index dd6e6bfb98ea..da710fdc4569 100644 --- a/arch/blackfin/mach-bf537/boards/generic_board.c +++ b/arch/blackfin/mach-bf537/boards/generic_board.c | |||
| @@ -262,8 +262,13 @@ static struct platform_device isp1362_hcd_device = { | |||
| 262 | #endif | 262 | #endif |
| 263 | 263 | ||
| 264 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 264 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 265 | static struct platform_device bfin_mii_bus = { | ||
| 266 | .name = "bfin_mii_bus", | ||
| 267 | }; | ||
| 268 | |||
| 265 | static struct platform_device bfin_mac_device = { | 269 | static struct platform_device bfin_mac_device = { |
| 266 | .name = "bfin_mac", | 270 | .name = "bfin_mac", |
| 271 | .dev.platform_data = &bfin_mii_bus, | ||
| 267 | }; | 272 | }; |
| 268 | #endif | 273 | #endif |
| 269 | 274 | ||
| @@ -662,6 +667,7 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
| 662 | #endif | 667 | #endif |
| 663 | 668 | ||
| 664 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 669 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 670 | &bfin_mii_bus, | ||
| 665 | &bfin_mac_device, | 671 | &bfin_mac_device, |
| 666 | #endif | 672 | #endif |
| 667 | 673 | ||
| @@ -708,7 +714,7 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
| 708 | #endif | 714 | #endif |
| 709 | }; | 715 | }; |
| 710 | 716 | ||
| 711 | static int __init stamp_init(void) | 717 | static int __init generic_init(void) |
| 712 | { | 718 | { |
| 713 | printk(KERN_INFO "%s(): registering device resources\n", __func__); | 719 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
| 714 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); | 720 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
| @@ -720,13 +726,13 @@ static int __init stamp_init(void) | |||
| 720 | return 0; | 726 | return 0; |
| 721 | } | 727 | } |
| 722 | 728 | ||
| 723 | arch_initcall(stamp_init); | 729 | arch_initcall(generic_init); |
| 724 | 730 | ||
| 725 | void native_machine_restart(char *cmd) | 731 | void native_machine_restart(char *cmd) |
| 726 | { | 732 | { |
| 727 | /* workaround reboot hang when booting from SPI */ | 733 | /* workaround reboot hang when booting from SPI */ |
| 728 | if ((bfin_read_SYSCR() & 0x7) == 0x3) | 734 | if ((bfin_read_SYSCR() & 0x7) == 0x3) |
| 729 | bfin_gpio_reset_spi0_ssel1(); | 735 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); |
| 730 | } | 736 | } |
| 731 | 737 | ||
| 732 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 738 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
diff --git a/arch/blackfin/mach-bf537/boards/minotaur.c b/arch/blackfin/mach-bf537/boards/minotaur.c index bb795341cb17..db7d3a385e4b 100644 --- a/arch/blackfin/mach-bf537/boards/minotaur.c +++ b/arch/blackfin/mach-bf537/boards/minotaur.c | |||
| @@ -61,8 +61,13 @@ static struct platform_device rtc_device = { | |||
| 61 | #endif | 61 | #endif |
| 62 | 62 | ||
| 63 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 63 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 64 | static struct platform_device bfin_mii_bus = { | ||
| 65 | .name = "bfin_mii_bus", | ||
| 66 | }; | ||
| 67 | |||
| 64 | static struct platform_device bfin_mac_device = { | 68 | static struct platform_device bfin_mac_device = { |
| 65 | .name = "bfin_mac", | 69 | .name = "bfin_mac", |
| 70 | .dev.platform_data = &bfin_mii_bus, | ||
| 66 | }; | 71 | }; |
| 67 | #endif | 72 | #endif |
| 68 | 73 | ||
| @@ -324,6 +329,7 @@ static struct platform_device *minotaur_devices[] __initdata = { | |||
| 324 | #endif | 329 | #endif |
| 325 | 330 | ||
| 326 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 331 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 332 | &bfin_mii_bus, | ||
| 327 | &bfin_mac_device, | 333 | &bfin_mac_device, |
| 328 | #endif | 334 | #endif |
| 329 | 335 | ||
| @@ -377,5 +383,5 @@ void native_machine_restart(char *cmd) | |||
| 377 | { | 383 | { |
| 378 | /* workaround reboot hang when booting from SPI */ | 384 | /* workaround reboot hang when booting from SPI */ |
| 379 | if ((bfin_read_SYSCR() & 0x7) == 0x3) | 385 | if ((bfin_read_SYSCR() & 0x7) == 0x3) |
| 380 | bfin_gpio_reset_spi0_ssel1(); | 386 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); |
| 381 | } | 387 | } |
diff --git a/arch/blackfin/mach-bf537/boards/pnav10.c b/arch/blackfin/mach-bf537/boards/pnav10.c index 89de94f4545d..590eb3a139b7 100644 --- a/arch/blackfin/mach-bf537/boards/pnav10.c +++ b/arch/blackfin/mach-bf537/boards/pnav10.c | |||
| @@ -198,8 +198,13 @@ static struct platform_device isp1362_hcd_device = { | |||
| 198 | #endif | 198 | #endif |
| 199 | 199 | ||
| 200 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 200 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 201 | static struct platform_device bfin_mii_bus = { | ||
| 202 | .name = "bfin_mii_bus", | ||
| 203 | }; | ||
| 204 | |||
| 201 | static struct platform_device bfin_mac_device = { | 205 | static struct platform_device bfin_mac_device = { |
| 202 | .name = "bfin_mac", | 206 | .name = "bfin_mac", |
| 207 | .dev.platform_data = &bfin_mii_bus, | ||
| 203 | }; | 208 | }; |
| 204 | #endif | 209 | #endif |
| 205 | 210 | ||
| @@ -529,6 +534,7 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
| 529 | #endif | 534 | #endif |
| 530 | 535 | ||
| 531 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 536 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 537 | &bfin_mii_bus, | ||
| 532 | &bfin_mac_device, | 538 | &bfin_mac_device, |
| 533 | #endif | 539 | #endif |
| 534 | 540 | ||
| @@ -558,7 +564,7 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
| 558 | #endif | 564 | #endif |
| 559 | }; | 565 | }; |
| 560 | 566 | ||
| 561 | static int __init stamp_init(void) | 567 | static int __init pnav_init(void) |
| 562 | { | 568 | { |
| 563 | printk(KERN_INFO "%s(): registering device resources\n", __func__); | 569 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
| 564 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); | 570 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
| @@ -569,7 +575,7 @@ static int __init stamp_init(void) | |||
| 569 | return 0; | 575 | return 0; |
| 570 | } | 576 | } |
| 571 | 577 | ||
| 572 | arch_initcall(stamp_init); | 578 | arch_initcall(pnav_init); |
| 573 | 579 | ||
| 574 | void bfin_get_ether_addr(char *addr) | 580 | void bfin_get_ether_addr(char *addr) |
| 575 | { | 581 | { |
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c index d812e2514a2f..cd04c5e44878 100644 --- a/arch/blackfin/mach-bf537/boards/stamp.c +++ b/arch/blackfin/mach-bf537/boards/stamp.c | |||
| @@ -321,8 +321,13 @@ static struct platform_device isp1362_hcd_device = { | |||
| 321 | #endif | 321 | #endif |
| 322 | 322 | ||
| 323 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 323 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 324 | static struct platform_device bfin_mii_bus = { | ||
| 325 | .name = "bfin_mii_bus", | ||
| 326 | }; | ||
| 327 | |||
| 324 | static struct platform_device bfin_mac_device = { | 328 | static struct platform_device bfin_mac_device = { |
| 325 | .name = "bfin_mac", | 329 | .name = "bfin_mac", |
| 330 | .dev.platform_data = &bfin_mii_bus, | ||
| 326 | }; | 331 | }; |
| 327 | #endif | 332 | #endif |
| 328 | 333 | ||
| @@ -1068,7 +1073,6 @@ static struct adp5588_kpad_platform_data adp5588_kpad_data = { | |||
| 1068 | }; | 1073 | }; |
| 1069 | #endif | 1074 | #endif |
| 1070 | 1075 | ||
| 1071 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 1072 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | 1076 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { |
| 1073 | #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) | 1077 | #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) |
| 1074 | { | 1078 | { |
| @@ -1102,7 +1106,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | |||
| 1102 | }, | 1106 | }, |
| 1103 | #endif | 1107 | #endif |
| 1104 | }; | 1108 | }; |
| 1105 | #endif | ||
| 1106 | 1109 | ||
| 1107 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) | 1110 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 1108 | static struct platform_device bfin_sport0_uart_device = { | 1111 | static struct platform_device bfin_sport0_uart_device = { |
| @@ -1217,6 +1220,7 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
| 1217 | #endif | 1220 | #endif |
| 1218 | 1221 | ||
| 1219 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 1222 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 1223 | &bfin_mii_bus, | ||
| 1220 | &bfin_mac_device, | 1224 | &bfin_mac_device, |
| 1221 | #endif | 1225 | #endif |
| 1222 | 1226 | ||
| @@ -1284,12 +1288,8 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
| 1284 | static int __init stamp_init(void) | 1288 | static int __init stamp_init(void) |
| 1285 | { | 1289 | { |
| 1286 | printk(KERN_INFO "%s(): registering device resources\n", __func__); | 1290 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
| 1287 | |||
| 1288 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 1289 | i2c_register_board_info(0, bfin_i2c_board_info, | 1291 | i2c_register_board_info(0, bfin_i2c_board_info, |
| 1290 | ARRAY_SIZE(bfin_i2c_board_info)); | 1292 | ARRAY_SIZE(bfin_i2c_board_info)); |
| 1291 | #endif | ||
| 1292 | |||
| 1293 | bfin_plat_nand_init(); | 1293 | bfin_plat_nand_init(); |
| 1294 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); | 1294 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
| 1295 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); | 1295 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); |
| @@ -1307,7 +1307,7 @@ void native_machine_restart(char *cmd) | |||
| 1307 | { | 1307 | { |
| 1308 | /* workaround reboot hang when booting from SPI */ | 1308 | /* workaround reboot hang when booting from SPI */ |
| 1309 | if ((bfin_read_SYSCR() & 0x7) == 0x3) | 1309 | if ((bfin_read_SYSCR() & 0x7) == 0x3) |
| 1310 | bfin_gpio_reset_spi0_ssel1(); | 1310 | bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); |
| 1311 | } | 1311 | } |
| 1312 | 1312 | ||
| 1313 | /* | 1313 | /* |
diff --git a/arch/blackfin/mach-bf537/boards/tcm_bf537.c b/arch/blackfin/mach-bf537/boards/tcm_bf537.c index 2f4b066153c5..3f4f203a06ec 100644 --- a/arch/blackfin/mach-bf537/boards/tcm_bf537.c +++ b/arch/blackfin/mach-bf537/boards/tcm_bf537.c | |||
| @@ -481,8 +481,13 @@ static struct platform_device bfin_sport1_uart_device = { | |||
| 481 | #endif | 481 | #endif |
| 482 | 482 | ||
| 483 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 483 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 484 | static struct platform_device bfin_mii_bus = { | ||
| 485 | .name = "bfin_mii_bus", | ||
| 486 | }; | ||
| 487 | |||
| 484 | static struct platform_device bfin_mac_device = { | 488 | static struct platform_device bfin_mac_device = { |
| 485 | .name = "bfin_mac", | 489 | .name = "bfin_mac", |
| 490 | .dev.platform_data = &bfin_mii_bus, | ||
| 486 | }; | 491 | }; |
| 487 | #endif | 492 | #endif |
| 488 | 493 | ||
| @@ -593,6 +598,7 @@ static struct platform_device *cm_bf537_devices[] __initdata = { | |||
| 593 | #endif | 598 | #endif |
| 594 | 599 | ||
| 595 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 600 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 601 | &bfin_mii_bus, | ||
| 596 | &bfin_mac_device, | 602 | &bfin_mac_device, |
| 597 | #endif | 603 | #endif |
| 598 | 604 | ||
| @@ -615,7 +621,7 @@ static struct platform_device *cm_bf537_devices[] __initdata = { | |||
| 615 | &bfin_gpios_device, | 621 | &bfin_gpios_device, |
| 616 | }; | 622 | }; |
| 617 | 623 | ||
| 618 | static int __init cm_bf537_init(void) | 624 | static int __init tcm_bf537_init(void) |
| 619 | { | 625 | { |
| 620 | printk(KERN_INFO "%s(): registering device resources\n", __func__); | 626 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
| 621 | platform_add_devices(cm_bf537_devices, ARRAY_SIZE(cm_bf537_devices)); | 627 | platform_add_devices(cm_bf537_devices, ARRAY_SIZE(cm_bf537_devices)); |
| @@ -629,7 +635,7 @@ static int __init cm_bf537_init(void) | |||
| 629 | return 0; | 635 | return 0; |
| 630 | } | 636 | } |
| 631 | 637 | ||
| 632 | arch_initcall(cm_bf537_init); | 638 | arch_initcall(tcm_bf537_init); |
| 633 | 639 | ||
| 634 | void bfin_get_ether_addr(char *addr) | 640 | void bfin_get_ether_addr(char *addr) |
| 635 | { | 641 | { |
diff --git a/arch/blackfin/mach-bf537/include/mach/portmux.h b/arch/blackfin/mach-bf537/include/mach/portmux.h index 78fee6e0f237..87285e75e903 100644 --- a/arch/blackfin/mach-bf537/include/mach/portmux.h +++ b/arch/blackfin/mach-bf537/include/mach/portmux.h | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #define P_PPI0_FS1 (P_DEFINED | P_IDENT(GPIO_PF9) | P_FUNCT(1)) | 31 | #define P_PPI0_FS1 (P_DEFINED | P_IDENT(GPIO_PF9) | P_FUNCT(1)) |
| 32 | #define P_TACLK0 (P_DEFINED | P_IDENT(GPIO_PF14) | P_FUNCT(1)) | 32 | #define P_TACLK0 (P_DEFINED | P_IDENT(GPIO_PF14) | P_FUNCT(1)) |
| 33 | #define P_TMRCLK (P_DEFINED | P_IDENT(GPIO_PF15) | P_FUNCT(1)) | 33 | #define P_TMRCLK (P_DEFINED | P_IDENT(GPIO_PF15) | P_FUNCT(1)) |
| 34 | #define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL1 | ||
| 34 | 35 | ||
| 35 | #define P_PPI0_D0 (P_DEFINED | P_IDENT(GPIO_PG0) | P_FUNCT(0)) | 36 | #define P_PPI0_D0 (P_DEFINED | P_IDENT(GPIO_PG0) | P_FUNCT(0)) |
| 36 | #define P_PPI0_D1 (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(0)) | 37 | #define P_PPI0_D1 (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(0)) |
diff --git a/arch/blackfin/mach-bf538/include/mach/portmux.h b/arch/blackfin/mach-bf538/include/mach/portmux.h index 1e031b588b47..c8db264e3e4d 100644 --- a/arch/blackfin/mach-bf538/include/mach/portmux.h +++ b/arch/blackfin/mach-bf538/include/mach/portmux.h | |||
| @@ -102,5 +102,6 @@ | |||
| 102 | #define P_SPI0_SSEL2 (P_DEFINED | P_IDENT(GPIO_PF2)) | 102 | #define P_SPI0_SSEL2 (P_DEFINED | P_IDENT(GPIO_PF2)) |
| 103 | #define P_SPI0_SSEL1 (P_DEFINED | P_IDENT(GPIO_PF1)) | 103 | #define P_SPI0_SSEL1 (P_DEFINED | P_IDENT(GPIO_PF1)) |
| 104 | #define P_SPI0_SS (P_DEFINED | P_IDENT(GPIO_PF0)) | 104 | #define P_SPI0_SS (P_DEFINED | P_IDENT(GPIO_PF0)) |
| 105 | #define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2 | ||
| 105 | 106 | ||
| 106 | #endif /* _MACH_PORTMUX_H_ */ | 107 | #endif /* _MACH_PORTMUX_H_ */ |
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c index 309c16014cae..096e661700a7 100644 --- a/arch/blackfin/mach-bf548/boards/ezkit.c +++ b/arch/blackfin/mach-bf548/boards/ezkit.c | |||
| @@ -781,7 +781,6 @@ static struct platform_device i2c_bfin_twi1_device = { | |||
| 781 | #endif | 781 | #endif |
| 782 | #endif | 782 | #endif |
| 783 | 783 | ||
| 784 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 785 | static struct i2c_board_info __initdata bfin_i2c_board_info0[] = { | 784 | static struct i2c_board_info __initdata bfin_i2c_board_info0[] = { |
| 786 | }; | 785 | }; |
| 787 | 786 | ||
| @@ -800,7 +799,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info1[] = { | |||
| 800 | #endif | 799 | #endif |
| 801 | }; | 800 | }; |
| 802 | #endif | 801 | #endif |
| 803 | #endif | ||
| 804 | 802 | ||
| 805 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | 803 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 806 | #include <linux/gpio_keys.h> | 804 | #include <linux/gpio_keys.h> |
| @@ -956,14 +954,12 @@ static int __init ezkit_init(void) | |||
| 956 | { | 954 | { |
| 957 | printk(KERN_INFO "%s(): registering device resources\n", __func__); | 955 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
| 958 | 956 | ||
| 959 | #ifdef CONFIG_I2C_BOARDINFO | ||
| 960 | i2c_register_board_info(0, bfin_i2c_board_info0, | 957 | i2c_register_board_info(0, bfin_i2c_board_info0, |
| 961 | ARRAY_SIZE(bfin_i2c_board_info0)); | 958 | ARRAY_SIZE(bfin_i2c_board_info0)); |
| 962 | #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */ | 959 | #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */ |
| 963 | i2c_register_board_info(1, bfin_i2c_board_info1, | 960 | i2c_register_board_info(1, bfin_i2c_board_info1, |
| 964 | ARRAY_SIZE(bfin_i2c_board_info1)); | 961 | ARRAY_SIZE(bfin_i2c_board_info1)); |
| 965 | #endif | 962 | #endif |
| 966 | #endif | ||
| 967 | 963 | ||
| 968 | platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices)); | 964 | platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices)); |
| 969 | 965 | ||
diff --git a/arch/blackfin/mach-bf548/include/mach/anomaly.h b/arch/blackfin/mach-bf548/include/mach/anomaly.h index 3b5430999f4f..23d03c52f4b4 100644 --- a/arch/blackfin/mach-bf548/include/mach/anomaly.h +++ b/arch/blackfin/mach-bf548/include/mach/anomaly.h | |||
| @@ -175,6 +175,7 @@ | |||
| 175 | #define ANOMALY_05000311 (0) | 175 | #define ANOMALY_05000311 (0) |
| 176 | #define ANOMALY_05000323 (0) | 176 | #define ANOMALY_05000323 (0) |
| 177 | #define ANOMALY_05000363 (0) | 177 | #define ANOMALY_05000363 (0) |
| 178 | #define ANOMALY_05000380 (0) | ||
| 178 | #define ANOMALY_05000412 (0) | 179 | #define ANOMALY_05000412 (0) |
| 179 | #define ANOMALY_05000432 (0) | 180 | #define ANOMALY_05000432 (0) |
| 180 | #define ANOMALY_05000435 (0) | 181 | #define ANOMALY_05000435 (0) |
diff --git a/arch/blackfin/mach-bf548/include/mach/bf548.h b/arch/blackfin/mach-bf548/include/mach/bf548.h index f0e569984810..cd31f72bdd82 100644 --- a/arch/blackfin/mach-bf548/include/mach/bf548.h +++ b/arch/blackfin/mach-bf548/include/mach/bf548.h | |||
| @@ -104,6 +104,18 @@ | |||
| 104 | 104 | ||
| 105 | #define AMGCTLVAL (V_AMBEN | V_AMCKEN) | 105 | #define AMGCTLVAL (V_AMBEN | V_AMCKEN) |
| 106 | 106 | ||
| 107 | #if defined(CONFIG_BF542M) | ||
| 108 | # define CONFIG_BF542 | ||
| 109 | #elif defined(CONFIG_BF544M) | ||
| 110 | # define CONFIG_BF544 | ||
| 111 | #elif defined(CONFIG_BF547M) | ||
| 112 | # define CONFIG_BF547 | ||
| 113 | #elif defined(CONFIG_BF548M) | ||
| 114 | # define CONFIG_BF548 | ||
| 115 | #elif defined(CONFIG_BF549M) | ||
| 116 | # define CONFIG_BF549 | ||
| 117 | #endif | ||
| 118 | |||
| 107 | #if defined(CONFIG_BF542) | 119 | #if defined(CONFIG_BF542) |
| 108 | # define CPU "BF542" | 120 | # define CPU "BF542" |
| 109 | # define CPUID 0x27de | 121 | # define CPUID 0x27de |
diff --git a/arch/blackfin/mach-bf548/include/mach/gpio.h b/arch/blackfin/mach-bf548/include/mach/gpio.h index bba82dc75f16..3a2051709787 100644 --- a/arch/blackfin/mach-bf548/include/mach/gpio.h +++ b/arch/blackfin/mach-bf548/include/mach/gpio.h | |||
| @@ -195,17 +195,17 @@ | |||
| 195 | struct gpio_port_t { | 195 | struct gpio_port_t { |
| 196 | unsigned short port_fer; | 196 | unsigned short port_fer; |
| 197 | unsigned short dummy1; | 197 | unsigned short dummy1; |
| 198 | unsigned short port_data; | 198 | unsigned short data; |
| 199 | unsigned short dummy2; | 199 | unsigned short dummy2; |
| 200 | unsigned short port_set; | 200 | unsigned short data_set; |
| 201 | unsigned short dummy3; | 201 | unsigned short dummy3; |
| 202 | unsigned short port_clear; | 202 | unsigned short data_clear; |
| 203 | unsigned short dummy4; | 203 | unsigned short dummy4; |
| 204 | unsigned short port_dir_set; | 204 | unsigned short dir_set; |
| 205 | unsigned short dummy5; | 205 | unsigned short dummy5; |
| 206 | unsigned short port_dir_clear; | 206 | unsigned short dir_clear; |
| 207 | unsigned short dummy6; | 207 | unsigned short dummy6; |
| 208 | unsigned short port_inen; | 208 | unsigned short inen; |
| 209 | unsigned short dummy7; | 209 | unsigned short dummy7; |
| 210 | unsigned int port_mux; | 210 | unsigned int port_mux; |
| 211 | }; | 211 | }; |
diff --git a/arch/blackfin/mach-bf548/include/mach/portmux.h b/arch/blackfin/mach-bf548/include/mach/portmux.h index 8177a567dcdb..ffb1d0a44b4d 100644 --- a/arch/blackfin/mach-bf548/include/mach/portmux.h +++ b/arch/blackfin/mach-bf548/include/mach/portmux.h | |||
| @@ -125,6 +125,7 @@ | |||
| 125 | #define P_KEY_COL2 (P_DEFINED | P_IDENT(GPIO_PD14) | P_FUNCT(3)) | 125 | #define P_KEY_COL2 (P_DEFINED | P_IDENT(GPIO_PD14) | P_FUNCT(3)) |
| 126 | #define P_KEY_COL3 (P_DEFINED | P_IDENT(GPIO_PD15) | P_FUNCT(3)) | 126 | #define P_KEY_COL3 (P_DEFINED | P_IDENT(GPIO_PD15) | P_FUNCT(3)) |
| 127 | 127 | ||
| 128 | #define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL1 | ||
| 128 | #define P_SPI0_SCK (P_DEFINED | P_IDENT(GPIO_PE0) | P_FUNCT(0)) | 129 | #define P_SPI0_SCK (P_DEFINED | P_IDENT(GPIO_PE0) | P_FUNCT(0)) |
| 129 | #define P_SPI0_MISO (P_DEFINED | P_IDENT(GPIO_PE1) | P_FUNCT(0)) | 130 | #define P_SPI0_MISO (P_DEFINED | P_IDENT(GPIO_PE1) | P_FUNCT(0)) |
| 130 | #define P_SPI0_MOSI (P_DEFINED | P_IDENT(GPIO_PE2) | P_FUNCT(0)) | 131 | #define P_SPI0_MOSI (P_DEFINED | P_IDENT(GPIO_PE2) | P_FUNCT(0)) |
diff --git a/arch/blackfin/mach-bf561/include/mach/defBF561.h b/arch/blackfin/mach-bf561/include/mach/defBF561.h index d7c509759659..cf922295f4ce 100644 --- a/arch/blackfin/mach-bf561/include/mach/defBF561.h +++ b/arch/blackfin/mach-bf561/include/mach/defBF561.h | |||
| @@ -1106,6 +1106,8 @@ | |||
| 1106 | #define DLEN_8 0x0 /* PPI Data Length mask for DLEN=8 */ | 1106 | #define DLEN_8 0x0 /* PPI Data Length mask for DLEN=8 */ |
| 1107 | #define DLEN(x) (((x-9) & 0x07) << 11) /* PPI Data Length (only works for x=10-->x=16) */ | 1107 | #define DLEN(x) (((x-9) & 0x07) << 11) /* PPI Data Length (only works for x=10-->x=16) */ |
| 1108 | #define POL 0x0000C000 /* PPI Signal Polarities */ | 1108 | #define POL 0x0000C000 /* PPI Signal Polarities */ |
| 1109 | #define POLC 0x4000 /* PPI Clock Polarity */ | ||
| 1110 | #define POLS 0x8000 /* PPI Frame Sync Polarity */ | ||
| 1109 | 1111 | ||
| 1110 | /* PPI_STATUS Masks */ | 1112 | /* PPI_STATUS Masks */ |
| 1111 | #define FLD 0x00000400 /* Field Indicator */ | 1113 | #define FLD 0x00000400 /* Field Indicator */ |
diff --git a/arch/blackfin/mach-bf561/include/mach/portmux.h b/arch/blackfin/mach-bf561/include/mach/portmux.h index a6ee8206efb6..2e5ad6347dea 100644 --- a/arch/blackfin/mach-bf561/include/mach/portmux.h +++ b/arch/blackfin/mach-bf561/include/mach/portmux.h | |||
| @@ -85,5 +85,6 @@ | |||
| 85 | #define P_SPI0_MOSI (P_DONTCARE) | 85 | #define P_SPI0_MOSI (P_DONTCARE) |
| 86 | #define P_SPI0_MISO (P_DONTCARE) | 86 | #define P_SPI0_MISO (P_DONTCARE) |
| 87 | #define P_SPI0_SCK (P_DONTCARE) | 87 | #define P_SPI0_SCK (P_DONTCARE) |
| 88 | #define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2 | ||
| 88 | 89 | ||
| 89 | #endif /* _MACH_PORTMUX_H_ */ | 90 | #endif /* _MACH_PORTMUX_H_ */ |
diff --git a/arch/blackfin/mach-common/clocks-init.c b/arch/blackfin/mach-common/clocks-init.c index 5d182abefc7b..9dddb6f8cc85 100644 --- a/arch/blackfin/mach-common/clocks-init.c +++ b/arch/blackfin/mach-common/clocks-init.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <asm/clocks.h> | 14 | #include <asm/clocks.h> |
| 15 | #include <asm/mem_init.h> | 15 | #include <asm/mem_init.h> |
| 16 | 16 | ||
| 17 | #define SDGCTL_WIDTH (1 << 31) /* SDRAM external data path width */ | ||
| 17 | #define PLL_CTL_VAL \ | 18 | #define PLL_CTL_VAL \ |
| 18 | (((CONFIG_VCO_MULT & 63) << 9) | CLKIN_HALF | \ | 19 | (((CONFIG_VCO_MULT & 63) << 9) | CLKIN_HALF | \ |
| 19 | (PLL_BYPASS << 8) | (ANOMALY_05000265 ? 0x8000 : 0)) | 20 | (PLL_BYPASS << 8) | (ANOMALY_05000265 ? 0x8000 : 0)) |
| @@ -76,7 +77,7 @@ void init_clocks(void) | |||
| 76 | bfin_write_PLL_DIV(CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV); | 77 | bfin_write_PLL_DIV(CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV); |
| 77 | #ifdef EBIU_SDGCTL | 78 | #ifdef EBIU_SDGCTL |
| 78 | bfin_write_EBIU_SDRRC(mem_SDRRC); | 79 | bfin_write_EBIU_SDRRC(mem_SDRRC); |
| 79 | bfin_write_EBIU_SDGCTL(mem_SDGCTL); | 80 | bfin_write_EBIU_SDGCTL((bfin_read_EBIU_SDGCTL() & SDGCTL_WIDTH) | mem_SDGCTL); |
| 80 | #else | 81 | #else |
| 81 | bfin_write_EBIU_RSTCTL(bfin_read_EBIU_RSTCTL() & ~(SRREQ)); | 82 | bfin_write_EBIU_RSTCTL(bfin_read_EBIU_RSTCTL() & ~(SRREQ)); |
| 82 | do_sync(); | 83 | do_sync(); |
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S index fae774651374..88de053bbe8e 100644 --- a/arch/blackfin/mach-common/entry.S +++ b/arch/blackfin/mach-common/entry.S | |||
| @@ -151,13 +151,6 @@ ENTRY(_ex_syscall) | |||
| 151 | jump.s _bfin_return_from_exception; | 151 | jump.s _bfin_return_from_exception; |
| 152 | ENDPROC(_ex_syscall) | 152 | ENDPROC(_ex_syscall) |
| 153 | 153 | ||
| 154 | ENTRY(_ex_soft_bp) | ||
| 155 | r7 = retx; | ||
| 156 | r7 += -2; | ||
| 157 | retx = r7; | ||
| 158 | jump.s _ex_trap_c; | ||
| 159 | ENDPROC(_ex_soft_bp) | ||
| 160 | |||
| 161 | ENTRY(_ex_single_step) | 154 | ENTRY(_ex_single_step) |
| 162 | /* If we just returned from an interrupt, the single step event is | 155 | /* If we just returned from an interrupt, the single step event is |
| 163 | for the RTI instruction. */ | 156 | for the RTI instruction. */ |
| @@ -1087,7 +1080,7 @@ ENTRY(_ex_table) | |||
| 1087 | * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined | 1080 | * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined |
| 1088 | */ | 1081 | */ |
| 1089 | .long _ex_syscall /* 0x00 - User Defined - Linux Syscall */ | 1082 | .long _ex_syscall /* 0x00 - User Defined - Linux Syscall */ |
| 1090 | .long _ex_soft_bp /* 0x01 - User Defined - Software breakpoint */ | 1083 | .long _ex_trap_c /* 0x01 - User Defined - Software breakpoint */ |
| 1091 | #ifdef CONFIG_KGDB | 1084 | #ifdef CONFIG_KGDB |
| 1092 | .long _ex_trap_c /* 0x02 - User Defined - KGDB initial connection | 1085 | .long _ex_trap_c /* 0x02 - User Defined - KGDB initial connection |
| 1093 | and break signal trap */ | 1086 | and break signal trap */ |
diff --git a/arch/blackfin/mach-common/head.S b/arch/blackfin/mach-common/head.S index e1e42c029e15..698d4c05947e 100644 --- a/arch/blackfin/mach-common/head.S +++ b/arch/blackfin/mach-common/head.S | |||
| @@ -17,6 +17,19 @@ | |||
| 17 | 17 | ||
| 18 | __INIT | 18 | __INIT |
| 19 | 19 | ||
| 20 | ENTRY(__init_clear_bss) | ||
| 21 | r2 = r2 - r1; | ||
| 22 | cc = r2 == 0; | ||
| 23 | if cc jump .L_bss_done; | ||
| 24 | r2 >>= 2; | ||
| 25 | p1 = r1; | ||
| 26 | p2 = r2; | ||
| 27 | lsetup (1f, 1f) lc0 = p2; | ||
| 28 | 1: [p1++] = r0; | ||
| 29 | .L_bss_done: | ||
| 30 | rts; | ||
| 31 | ENDPROC(__init_clear_bss) | ||
| 32 | |||
| 20 | #define INITIAL_STACK (L1_SCRATCH_START + L1_SCRATCH_LENGTH - 12) | 33 | #define INITIAL_STACK (L1_SCRATCH_START + L1_SCRATCH_LENGTH - 12) |
| 21 | 34 | ||
| 22 | ENTRY(__start) | 35 | ENTRY(__start) |
| @@ -144,6 +157,35 @@ ENTRY(__start) | |||
| 144 | call _init_early_exception_vectors; | 157 | call _init_early_exception_vectors; |
| 145 | #endif | 158 | #endif |
| 146 | 159 | ||
| 160 | r0 = 0 (x); | ||
| 161 | /* Zero out all of the fun bss regions */ | ||
| 162 | #if L1_DATA_A_LENGTH > 0 | ||
| 163 | r1.l = __sbss_l1; | ||
| 164 | r1.h = __sbss_l1; | ||
| 165 | r2.l = __ebss_l1; | ||
| 166 | r2.h = __ebss_l1; | ||
| 167 | call __init_clear_bss | ||
| 168 | #endif | ||
| 169 | #if L1_DATA_B_LENGTH > 0 | ||
| 170 | r1.l = __sbss_b_l1; | ||
| 171 | r1.h = __sbss_b_l1; | ||
| 172 | r2.l = __ebss_b_l1; | ||
| 173 | r2.h = __ebss_b_l1; | ||
| 174 | call __init_clear_bss | ||
| 175 | #endif | ||
| 176 | #if L2_LENGTH > 0 | ||
| 177 | r1.l = __sbss_l2; | ||
| 178 | r1.h = __sbss_l2; | ||
| 179 | r2.l = __ebss_l2; | ||
| 180 | r2.h = __ebss_l2; | ||
| 181 | call __init_clear_bss | ||
| 182 | #endif | ||
| 183 | r1.l = ___bss_start; | ||
| 184 | r1.h = ___bss_start; | ||
| 185 | r2.l = ___bss_stop; | ||
| 186 | r2.h = ___bss_stop; | ||
| 187 | call __init_clear_bss | ||
| 188 | |||
| 147 | /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ | 189 | /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ |
| 148 | call _bfin_relocate_l1_mem; | 190 | call _bfin_relocate_l1_mem; |
| 149 | #ifdef CONFIG_BFIN_KERNEL_CLOCK | 191 | #ifdef CONFIG_BFIN_KERNEL_CLOCK |
| @@ -185,19 +227,6 @@ ENDPROC(__start) | |||
| 185 | # define WDOG_CTL WDOGA_CTL | 227 | # define WDOG_CTL WDOGA_CTL |
| 186 | #endif | 228 | #endif |
| 187 | 229 | ||
| 188 | ENTRY(__init_clear_bss) | ||
| 189 | r2 = r2 - r1; | ||
| 190 | cc = r2 == 0; | ||
| 191 | if cc jump .L_bss_done; | ||
| 192 | r2 >>= 2; | ||
| 193 | p1 = r1; | ||
| 194 | p2 = r2; | ||
| 195 | lsetup (1f, 1f) lc0 = p2; | ||
| 196 | 1: [p1++] = r0; | ||
| 197 | .L_bss_done: | ||
| 198 | rts; | ||
| 199 | ENDPROC(__init_clear_bss) | ||
| 200 | |||
| 201 | ENTRY(_real_start) | 230 | ENTRY(_real_start) |
| 202 | /* Enable nested interrupts */ | 231 | /* Enable nested interrupts */ |
| 203 | [--sp] = reti; | 232 | [--sp] = reti; |
| @@ -209,35 +238,6 @@ ENTRY(_real_start) | |||
| 209 | w[p0] = r0; | 238 | w[p0] = r0; |
| 210 | ssync; | 239 | ssync; |
| 211 | 240 | ||
| 212 | r0 = 0 (x); | ||
| 213 | /* Zero out all of the fun bss regions */ | ||
| 214 | #if L1_DATA_A_LENGTH > 0 | ||
| 215 | r1.l = __sbss_l1; | ||
| 216 | r1.h = __sbss_l1; | ||
| 217 | r2.l = __ebss_l1; | ||
| 218 | r2.h = __ebss_l1; | ||
| 219 | call __init_clear_bss | ||
| 220 | #endif | ||
| 221 | #if L1_DATA_B_LENGTH > 0 | ||
| 222 | r1.l = __sbss_b_l1; | ||
| 223 | r1.h = __sbss_b_l1; | ||
| 224 | r2.l = __ebss_b_l1; | ||
| 225 | r2.h = __ebss_b_l1; | ||
| 226 | call __init_clear_bss | ||
| 227 | #endif | ||
| 228 | #if L2_LENGTH > 0 | ||
| 229 | r1.l = __sbss_l2; | ||
| 230 | r1.h = __sbss_l2; | ||
| 231 | r2.l = __ebss_l2; | ||
| 232 | r2.h = __ebss_l2; | ||
| 233 | call __init_clear_bss | ||
| 234 | #endif | ||
| 235 | r1.l = ___bss_start; | ||
| 236 | r1.h = ___bss_start; | ||
| 237 | r2.l = ___bss_stop; | ||
| 238 | r2.h = ___bss_stop; | ||
| 239 | call __init_clear_bss | ||
| 240 | |||
| 241 | /* Pass the u-boot arguments to the global value command line */ | 241 | /* Pass the u-boot arguments to the global value command line */ |
| 242 | R0 = R7; | 242 | R0 = R7; |
| 243 | call _cmdline_init; | 243 | call _cmdline_init; |
diff --git a/arch/blackfin/mach-common/interrupt.S b/arch/blackfin/mach-common/interrupt.S index 473df0f7fa78..43c4eb9acb65 100644 --- a/arch/blackfin/mach-common/interrupt.S +++ b/arch/blackfin/mach-common/interrupt.S | |||
| @@ -195,7 +195,7 @@ ENDPROC(_evt_ivhw) | |||
| 195 | /* Interrupt routine for evt2 (NMI). | 195 | /* Interrupt routine for evt2 (NMI). |
| 196 | * We don't actually use this, so just return. | 196 | * We don't actually use this, so just return. |
| 197 | * For inner circle type details, please see: | 197 | * For inner circle type details, please see: |
| 198 | * http://docs.blackfin.uclinux.org/doku.php?id=linux:nmi | 198 | * http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:nmi |
| 199 | */ | 199 | */ |
| 200 | ENTRY(_evt_nmi) | 200 | ENTRY(_evt_nmi) |
| 201 | .weak _evt_nmi | 201 | .weak _evt_nmi |
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c index 1bba6030dce9..202494568c6c 100644 --- a/arch/blackfin/mach-common/ints-priority.c +++ b/arch/blackfin/mach-common/ints-priority.c | |||
| @@ -1101,10 +1101,9 @@ int __init init_arch_irq(void) | |||
| 1101 | IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 | | 1101 | IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 | |
| 1102 | IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW; | 1102 | IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW; |
| 1103 | 1103 | ||
| 1104 | #if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) \ | 1104 | #ifdef SIC_IWR0 |
| 1105 | || defined(BF538_FAMILY) || defined(CONFIG_BF51x) | ||
| 1106 | bfin_write_SIC_IWR0(IWR_DISABLE_ALL); | 1105 | bfin_write_SIC_IWR0(IWR_DISABLE_ALL); |
| 1107 | #if defined(CONFIG_BF52x) || defined(CONFIG_BF51x) | 1106 | # ifdef SIC_IWR1 |
| 1108 | /* BF52x/BF51x system reset does not properly reset SIC_IWR1 which | 1107 | /* BF52x/BF51x system reset does not properly reset SIC_IWR1 which |
| 1109 | * will screw up the bootrom as it relies on MDMA0/1 waking it | 1108 | * will screw up the bootrom as it relies on MDMA0/1 waking it |
| 1110 | * up from IDLE instructions. See this report for more info: | 1109 | * up from IDLE instructions. See this report for more info: |
| @@ -1114,10 +1113,8 @@ int __init init_arch_irq(void) | |||
| 1114 | bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11)); | 1113 | bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11)); |
| 1115 | else | 1114 | else |
| 1116 | bfin_write_SIC_IWR1(IWR_DISABLE_ALL); | 1115 | bfin_write_SIC_IWR1(IWR_DISABLE_ALL); |
| 1117 | #else | 1116 | # endif |
| 1118 | bfin_write_SIC_IWR1(IWR_DISABLE_ALL); | 1117 | # ifdef SIC_IWR2 |
| 1119 | #endif | ||
| 1120 | # ifdef CONFIG_BF54x | ||
| 1121 | bfin_write_SIC_IWR2(IWR_DISABLE_ALL); | 1118 | bfin_write_SIC_IWR2(IWR_DISABLE_ALL); |
| 1122 | # endif | 1119 | # endif |
| 1123 | #else | 1120 | #else |
diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c index d3d70fd67c16..f48a6aebb49b 100644 --- a/arch/blackfin/mach-common/pm.c +++ b/arch/blackfin/mach-common/pm.c | |||
| @@ -82,10 +82,9 @@ void bfin_pm_suspend_standby_enter(void) | |||
| 82 | 82 | ||
| 83 | bfin_pm_standby_restore(); | 83 | bfin_pm_standby_restore(); |
| 84 | 84 | ||
| 85 | #if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) || \ | 85 | #ifdef SIC_IWR0 |
| 86 | defined(CONFIG_BF538) || defined(CONFIG_BF539) || defined(CONFIG_BF51x) | ||
| 87 | bfin_write_SIC_IWR0(IWR_DISABLE_ALL); | 86 | bfin_write_SIC_IWR0(IWR_DISABLE_ALL); |
| 88 | #if defined(CONFIG_BF52x) || defined(CONFIG_BF51x) | 87 | # ifdef SIC_IWR1 |
| 89 | /* BF52x system reset does not properly reset SIC_IWR1 which | 88 | /* BF52x system reset does not properly reset SIC_IWR1 which |
| 90 | * will screw up the bootrom as it relies on MDMA0/1 waking it | 89 | * will screw up the bootrom as it relies on MDMA0/1 waking it |
| 91 | * up from IDLE instructions. See this report for more info: | 90 | * up from IDLE instructions. See this report for more info: |
| @@ -95,10 +94,8 @@ void bfin_pm_suspend_standby_enter(void) | |||
| 95 | bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11)); | 94 | bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11)); |
| 96 | else | 95 | else |
| 97 | bfin_write_SIC_IWR1(IWR_DISABLE_ALL); | 96 | bfin_write_SIC_IWR1(IWR_DISABLE_ALL); |
| 98 | #else | 97 | # endif |
| 99 | bfin_write_SIC_IWR1(IWR_DISABLE_ALL); | 98 | # ifdef SIC_IWR2 |
| 100 | #endif | ||
| 101 | # ifdef CONFIG_BF54x | ||
| 102 | bfin_write_SIC_IWR2(IWR_DISABLE_ALL); | 99 | bfin_write_SIC_IWR2(IWR_DISABLE_ALL); |
| 103 | # endif | 100 | # endif |
| 104 | #else | 101 | #else |
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c index caf4c33f4e84..7c35787d29b4 100644 --- a/arch/sh/boards/board-ap325rxa.c +++ b/arch/sh/boards/board-ap325rxa.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
| 23 | #include <linux/spi/spi.h> | 23 | #include <linux/spi/spi.h> |
| 24 | #include <linux/spi/spi_gpio.h> | 24 | #include <linux/spi/spi_gpio.h> |
| 25 | #include <media/ov772x.h> | ||
| 25 | #include <media/soc_camera_platform.h> | 26 | #include <media/soc_camera_platform.h> |
| 26 | #include <media/sh_mobile_ceu.h> | 27 | #include <media/sh_mobile_ceu.h> |
| 27 | #include <video/sh_mobile_lcdc.h> | 28 | #include <video/sh_mobile_lcdc.h> |
| @@ -216,7 +217,14 @@ static struct platform_device lcdc_device = { | |||
| 216 | }, | 217 | }, |
| 217 | }; | 218 | }; |
| 218 | 219 | ||
| 220 | static void camera_power(int val) | ||
| 221 | { | ||
| 222 | gpio_set_value(GPIO_PTZ5, val); /* RST_CAM/RSTB */ | ||
| 223 | mdelay(10); | ||
| 224 | } | ||
| 225 | |||
| 219 | #ifdef CONFIG_I2C | 226 | #ifdef CONFIG_I2C |
| 227 | /* support for the old ncm03j camera */ | ||
| 220 | static unsigned char camera_ncm03j_magic[] = | 228 | static unsigned char camera_ncm03j_magic[] = |
| 221 | { | 229 | { |
| 222 | 0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8, | 230 | 0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8, |
| @@ -237,6 +245,23 @@ static unsigned char camera_ncm03j_magic[] = | |||
| 237 | 0x63, 0xD4, 0x64, 0xEA, 0xD6, 0x0F, | 245 | 0x63, 0xD4, 0x64, 0xEA, 0xD6, 0x0F, |
| 238 | }; | 246 | }; |
| 239 | 247 | ||
| 248 | static int camera_probe(void) | ||
| 249 | { | ||
| 250 | struct i2c_adapter *a = i2c_get_adapter(0); | ||
| 251 | struct i2c_msg msg; | ||
| 252 | int ret; | ||
| 253 | |||
| 254 | camera_power(1); | ||
| 255 | msg.addr = 0x6e; | ||
| 256 | msg.buf = camera_ncm03j_magic; | ||
| 257 | msg.len = 2; | ||
| 258 | msg.flags = 0; | ||
| 259 | ret = i2c_transfer(a, &msg, 1); | ||
| 260 | camera_power(0); | ||
| 261 | |||
| 262 | return ret; | ||
| 263 | } | ||
| 264 | |||
| 240 | static int camera_set_capture(struct soc_camera_platform_info *info, | 265 | static int camera_set_capture(struct soc_camera_platform_info *info, |
| 241 | int enable) | 266 | int enable) |
| 242 | { | 267 | { |
| @@ -245,9 +270,11 @@ static int camera_set_capture(struct soc_camera_platform_info *info, | |||
| 245 | int ret = 0; | 270 | int ret = 0; |
| 246 | int i; | 271 | int i; |
| 247 | 272 | ||
| 273 | camera_power(0); | ||
| 248 | if (!enable) | 274 | if (!enable) |
| 249 | return 0; /* no disable for now */ | 275 | return 0; /* no disable for now */ |
| 250 | 276 | ||
| 277 | camera_power(1); | ||
| 251 | for (i = 0; i < ARRAY_SIZE(camera_ncm03j_magic); i += 2) { | 278 | for (i = 0; i < ARRAY_SIZE(camera_ncm03j_magic); i += 2) { |
| 252 | u_int8_t buf[8]; | 279 | u_int8_t buf[8]; |
| 253 | 280 | ||
| @@ -286,8 +313,35 @@ static struct platform_device camera_device = { | |||
| 286 | .platform_data = &camera_info, | 313 | .platform_data = &camera_info, |
| 287 | }, | 314 | }, |
| 288 | }; | 315 | }; |
| 316 | |||
| 317 | static int __init camera_setup(void) | ||
| 318 | { | ||
| 319 | if (camera_probe() > 0) | ||
| 320 | platform_device_register(&camera_device); | ||
| 321 | |||
| 322 | return 0; | ||
| 323 | } | ||
| 324 | late_initcall(camera_setup); | ||
| 325 | |||
| 289 | #endif /* CONFIG_I2C */ | 326 | #endif /* CONFIG_I2C */ |
| 290 | 327 | ||
| 328 | static int ov7725_power(struct device *dev, int mode) | ||
| 329 | { | ||
| 330 | camera_power(0); | ||
| 331 | if (mode) | ||
| 332 | camera_power(1); | ||
| 333 | |||
| 334 | return 0; | ||
| 335 | } | ||
| 336 | |||
| 337 | static struct ov772x_camera_info ov7725_info = { | ||
| 338 | .buswidth = SOCAM_DATAWIDTH_8, | ||
| 339 | .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP, | ||
| 340 | .link = { | ||
| 341 | .power = ov7725_power, | ||
| 342 | }, | ||
| 343 | }; | ||
| 344 | |||
| 291 | static struct sh_mobile_ceu_info sh_mobile_ceu_info = { | 345 | static struct sh_mobile_ceu_info sh_mobile_ceu_info = { |
| 292 | .flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH | | 346 | .flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH | |
| 293 | SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8, | 347 | SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8, |
| @@ -338,9 +392,6 @@ static struct platform_device *ap325rxa_devices[] __initdata = { | |||
| 338 | &ap325rxa_nor_flash_device, | 392 | &ap325rxa_nor_flash_device, |
| 339 | &lcdc_device, | 393 | &lcdc_device, |
| 340 | &ceu_device, | 394 | &ceu_device, |
| 341 | #ifdef CONFIG_I2C | ||
| 342 | &camera_device, | ||
| 343 | #endif | ||
| 344 | &nand_flash_device, | 395 | &nand_flash_device, |
| 345 | &sdcard_cn3_device, | 396 | &sdcard_cn3_device, |
| 346 | }; | 397 | }; |
| @@ -349,6 +400,10 @@ static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = { | |||
| 349 | { | 400 | { |
| 350 | I2C_BOARD_INFO("pcf8563", 0x51), | 401 | I2C_BOARD_INFO("pcf8563", 0x51), |
| 351 | }, | 402 | }, |
| 403 | { | ||
| 404 | I2C_BOARD_INFO("ov772x", 0x21), | ||
| 405 | .platform_data = &ov7725_info, | ||
| 406 | }, | ||
| 352 | }; | 407 | }; |
| 353 | 408 | ||
| 354 | static struct spi_board_info ap325rxa_spi_devices[] = { | 409 | static struct spi_board_info ap325rxa_spi_devices[] = { |
| @@ -426,7 +481,7 @@ static int __init ap325rxa_devices_setup(void) | |||
| 426 | gpio_request(GPIO_PTZ6, NULL); | 481 | gpio_request(GPIO_PTZ6, NULL); |
| 427 | gpio_direction_output(GPIO_PTZ6, 0); /* STBY_CAM */ | 482 | gpio_direction_output(GPIO_PTZ6, 0); /* STBY_CAM */ |
| 428 | gpio_request(GPIO_PTZ5, NULL); | 483 | gpio_request(GPIO_PTZ5, NULL); |
| 429 | gpio_direction_output(GPIO_PTZ5, 1); /* RST_CAM */ | 484 | gpio_direction_output(GPIO_PTZ5, 0); /* RST_CAM */ |
| 430 | gpio_request(GPIO_PTZ4, NULL); | 485 | gpio_request(GPIO_PTZ4, NULL); |
| 431 | gpio_direction_output(GPIO_PTZ4, 0); /* SADDR */ | 486 | gpio_direction_output(GPIO_PTZ4, 0); /* SADDR */ |
| 432 | 487 | ||
diff --git a/arch/sh/configs/ap325rxa_defconfig b/arch/sh/configs/ap325rxa_defconfig index 5c423fa8e6b8..352f87d50fdc 100644 --- a/arch/sh/configs/ap325rxa_defconfig +++ b/arch/sh/configs/ap325rxa_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.28 | 3 | # Linux kernel version: 2.6.29-rc2 |
| 4 | # Fri Jan 9 16:54:19 2009 | 4 | # Tue Jan 27 11:45:08 2009 |
| 5 | # | 5 | # |
| 6 | CONFIG_SUPERH=y | 6 | CONFIG_SUPERH=y |
| 7 | CONFIG_SUPERH32=y | 7 | CONFIG_SUPERH32=y |
| @@ -45,12 +45,12 @@ CONFIG_BSD_PROCESS_ACCT=y | |||
| 45 | # CONFIG_AUDIT is not set | 45 | # CONFIG_AUDIT is not set |
| 46 | # CONFIG_IKCONFIG is not set | 46 | # CONFIG_IKCONFIG is not set |
| 47 | CONFIG_LOG_BUF_SHIFT=14 | 47 | CONFIG_LOG_BUF_SHIFT=14 |
| 48 | # CONFIG_CGROUPS is not set | ||
| 49 | CONFIG_GROUP_SCHED=y | 48 | CONFIG_GROUP_SCHED=y |
| 50 | CONFIG_FAIR_GROUP_SCHED=y | 49 | CONFIG_FAIR_GROUP_SCHED=y |
| 51 | # CONFIG_RT_GROUP_SCHED is not set | 50 | # CONFIG_RT_GROUP_SCHED is not set |
| 52 | CONFIG_USER_SCHED=y | 51 | CONFIG_USER_SCHED=y |
| 53 | # CONFIG_CGROUP_SCHED is not set | 52 | # CONFIG_CGROUP_SCHED is not set |
| 53 | # CONFIG_CGROUPS is not set | ||
| 54 | CONFIG_SYSFS_DEPRECATED=y | 54 | CONFIG_SYSFS_DEPRECATED=y |
| 55 | CONFIG_SYSFS_DEPRECATED_V2=y | 55 | CONFIG_SYSFS_DEPRECATED_V2=y |
| 56 | # CONFIG_RELAY is not set | 56 | # CONFIG_RELAY is not set |
| @@ -378,6 +378,7 @@ CONFIG_WIRELESS=y | |||
| 378 | # CONFIG_WIRELESS_EXT is not set | 378 | # CONFIG_WIRELESS_EXT is not set |
| 379 | # CONFIG_LIB80211 is not set | 379 | # CONFIG_LIB80211 is not set |
| 380 | # CONFIG_MAC80211 is not set | 380 | # CONFIG_MAC80211 is not set |
| 381 | # CONFIG_WIMAX is not set | ||
| 381 | # CONFIG_RFKILL is not set | 382 | # CONFIG_RFKILL is not set |
| 382 | # CONFIG_NET_9P is not set | 383 | # CONFIG_NET_9P is not set |
| 383 | 384 | ||
| @@ -400,6 +401,7 @@ CONFIG_MTD=y | |||
| 400 | # CONFIG_MTD_DEBUG is not set | 401 | # CONFIG_MTD_DEBUG is not set |
| 401 | CONFIG_MTD_CONCAT=y | 402 | CONFIG_MTD_CONCAT=y |
| 402 | CONFIG_MTD_PARTITIONS=y | 403 | CONFIG_MTD_PARTITIONS=y |
| 404 | # CONFIG_MTD_TESTS is not set | ||
| 403 | # CONFIG_MTD_REDBOOT_PARTS is not set | 405 | # CONFIG_MTD_REDBOOT_PARTS is not set |
| 404 | CONFIG_MTD_CMDLINE_PARTS=y | 406 | CONFIG_MTD_CMDLINE_PARTS=y |
| 405 | # CONFIG_MTD_AR7_PARTS is not set | 407 | # CONFIG_MTD_AR7_PARTS is not set |
| @@ -447,9 +449,7 @@ CONFIG_MTD_CFI_UTIL=y | |||
| 447 | # | 449 | # |
| 448 | # CONFIG_MTD_COMPLEX_MAPPINGS is not set | 450 | # CONFIG_MTD_COMPLEX_MAPPINGS is not set |
| 449 | CONFIG_MTD_PHYSMAP=y | 451 | CONFIG_MTD_PHYSMAP=y |
| 450 | CONFIG_MTD_PHYSMAP_START=0xffffffff | 452 | # CONFIG_MTD_PHYSMAP_COMPAT is not set |
| 451 | CONFIG_MTD_PHYSMAP_LEN=0 | ||
| 452 | CONFIG_MTD_PHYSMAP_BANKWIDTH=0 | ||
| 453 | # CONFIG_MTD_PLATRAM is not set | 453 | # CONFIG_MTD_PLATRAM is not set |
| 454 | 454 | ||
| 455 | # | 455 | # |
| @@ -480,6 +480,12 @@ CONFIG_MTD_NAND_SH_FLCTL=y | |||
| 480 | # CONFIG_MTD_ONENAND is not set | 480 | # CONFIG_MTD_ONENAND is not set |
| 481 | 481 | ||
| 482 | # | 482 | # |
| 483 | # LPDDR flash memory drivers | ||
| 484 | # | ||
| 485 | # CONFIG_MTD_LPDDR is not set | ||
| 486 | # CONFIG_MTD_QINFO_PROBE is not set | ||
| 487 | |||
| 488 | # | ||
| 483 | # UBI - Unsorted block images | 489 | # UBI - Unsorted block images |
| 484 | # | 490 | # |
| 485 | CONFIG_MTD_UBI=y | 491 | CONFIG_MTD_UBI=y |
| @@ -607,6 +613,10 @@ CONFIG_SMSC911X=y | |||
| 607 | # CONFIG_WLAN_PRE80211 is not set | 613 | # CONFIG_WLAN_PRE80211 is not set |
| 608 | # CONFIG_WLAN_80211 is not set | 614 | # CONFIG_WLAN_80211 is not set |
| 609 | # CONFIG_IWLWIFI_LEDS is not set | 615 | # CONFIG_IWLWIFI_LEDS is not set |
| 616 | |||
| 617 | # | ||
| 618 | # Enable WiMAX (Networking options) to see the WiMAX drivers | ||
| 619 | # | ||
| 610 | # CONFIG_WAN is not set | 620 | # CONFIG_WAN is not set |
| 611 | # CONFIG_PPP is not set | 621 | # CONFIG_PPP is not set |
| 612 | # CONFIG_SLIP is not set | 622 | # CONFIG_SLIP is not set |
| @@ -790,6 +800,7 @@ CONFIG_SSB_POSSIBLE=y | |||
| 790 | # CONFIG_PMIC_DA903X is not set | 800 | # CONFIG_PMIC_DA903X is not set |
| 791 | # CONFIG_MFD_WM8400 is not set | 801 | # CONFIG_MFD_WM8400 is not set |
| 792 | # CONFIG_MFD_WM8350_I2C is not set | 802 | # CONFIG_MFD_WM8350_I2C is not set |
| 803 | # CONFIG_MFD_PCF50633 is not set | ||
| 793 | # CONFIG_REGULATOR is not set | 804 | # CONFIG_REGULATOR is not set |
| 794 | 805 | ||
| 795 | # | 806 | # |
| @@ -837,7 +848,7 @@ CONFIG_SOC_CAMERA=y | |||
| 837 | # CONFIG_SOC_CAMERA_MT9V022 is not set | 848 | # CONFIG_SOC_CAMERA_MT9V022 is not set |
| 838 | # CONFIG_SOC_CAMERA_TW9910 is not set | 849 | # CONFIG_SOC_CAMERA_TW9910 is not set |
| 839 | CONFIG_SOC_CAMERA_PLATFORM=y | 850 | CONFIG_SOC_CAMERA_PLATFORM=y |
| 840 | # CONFIG_SOC_CAMERA_OV772X is not set | 851 | CONFIG_SOC_CAMERA_OV772X=y |
| 841 | CONFIG_VIDEO_SH_MOBILE_CEU=y | 852 | CONFIG_VIDEO_SH_MOBILE_CEU=y |
| 842 | # CONFIG_RADIO_ADAPTERS is not set | 853 | # CONFIG_RADIO_ADAPTERS is not set |
| 843 | # CONFIG_DAB is not set | 854 | # CONFIG_DAB is not set |
| @@ -1012,6 +1023,7 @@ CONFIG_FS_POSIX_ACL=y | |||
| 1012 | CONFIG_FILE_LOCKING=y | 1023 | CONFIG_FILE_LOCKING=y |
| 1013 | # CONFIG_XFS_FS is not set | 1024 | # CONFIG_XFS_FS is not set |
| 1014 | # CONFIG_OCFS2_FS is not set | 1025 | # CONFIG_OCFS2_FS is not set |
| 1026 | # CONFIG_BTRFS_FS is not set | ||
| 1015 | CONFIG_DNOTIFY=y | 1027 | CONFIG_DNOTIFY=y |
| 1016 | CONFIG_INOTIFY=y | 1028 | CONFIG_INOTIFY=y |
| 1017 | CONFIG_INOTIFY_USER=y | 1029 | CONFIG_INOTIFY_USER=y |
| @@ -1060,6 +1072,7 @@ CONFIG_MISC_FILESYSTEMS=y | |||
| 1060 | # CONFIG_JFFS2_FS is not set | 1072 | # CONFIG_JFFS2_FS is not set |
| 1061 | # CONFIG_UBIFS_FS is not set | 1073 | # CONFIG_UBIFS_FS is not set |
| 1062 | # CONFIG_CRAMFS is not set | 1074 | # CONFIG_CRAMFS is not set |
| 1075 | # CONFIG_SQUASHFS is not set | ||
| 1063 | # CONFIG_VXFS_FS is not set | 1076 | # CONFIG_VXFS_FS is not set |
| 1064 | # CONFIG_MINIX_FS is not set | 1077 | # CONFIG_MINIX_FS is not set |
| 1065 | # CONFIG_OMFS_FS is not set | 1078 | # CONFIG_OMFS_FS is not set |
diff --git a/arch/sh/configs/migor_defconfig b/arch/sh/configs/migor_defconfig index 7758263514bc..678576796bdf 100644 --- a/arch/sh/configs/migor_defconfig +++ b/arch/sh/configs/migor_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.28 | 3 | # Linux kernel version: 2.6.29-rc1 |
| 4 | # Fri Jan 9 17:09:35 2009 | 4 | # Thu Jan 22 09:16:16 2009 |
| 5 | # | 5 | # |
| 6 | CONFIG_SUPERH=y | 6 | CONFIG_SUPERH=y |
| 7 | CONFIG_SUPERH32=y | 7 | CONFIG_SUPERH32=y |
| @@ -45,8 +45,12 @@ CONFIG_SYSVIPC_SYSCTL=y | |||
| 45 | CONFIG_IKCONFIG=y | 45 | CONFIG_IKCONFIG=y |
| 46 | CONFIG_IKCONFIG_PROC=y | 46 | CONFIG_IKCONFIG_PROC=y |
| 47 | CONFIG_LOG_BUF_SHIFT=14 | 47 | CONFIG_LOG_BUF_SHIFT=14 |
| 48 | # CONFIG_CGROUPS is not set | ||
| 49 | # CONFIG_GROUP_SCHED is not set | 48 | # CONFIG_GROUP_SCHED is not set |
| 49 | |||
| 50 | # | ||
| 51 | # Control Group support | ||
| 52 | # | ||
| 53 | # CONFIG_CGROUPS is not set | ||
| 50 | CONFIG_SYSFS_DEPRECATED=y | 54 | CONFIG_SYSFS_DEPRECATED=y |
| 51 | CONFIG_SYSFS_DEPRECATED_V2=y | 55 | CONFIG_SYSFS_DEPRECATED_V2=y |
| 52 | # CONFIG_RELAY is not set | 56 | # CONFIG_RELAY is not set |
| @@ -389,6 +393,7 @@ CONFIG_WIRELESS_EXT=y | |||
| 389 | CONFIG_WIRELESS_EXT_SYSFS=y | 393 | CONFIG_WIRELESS_EXT_SYSFS=y |
| 390 | # CONFIG_LIB80211 is not set | 394 | # CONFIG_LIB80211 is not set |
| 391 | # CONFIG_MAC80211 is not set | 395 | # CONFIG_MAC80211 is not set |
| 396 | # CONFIG_WIMAX is not set | ||
| 392 | # CONFIG_RFKILL is not set | 397 | # CONFIG_RFKILL is not set |
| 393 | # CONFIG_NET_9P is not set | 398 | # CONFIG_NET_9P is not set |
| 394 | 399 | ||
| @@ -411,6 +416,7 @@ CONFIG_MTD=y | |||
| 411 | # CONFIG_MTD_DEBUG is not set | 416 | # CONFIG_MTD_DEBUG is not set |
| 412 | CONFIG_MTD_CONCAT=y | 417 | CONFIG_MTD_CONCAT=y |
| 413 | CONFIG_MTD_PARTITIONS=y | 418 | CONFIG_MTD_PARTITIONS=y |
| 419 | # CONFIG_MTD_TESTS is not set | ||
| 414 | # CONFIG_MTD_REDBOOT_PARTS is not set | 420 | # CONFIG_MTD_REDBOOT_PARTS is not set |
| 415 | CONFIG_MTD_CMDLINE_PARTS=y | 421 | CONFIG_MTD_CMDLINE_PARTS=y |
| 416 | # CONFIG_MTD_AR7_PARTS is not set | 422 | # CONFIG_MTD_AR7_PARTS is not set |
| @@ -458,9 +464,7 @@ CONFIG_MTD_CFI_UTIL=y | |||
| 458 | # | 464 | # |
| 459 | # CONFIG_MTD_COMPLEX_MAPPINGS is not set | 465 | # CONFIG_MTD_COMPLEX_MAPPINGS is not set |
| 460 | CONFIG_MTD_PHYSMAP=y | 466 | CONFIG_MTD_PHYSMAP=y |
| 461 | CONFIG_MTD_PHYSMAP_START=0xffffffff | 467 | # CONFIG_MTD_PHYSMAP_COMPAT is not set |
| 462 | CONFIG_MTD_PHYSMAP_LEN=0 | ||
| 463 | CONFIG_MTD_PHYSMAP_BANKWIDTH=0 | ||
| 464 | # CONFIG_MTD_PLATRAM is not set | 468 | # CONFIG_MTD_PLATRAM is not set |
| 465 | 469 | ||
| 466 | # | 470 | # |
| @@ -488,6 +492,12 @@ CONFIG_MTD_NAND_PLATFORM=y | |||
| 488 | # CONFIG_MTD_ONENAND is not set | 492 | # CONFIG_MTD_ONENAND is not set |
| 489 | 493 | ||
| 490 | # | 494 | # |
| 495 | # LPDDR flash memory drivers | ||
| 496 | # | ||
| 497 | # CONFIG_MTD_LPDDR is not set | ||
| 498 | # CONFIG_MTD_QINFO_PROBE is not set | ||
| 499 | |||
| 500 | # | ||
| 491 | # UBI - Unsorted block images | 501 | # UBI - Unsorted block images |
| 492 | # | 502 | # |
| 493 | # CONFIG_MTD_UBI is not set | 503 | # CONFIG_MTD_UBI is not set |
| @@ -587,6 +597,10 @@ CONFIG_SMC91X=y | |||
| 587 | # CONFIG_WLAN_PRE80211 is not set | 597 | # CONFIG_WLAN_PRE80211 is not set |
| 588 | # CONFIG_WLAN_80211 is not set | 598 | # CONFIG_WLAN_80211 is not set |
| 589 | # CONFIG_IWLWIFI_LEDS is not set | 599 | # CONFIG_IWLWIFI_LEDS is not set |
| 600 | |||
| 601 | # | ||
| 602 | # Enable WiMAX (Networking options) to see the WiMAX drivers | ||
| 603 | # | ||
| 590 | # CONFIG_WAN is not set | 604 | # CONFIG_WAN is not set |
| 591 | # CONFIG_PPP is not set | 605 | # CONFIG_PPP is not set |
| 592 | # CONFIG_SLIP is not set | 606 | # CONFIG_SLIP is not set |
| @@ -761,6 +775,7 @@ CONFIG_SSB_POSSIBLE=y | |||
| 761 | # CONFIG_PMIC_DA903X is not set | 775 | # CONFIG_PMIC_DA903X is not set |
| 762 | # CONFIG_MFD_WM8400 is not set | 776 | # CONFIG_MFD_WM8400 is not set |
| 763 | # CONFIG_MFD_WM8350_I2C is not set | 777 | # CONFIG_MFD_WM8350_I2C is not set |
| 778 | # CONFIG_MFD_PCF50633 is not set | ||
| 764 | # CONFIG_REGULATOR is not set | 779 | # CONFIG_REGULATOR is not set |
| 765 | 780 | ||
| 766 | # | 781 | # |
| @@ -806,9 +821,9 @@ CONFIG_SOC_CAMERA=y | |||
| 806 | # CONFIG_SOC_CAMERA_MT9M111 is not set | 821 | # CONFIG_SOC_CAMERA_MT9M111 is not set |
| 807 | # CONFIG_SOC_CAMERA_MT9T031 is not set | 822 | # CONFIG_SOC_CAMERA_MT9T031 is not set |
| 808 | # CONFIG_SOC_CAMERA_MT9V022 is not set | 823 | # CONFIG_SOC_CAMERA_MT9V022 is not set |
| 809 | # CONFIG_SOC_CAMERA_TW9910 is not set | 824 | CONFIG_SOC_CAMERA_TW9910=y |
| 810 | CONFIG_SOC_CAMERA_PLATFORM=y | 825 | # CONFIG_SOC_CAMERA_PLATFORM is not set |
| 811 | # CONFIG_SOC_CAMERA_OV772X is not set | 826 | CONFIG_SOC_CAMERA_OV772X=y |
| 812 | CONFIG_VIDEO_SH_MOBILE_CEU=y | 827 | CONFIG_VIDEO_SH_MOBILE_CEU=y |
| 813 | # CONFIG_RADIO_ADAPTERS is not set | 828 | # CONFIG_RADIO_ADAPTERS is not set |
| 814 | # CONFIG_DAB is not set | 829 | # CONFIG_DAB is not set |
| @@ -866,11 +881,13 @@ CONFIG_USB_GADGET_SELECTED=y | |||
| 866 | # CONFIG_USB_GADGET_PXA25X is not set | 881 | # CONFIG_USB_GADGET_PXA25X is not set |
| 867 | # CONFIG_USB_GADGET_PXA27X is not set | 882 | # CONFIG_USB_GADGET_PXA27X is not set |
| 868 | # CONFIG_USB_GADGET_S3C2410 is not set | 883 | # CONFIG_USB_GADGET_S3C2410 is not set |
| 884 | # CONFIG_USB_GADGET_IMX is not set | ||
| 869 | CONFIG_USB_GADGET_M66592=y | 885 | CONFIG_USB_GADGET_M66592=y |
| 870 | CONFIG_USB_M66592=y | 886 | CONFIG_USB_M66592=y |
| 871 | CONFIG_SUPERH_BUILT_IN_M66592=y | 887 | CONFIG_SUPERH_BUILT_IN_M66592=y |
| 872 | # CONFIG_USB_GADGET_AMD5536UDC is not set | 888 | # CONFIG_USB_GADGET_AMD5536UDC is not set |
| 873 | # CONFIG_USB_GADGET_FSL_QE is not set | 889 | # CONFIG_USB_GADGET_FSL_QE is not set |
| 890 | # CONFIG_USB_GADGET_CI13XXX is not set | ||
| 874 | # CONFIG_USB_GADGET_NET2280 is not set | 891 | # CONFIG_USB_GADGET_NET2280 is not set |
| 875 | # CONFIG_USB_GADGET_GOKU is not set | 892 | # CONFIG_USB_GADGET_GOKU is not set |
| 876 | # CONFIG_USB_GADGET_DUMMY_HCD is not set | 893 | # CONFIG_USB_GADGET_DUMMY_HCD is not set |
| @@ -883,6 +900,11 @@ CONFIG_USB_G_SERIAL=y | |||
| 883 | # CONFIG_USB_MIDI_GADGET is not set | 900 | # CONFIG_USB_MIDI_GADGET is not set |
| 884 | # CONFIG_USB_G_PRINTER is not set | 901 | # CONFIG_USB_G_PRINTER is not set |
| 885 | # CONFIG_USB_CDC_COMPOSITE is not set | 902 | # CONFIG_USB_CDC_COMPOSITE is not set |
| 903 | |||
| 904 | # | ||
| 905 | # OTG and related infrastructure | ||
| 906 | # | ||
| 907 | # CONFIG_USB_GPIO_VBUS is not set | ||
| 886 | # CONFIG_MMC is not set | 908 | # CONFIG_MMC is not set |
| 887 | # CONFIG_MEMSTICK is not set | 909 | # CONFIG_MEMSTICK is not set |
| 888 | # CONFIG_NEW_LEDS is not set | 910 | # CONFIG_NEW_LEDS is not set |
| @@ -961,6 +983,7 @@ CONFIG_UIO_PDRV_GENIRQ=y | |||
| 961 | CONFIG_FILE_LOCKING=y | 983 | CONFIG_FILE_LOCKING=y |
| 962 | # CONFIG_XFS_FS is not set | 984 | # CONFIG_XFS_FS is not set |
| 963 | # CONFIG_OCFS2_FS is not set | 985 | # CONFIG_OCFS2_FS is not set |
| 986 | # CONFIG_BTRFS_FS is not set | ||
| 964 | # CONFIG_DNOTIFY is not set | 987 | # CONFIG_DNOTIFY is not set |
| 965 | # CONFIG_INOTIFY is not set | 988 | # CONFIG_INOTIFY is not set |
| 966 | # CONFIG_QUOTA is not set | 989 | # CONFIG_QUOTA is not set |
| @@ -1004,6 +1027,7 @@ CONFIG_MISC_FILESYSTEMS=y | |||
| 1004 | # CONFIG_EFS_FS is not set | 1027 | # CONFIG_EFS_FS is not set |
| 1005 | # CONFIG_JFFS2_FS is not set | 1028 | # CONFIG_JFFS2_FS is not set |
| 1006 | # CONFIG_CRAMFS is not set | 1029 | # CONFIG_CRAMFS is not set |
| 1030 | # CONFIG_SQUASHFS is not set | ||
| 1007 | # CONFIG_VXFS_FS is not set | 1031 | # CONFIG_VXFS_FS is not set |
| 1008 | # CONFIG_MINIX_FS is not set | 1032 | # CONFIG_MINIX_FS is not set |
| 1009 | # CONFIG_OMFS_FS is not set | 1033 | # CONFIG_OMFS_FS is not set |
diff --git a/arch/sh/include/asm/mutex-llsc.h b/arch/sh/include/asm/mutex-llsc.h index ee839ee58ac8..090358a7e1bb 100644 --- a/arch/sh/include/asm/mutex-llsc.h +++ b/arch/sh/include/asm/mutex-llsc.h | |||
| @@ -21,38 +21,36 @@ | |||
| 21 | static inline void | 21 | static inline void |
| 22 | __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *)) | 22 | __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *)) |
| 23 | { | 23 | { |
| 24 | int __ex_flag, __res; | 24 | int __done, __res; |
| 25 | 25 | ||
| 26 | __asm__ __volatile__ ( | 26 | __asm__ __volatile__ ( |
| 27 | "movli.l @%2, %0 \n" | 27 | "movli.l @%2, %0 \n" |
| 28 | "add #-1, %0 \n" | 28 | "add #-1, %0 \n" |
| 29 | "movco.l %0, @%2 \n" | 29 | "movco.l %0, @%2 \n" |
| 30 | "movt %1 \n" | 30 | "movt %1 \n" |
| 31 | : "=&z" (__res), "=&r" (__ex_flag) | 31 | : "=&z" (__res), "=&r" (__done) |
| 32 | : "r" (&(count)->counter) | 32 | : "r" (&(count)->counter) |
| 33 | : "t"); | 33 | : "t"); |
| 34 | 34 | ||
| 35 | __res |= !__ex_flag; | 35 | if (unlikely(!__done || __res != 0)) |
| 36 | if (unlikely(__res != 0)) | ||
| 37 | fail_fn(count); | 36 | fail_fn(count); |
| 38 | } | 37 | } |
| 39 | 38 | ||
| 40 | static inline int | 39 | static inline int |
| 41 | __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) | 40 | __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) |
| 42 | { | 41 | { |
| 43 | int __ex_flag, __res; | 42 | int __done, __res; |
| 44 | 43 | ||
| 45 | __asm__ __volatile__ ( | 44 | __asm__ __volatile__ ( |
| 46 | "movli.l @%2, %0 \n" | 45 | "movli.l @%2, %0 \n" |
| 47 | "add #-1, %0 \n" | 46 | "add #-1, %0 \n" |
| 48 | "movco.l %0, @%2 \n" | 47 | "movco.l %0, @%2 \n" |
| 49 | "movt %1 \n" | 48 | "movt %1 \n" |
| 50 | : "=&z" (__res), "=&r" (__ex_flag) | 49 | : "=&z" (__res), "=&r" (__done) |
| 51 | : "r" (&(count)->counter) | 50 | : "r" (&(count)->counter) |
| 52 | : "t"); | 51 | : "t"); |
| 53 | 52 | ||
| 54 | __res |= !__ex_flag; | 53 | if (unlikely(!__done || __res != 0)) |
| 55 | if (unlikely(__res != 0)) | ||
| 56 | __res = fail_fn(count); | 54 | __res = fail_fn(count); |
| 57 | 55 | ||
| 58 | return __res; | 56 | return __res; |
| @@ -61,19 +59,18 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) | |||
| 61 | static inline void | 59 | static inline void |
| 62 | __mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *)) | 60 | __mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *)) |
| 63 | { | 61 | { |
| 64 | int __ex_flag, __res; | 62 | int __done, __res; |
| 65 | 63 | ||
| 66 | __asm__ __volatile__ ( | 64 | __asm__ __volatile__ ( |
| 67 | "movli.l @%2, %0 \n\t" | 65 | "movli.l @%2, %0 \n\t" |
| 68 | "add #1, %0 \n\t" | 66 | "add #1, %0 \n\t" |
| 69 | "movco.l %0, @%2 \n\t" | 67 | "movco.l %0, @%2 \n\t" |
| 70 | "movt %1 \n\t" | 68 | "movt %1 \n\t" |
| 71 | : "=&z" (__res), "=&r" (__ex_flag) | 69 | : "=&z" (__res), "=&r" (__done) |
| 72 | : "r" (&(count)->counter) | 70 | : "r" (&(count)->counter) |
| 73 | : "t"); | 71 | : "t"); |
| 74 | 72 | ||
| 75 | __res |= !__ex_flag; | 73 | if (unlikely(!__done || __res <= 0)) |
| 76 | if (unlikely(__res <= 0)) | ||
| 77 | fail_fn(count); | 74 | fail_fn(count); |
| 78 | } | 75 | } |
| 79 | 76 | ||
diff --git a/arch/sh/include/asm/syscall_32.h b/arch/sh/include/asm/syscall_32.h index 05a868a71ef5..5bc34681d994 100644 --- a/arch/sh/include/asm/syscall_32.h +++ b/arch/sh/include/asm/syscall_32.h | |||
| @@ -21,23 +21,10 @@ static inline void syscall_rollback(struct task_struct *task, | |||
| 21 | */ | 21 | */ |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | static inline bool syscall_has_error(struct pt_regs *regs) | ||
| 25 | { | ||
| 26 | return (regs->sr & 0x1) ? true : false; | ||
| 27 | } | ||
| 28 | static inline void syscall_set_error(struct pt_regs *regs) | ||
| 29 | { | ||
| 30 | regs->sr |= 0x1; | ||
| 31 | } | ||
| 32 | static inline void syscall_clear_error(struct pt_regs *regs) | ||
| 33 | { | ||
| 34 | regs->sr &= ~0x1; | ||
| 35 | } | ||
| 36 | |||
| 37 | static inline long syscall_get_error(struct task_struct *task, | 24 | static inline long syscall_get_error(struct task_struct *task, |
| 38 | struct pt_regs *regs) | 25 | struct pt_regs *regs) |
| 39 | { | 26 | { |
| 40 | return syscall_has_error(regs) ? regs->regs[0] : 0; | 27 | return IS_ERR_VALUE(regs->regs[0]) ? regs->regs[0] : 0; |
| 41 | } | 28 | } |
| 42 | 29 | ||
| 43 | static inline long syscall_get_return_value(struct task_struct *task, | 30 | static inline long syscall_get_return_value(struct task_struct *task, |
| @@ -50,13 +37,10 @@ static inline void syscall_set_return_value(struct task_struct *task, | |||
| 50 | struct pt_regs *regs, | 37 | struct pt_regs *regs, |
| 51 | int error, long val) | 38 | int error, long val) |
| 52 | { | 39 | { |
| 53 | if (error) { | 40 | if (error) |
| 54 | syscall_set_error(regs); | ||
| 55 | regs->regs[0] = -error; | 41 | regs->regs[0] = -error; |
| 56 | } else { | 42 | else |
| 57 | syscall_clear_error(regs); | ||
| 58 | regs->regs[0] = val; | 43 | regs->regs[0] = val; |
| 59 | } | ||
| 60 | } | 44 | } |
| 61 | 45 | ||
| 62 | static inline void syscall_get_arguments(struct task_struct *task, | 46 | static inline void syscall_get_arguments(struct task_struct *task, |
diff --git a/arch/sh/include/asm/syscall_64.h b/arch/sh/include/asm/syscall_64.h index e1143b9784d6..c3561ca72bee 100644 --- a/arch/sh/include/asm/syscall_64.h +++ b/arch/sh/include/asm/syscall_64.h | |||
| @@ -21,23 +21,10 @@ static inline void syscall_rollback(struct task_struct *task, | |||
| 21 | */ | 21 | */ |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | static inline bool syscall_has_error(struct pt_regs *regs) | ||
| 25 | { | ||
| 26 | return (regs->sr & 0x1) ? true : false; | ||
| 27 | } | ||
| 28 | static inline void syscall_set_error(struct pt_regs *regs) | ||
| 29 | { | ||
| 30 | regs->sr |= 0x1; | ||
| 31 | } | ||
| 32 | static inline void syscall_clear_error(struct pt_regs *regs) | ||
| 33 | { | ||
| 34 | regs->sr &= ~0x1; | ||
| 35 | } | ||
| 36 | |||
| 37 | static inline long syscall_get_error(struct task_struct *task, | 24 | static inline long syscall_get_error(struct task_struct *task, |
| 38 | struct pt_regs *regs) | 25 | struct pt_regs *regs) |
| 39 | { | 26 | { |
| 40 | return syscall_has_error(regs) ? regs->regs[9] : 0; | 27 | return IS_ERR_VALUE(regs->regs[9]) ? regs->regs[9] : 0; |
| 41 | } | 28 | } |
| 42 | 29 | ||
| 43 | static inline long syscall_get_return_value(struct task_struct *task, | 30 | static inline long syscall_get_return_value(struct task_struct *task, |
| @@ -50,13 +37,10 @@ static inline void syscall_set_return_value(struct task_struct *task, | |||
| 50 | struct pt_regs *regs, | 37 | struct pt_regs *regs, |
| 51 | int error, long val) | 38 | int error, long val) |
| 52 | { | 39 | { |
| 53 | if (error) { | 40 | if (error) |
| 54 | syscall_set_error(regs); | ||
| 55 | regs->regs[9] = -error; | 41 | regs->regs[9] = -error; |
| 56 | } else { | 42 | else |
| 57 | syscall_clear_error(regs); | ||
| 58 | regs->regs[9] = val; | 43 | regs->regs[9] = val; |
| 59 | } | ||
| 60 | } | 44 | } |
| 61 | 45 | ||
| 62 | static inline void syscall_get_arguments(struct task_struct *task, | 46 | static inline void syscall_get_arguments(struct task_struct *task, |
diff --git a/arch/sh/kernel/cpu/sh4/fpu.c b/arch/sh/kernel/cpu/sh4/fpu.c index 2780917c0088..e3ea5411da6d 100644 --- a/arch/sh/kernel/cpu/sh4/fpu.c +++ b/arch/sh/kernel/cpu/sh4/fpu.c | |||
| @@ -423,7 +423,7 @@ static int ieee_fpe_handler(struct pt_regs *regs) | |||
| 423 | int m; | 423 | int m; |
| 424 | unsigned int hx; | 424 | unsigned int hx; |
| 425 | 425 | ||
| 426 | m = (finsn >> 9) & 0x7; | 426 | m = (finsn >> 8) & 0x7; |
| 427 | hx = tsk->thread.fpu.hard.fp_regs[m]; | 427 | hx = tsk->thread.fpu.hard.fp_regs[m]; |
| 428 | 428 | ||
| 429 | if ((tsk->thread.fpu.hard.fpscr & FPSCR_CAUSE_ERROR) | 429 | if ((tsk->thread.fpu.hard.fpscr & FPSCR_CAUSE_ERROR) |
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index 534247508572..370d2cfa34eb 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c | |||
| @@ -262,11 +262,11 @@ void __init setup_bootmem_allocator(unsigned long free_pfn) | |||
| 262 | BOOTMEM_DEFAULT); | 262 | BOOTMEM_DEFAULT); |
| 263 | 263 | ||
| 264 | /* | 264 | /* |
| 265 | * reserve physical page 0 - it's a special BIOS page on many boxes, | 265 | * Reserve physical pages below CONFIG_ZERO_PAGE_OFFSET. |
| 266 | * enabling clean reboots, SMP operation, laptop functions. | ||
| 267 | */ | 266 | */ |
| 268 | reserve_bootmem(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET, | 267 | if (CONFIG_ZERO_PAGE_OFFSET != 0) |
| 269 | BOOTMEM_DEFAULT); | 268 | reserve_bootmem(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET, |
| 269 | BOOTMEM_DEFAULT); | ||
| 270 | 270 | ||
| 271 | sparse_memory_present_with_active_regions(0); | 271 | sparse_memory_present_with_active_regions(0); |
| 272 | 272 | ||
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c index 77c21bde376a..17784e19ae34 100644 --- a/arch/sh/kernel/signal_32.c +++ b/arch/sh/kernel/signal_32.c | |||
| @@ -510,7 +510,6 @@ handle_syscall_restart(unsigned long save_r0, struct pt_regs *regs, | |||
| 510 | case -ERESTARTNOHAND: | 510 | case -ERESTARTNOHAND: |
| 511 | no_system_call_restart: | 511 | no_system_call_restart: |
| 512 | regs->regs[0] = -EINTR; | 512 | regs->regs[0] = -EINTR; |
| 513 | regs->sr |= 1; | ||
| 514 | break; | 513 | break; |
| 515 | 514 | ||
| 516 | case -ERESTARTSYS: | 515 | case -ERESTARTSYS: |
| @@ -589,8 +588,7 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0) | |||
| 589 | 588 | ||
| 590 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 589 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
| 591 | if (signr > 0) { | 590 | if (signr > 0) { |
| 592 | if (regs->sr & 1) | 591 | handle_syscall_restart(save_r0, regs, &ka.sa); |
| 593 | handle_syscall_restart(save_r0, regs, &ka.sa); | ||
| 594 | 592 | ||
| 595 | /* Whee! Actually deliver the signal. */ | 593 | /* Whee! Actually deliver the signal. */ |
| 596 | if (handle_signal(signr, &ka, &info, oldset, | 594 | if (handle_signal(signr, &ka, &info, oldset, |
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c index b22fdfaaa191..0663a0ee6021 100644 --- a/arch/sh/kernel/signal_64.c +++ b/arch/sh/kernel/signal_64.c | |||
| @@ -60,7 +60,6 @@ handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa) | |||
| 60 | case -ERESTARTNOHAND: | 60 | case -ERESTARTNOHAND: |
| 61 | no_system_call_restart: | 61 | no_system_call_restart: |
| 62 | regs->regs[REG_RET] = -EINTR; | 62 | regs->regs[REG_RET] = -EINTR; |
| 63 | regs->sr |= 1; | ||
| 64 | break; | 63 | break; |
| 65 | 64 | ||
| 66 | case -ERESTARTSYS: | 65 | case -ERESTARTSYS: |
| @@ -109,8 +108,7 @@ static int do_signal(struct pt_regs *regs, sigset_t *oldset) | |||
| 109 | 108 | ||
| 110 | signr = get_signal_to_deliver(&info, &ka, regs, 0); | 109 | signr = get_signal_to_deliver(&info, &ka, regs, 0); |
| 111 | if (signr > 0) { | 110 | if (signr > 0) { |
| 112 | if (regs->sr & 1) | 111 | handle_syscall_restart(regs, &ka.sa); |
| 113 | handle_syscall_restart(regs, &ka.sa); | ||
| 114 | 112 | ||
| 115 | /* Whee! Actually deliver the signal. */ | 113 | /* Whee! Actually deliver the signal. */ |
| 116 | if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { | 114 | if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { |
diff --git a/arch/sh/lib/checksum.S b/arch/sh/lib/checksum.S index cbdd0d40e545..356c8ec92893 100644 --- a/arch/sh/lib/checksum.S +++ b/arch/sh/lib/checksum.S | |||
| @@ -36,8 +36,7 @@ | |||
| 36 | */ | 36 | */ |
| 37 | 37 | ||
| 38 | /* | 38 | /* |
| 39 | * unsigned int csum_partial(const unsigned char *buf, int len, | 39 | * asmlinkage __wsum csum_partial(const void *buf, int len, __wsum sum); |
| 40 | * unsigned int sum); | ||
| 41 | */ | 40 | */ |
| 42 | 41 | ||
| 43 | .text | 42 | .text |
| @@ -49,11 +48,31 @@ ENTRY(csum_partial) | |||
| 49 | * Fortunately, it is easy to convert 2-byte alignment to 4-byte | 48 | * Fortunately, it is easy to convert 2-byte alignment to 4-byte |
| 50 | * alignment for the unrolled loop. | 49 | * alignment for the unrolled loop. |
| 51 | */ | 50 | */ |
| 52 | mov r5, r1 | ||
| 53 | mov r4, r0 | 51 | mov r4, r0 |
| 54 | tst #2, r0 ! Check alignment. | 52 | tst #3, r0 ! Check alignment. |
| 55 | bt 2f ! Jump if alignment is ok. | 53 | bt/s 2f ! Jump if alignment is ok. |
| 54 | mov r4, r7 ! Keep a copy to check for alignment | ||
| 56 | ! | 55 | ! |
| 56 | tst #1, r0 ! Check alignment. | ||
| 57 | bt 21f ! Jump if alignment is boundary of 2bytes. | ||
| 58 | |||
| 59 | ! buf is odd | ||
| 60 | tst r5, r5 | ||
| 61 | add #-1, r5 | ||
| 62 | bt 9f | ||
| 63 | mov.b @r4+, r0 | ||
| 64 | extu.b r0, r0 | ||
| 65 | addc r0, r6 ! t=0 from previous tst | ||
| 66 | mov r6, r0 | ||
| 67 | shll8 r6 | ||
| 68 | shlr16 r0 | ||
| 69 | shlr8 r0 | ||
| 70 | or r0, r6 | ||
| 71 | mov r4, r0 | ||
| 72 | tst #2, r0 | ||
| 73 | bt 2f | ||
| 74 | 21: | ||
| 75 | ! buf is 2 byte aligned (len could be 0) | ||
| 57 | add #-2, r5 ! Alignment uses up two bytes. | 76 | add #-2, r5 ! Alignment uses up two bytes. |
| 58 | cmp/pz r5 ! | 77 | cmp/pz r5 ! |
| 59 | bt/s 1f ! Jump if we had at least two bytes. | 78 | bt/s 1f ! Jump if we had at least two bytes. |
| @@ -61,16 +80,17 @@ ENTRY(csum_partial) | |||
| 61 | bra 6f | 80 | bra 6f |
| 62 | add #2, r5 ! r5 was < 2. Deal with it. | 81 | add #2, r5 ! r5 was < 2. Deal with it. |
| 63 | 1: | 82 | 1: |
| 64 | mov r5, r1 ! Save new len for later use. | ||
| 65 | mov.w @r4+, r0 | 83 | mov.w @r4+, r0 |
| 66 | extu.w r0, r0 | 84 | extu.w r0, r0 |
| 67 | addc r0, r6 | 85 | addc r0, r6 |
| 68 | bf 2f | 86 | bf 2f |
| 69 | add #1, r6 | 87 | add #1, r6 |
| 70 | 2: | 88 | 2: |
| 89 | ! buf is 4 byte aligned (len could be 0) | ||
| 90 | mov r5, r1 | ||
| 71 | mov #-5, r0 | 91 | mov #-5, r0 |
| 72 | shld r0, r5 | 92 | shld r0, r1 |
| 73 | tst r5, r5 | 93 | tst r1, r1 |
| 74 | bt/s 4f ! if it's =0, go to 4f | 94 | bt/s 4f ! if it's =0, go to 4f |
| 75 | clrt | 95 | clrt |
| 76 | .align 2 | 96 | .align 2 |
| @@ -92,30 +112,31 @@ ENTRY(csum_partial) | |||
| 92 | addc r0, r6 | 112 | addc r0, r6 |
| 93 | addc r2, r6 | 113 | addc r2, r6 |
| 94 | movt r0 | 114 | movt r0 |
| 95 | dt r5 | 115 | dt r1 |
| 96 | bf/s 3b | 116 | bf/s 3b |
| 97 | cmp/eq #1, r0 | 117 | cmp/eq #1, r0 |
| 98 | ! here, we know r5==0 | 118 | ! here, we know r1==0 |
| 99 | addc r5, r6 ! add carry to r6 | 119 | addc r1, r6 ! add carry to r6 |
| 100 | 4: | 120 | 4: |
| 101 | mov r1, r0 | 121 | mov r5, r0 |
| 102 | and #0x1c, r0 | 122 | and #0x1c, r0 |
| 103 | tst r0, r0 | 123 | tst r0, r0 |
| 104 | bt/s 6f | 124 | bt 6f |
| 105 | mov r0, r5 | 125 | ! 4 bytes or more remaining |
| 106 | shlr2 r5 | 126 | mov r0, r1 |
| 127 | shlr2 r1 | ||
| 107 | mov #0, r2 | 128 | mov #0, r2 |
| 108 | 5: | 129 | 5: |
| 109 | addc r2, r6 | 130 | addc r2, r6 |
| 110 | mov.l @r4+, r2 | 131 | mov.l @r4+, r2 |
| 111 | movt r0 | 132 | movt r0 |
| 112 | dt r5 | 133 | dt r1 |
| 113 | bf/s 5b | 134 | bf/s 5b |
| 114 | cmp/eq #1, r0 | 135 | cmp/eq #1, r0 |
| 115 | addc r2, r6 | 136 | addc r2, r6 |
| 116 | addc r5, r6 ! r5==0 here, so it means add carry-bit | 137 | addc r1, r6 ! r1==0 here, so it means add carry-bit |
| 117 | 6: | 138 | 6: |
| 118 | mov r1, r5 | 139 | ! 3 bytes or less remaining |
| 119 | mov #3, r0 | 140 | mov #3, r0 |
| 120 | and r0, r5 | 141 | and r0, r5 |
| 121 | tst r5, r5 | 142 | tst r5, r5 |
| @@ -139,8 +160,18 @@ ENTRY(csum_partial) | |||
| 139 | 8: | 160 | 8: |
| 140 | addc r0, r6 | 161 | addc r0, r6 |
| 141 | mov #0, r0 | 162 | mov #0, r0 |
| 142 | addc r0, r6 | 163 | addc r0, r6 |
| 143 | 9: | 164 | 9: |
| 165 | ! Check if the buffer was misaligned, if so realign sum | ||
| 166 | mov r7, r0 | ||
| 167 | tst #1, r0 | ||
| 168 | bt 10f | ||
| 169 | mov r6, r0 | ||
| 170 | shll8 r6 | ||
| 171 | shlr16 r0 | ||
| 172 | shlr8 r0 | ||
| 173 | or r0, r6 | ||
| 174 | 10: | ||
| 144 | rts | 175 | rts |
| 145 | mov r6, r0 | 176 | mov r6, r0 |
| 146 | 177 | ||
diff --git a/arch/sparc/include/asm/cpudata_64.h b/arch/sparc/include/asm/cpudata_64.h index 7da7c13d23c4..a11b89ee9ef8 100644 --- a/arch/sparc/include/asm/cpudata_64.h +++ b/arch/sparc/include/asm/cpudata_64.h | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | typedef struct { | 17 | typedef struct { |
| 18 | /* Dcache line 1 */ | 18 | /* Dcache line 1 */ |
| 19 | unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ | 19 | unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ |
| 20 | unsigned int __pad0; | 20 | unsigned int __nmi_count; |
| 21 | unsigned long clock_tick; /* %tick's per second */ | 21 | unsigned long clock_tick; /* %tick's per second */ |
| 22 | unsigned long __pad; | 22 | unsigned long __pad; |
| 23 | unsigned int __pad1; | 23 | unsigned int __pad1; |
diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h index d47d4a1955a9..1934f2cbf513 100644 --- a/arch/sparc/include/asm/irq_64.h +++ b/arch/sparc/include/asm/irq_64.h | |||
| @@ -66,9 +66,6 @@ extern void virt_irq_free(unsigned int virt_irq); | |||
| 66 | extern void __init init_IRQ(void); | 66 | extern void __init init_IRQ(void); |
| 67 | extern void fixup_irqs(void); | 67 | extern void fixup_irqs(void); |
| 68 | 68 | ||
| 69 | extern int register_perfctr_intr(void (*handler)(struct pt_regs *)); | ||
| 70 | extern void release_perfctr_intr(void (*handler)(struct pt_regs *)); | ||
| 71 | |||
| 72 | static inline void set_softint(unsigned long bits) | 69 | static inline void set_softint(unsigned long bits) |
| 73 | { | 70 | { |
| 74 | __asm__ __volatile__("wr %0, 0x0, %%set_softint" | 71 | __asm__ __volatile__("wr %0, 0x0, %%set_softint" |
| @@ -98,5 +95,6 @@ void __trigger_all_cpu_backtrace(void); | |||
| 98 | extern void *hardirq_stack[NR_CPUS]; | 95 | extern void *hardirq_stack[NR_CPUS]; |
| 99 | extern void *softirq_stack[NR_CPUS]; | 96 | extern void *softirq_stack[NR_CPUS]; |
| 100 | #define __ARCH_HAS_DO_SOFTIRQ | 97 | #define __ARCH_HAS_DO_SOFTIRQ |
| 98 | #define ARCH_HAS_NMI_WATCHDOG | ||
| 101 | 99 | ||
| 102 | #endif | 100 | #endif |
diff --git a/arch/sparc/include/asm/kdebug_64.h b/arch/sparc/include/asm/kdebug_64.h index f905b773235a..feb3578e12c4 100644 --- a/arch/sparc/include/asm/kdebug_64.h +++ b/arch/sparc/include/asm/kdebug_64.h | |||
| @@ -14,6 +14,8 @@ enum die_val { | |||
| 14 | DIE_TRAP, | 14 | DIE_TRAP, |
| 15 | DIE_TRAP_TL1, | 15 | DIE_TRAP_TL1, |
| 16 | DIE_CALL, | 16 | DIE_CALL, |
| 17 | DIE_NMI, | ||
| 18 | DIE_NMIWATCHDOG, | ||
| 17 | }; | 19 | }; |
| 18 | 20 | ||
| 19 | #endif | 21 | #endif |
diff --git a/arch/sparc/include/asm/nmi.h b/arch/sparc/include/asm/nmi.h new file mode 100644 index 000000000000..fbd546dd4feb --- /dev/null +++ b/arch/sparc/include/asm/nmi.h | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #ifndef __NMI_H | ||
| 2 | #define __NMI_H | ||
| 3 | |||
| 4 | extern int __init nmi_init(void); | ||
| 5 | extern void perfctr_irq(int irq, struct pt_regs *regs); | ||
| 6 | extern void nmi_adjust_hz(unsigned int new_hz); | ||
| 7 | |||
| 8 | extern int nmi_usable; | ||
| 9 | |||
| 10 | #endif /* __NMI_H */ | ||
diff --git a/arch/sparc/include/asm/pcr.h b/arch/sparc/include/asm/pcr.h new file mode 100644 index 000000000000..a2f5c61f924e --- /dev/null +++ b/arch/sparc/include/asm/pcr.h | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | #ifndef __PCR_H | ||
| 2 | #define __PCR_H | ||
| 3 | |||
| 4 | struct pcr_ops { | ||
| 5 | u64 (*read)(void); | ||
| 6 | void (*write)(u64); | ||
| 7 | }; | ||
| 8 | extern const struct pcr_ops *pcr_ops; | ||
| 9 | |||
| 10 | extern void deferred_pcr_work_irq(int irq, struct pt_regs *regs); | ||
| 11 | extern void schedule_deferred_pcr_work(void); | ||
| 12 | |||
| 13 | #define PCR_PIC_PRIV 0x00000001 /* PIC access is privileged */ | ||
| 14 | #define PCR_STRACE 0x00000002 /* Trace supervisor events */ | ||
| 15 | #define PCR_UTRACE 0x00000004 /* Trace user events */ | ||
| 16 | #define PCR_N2_HTRACE 0x00000008 /* Trace hypervisor events */ | ||
| 17 | #define PCR_N2_TOE_OV0 0x00000010 /* Trap if PIC 0 overflows */ | ||
| 18 | #define PCR_N2_TOE_OV1 0x00000020 /* Trap if PIC 1 overflows */ | ||
| 19 | #define PCR_N2_MASK0 0x00003fc0 | ||
| 20 | #define PCR_N2_MASK0_SHIFT 6 | ||
| 21 | #define PCR_N2_SL0 0x0003c000 | ||
| 22 | #define PCR_N2_SL0_SHIFT 14 | ||
| 23 | #define PCR_N2_OV0 0x00040000 | ||
| 24 | #define PCR_N2_MASK1 0x07f80000 | ||
| 25 | #define PCR_N2_MASK1_SHIFT 19 | ||
| 26 | #define PCR_N2_SL1 0x78000000 | ||
| 27 | #define PCR_N2_SL1_SHIFT 27 | ||
| 28 | #define PCR_N2_OV1 0x80000000 | ||
| 29 | |||
| 30 | extern unsigned int picl_shift; | ||
| 31 | |||
| 32 | /* In order to commonize as much of the implementation as | ||
| 33 | * possible, we use PICH as our counter. Mostly this is | ||
| 34 | * to accomodate Niagara-1 which can only count insn cycles | ||
| 35 | * in PICH. | ||
| 36 | */ | ||
| 37 | static inline u64 picl_value(unsigned int nmi_hz) | ||
| 38 | { | ||
| 39 | u32 delta = local_cpu_data().clock_tick / (nmi_hz << picl_shift); | ||
| 40 | |||
| 41 | return ((u64)((0 - delta) & 0xffffffff)) << 32; | ||
| 42 | } | ||
| 43 | |||
| 44 | extern u64 pcr_enable; | ||
| 45 | |||
| 46 | #endif /* __PCR_H */ | ||
diff --git a/arch/sparc/include/asm/pil.h b/arch/sparc/include/asm/pil.h index d573820c0ff4..32a7efe76d00 100644 --- a/arch/sparc/include/asm/pil.h +++ b/arch/sparc/include/asm/pil.h | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #define PIL_SMP_CTX_NEW_VERSION 4 | 23 | #define PIL_SMP_CTX_NEW_VERSION 4 |
| 24 | #define PIL_DEVICE_IRQ 5 | 24 | #define PIL_DEVICE_IRQ 5 |
| 25 | #define PIL_SMP_CALL_FUNC_SNGL 6 | 25 | #define PIL_SMP_CALL_FUNC_SNGL 6 |
| 26 | #define PIL_DEFERRED_PCR_WORK 7 | ||
| 26 | #define PIL_NORMAL_MAX 14 | 27 | #define PIL_NORMAL_MAX 14 |
| 27 | #define PIL_NMI 15 | 28 | #define PIL_NMI 15 |
| 28 | 29 | ||
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index 53adcaa0348b..54742e58831c 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile | |||
| @@ -52,6 +52,8 @@ obj-$(CONFIG_SPARC64) += visemul.o | |||
| 52 | obj-$(CONFIG_SPARC64) += hvapi.o | 52 | obj-$(CONFIG_SPARC64) += hvapi.o |
| 53 | obj-$(CONFIG_SPARC64) += sstate.o | 53 | obj-$(CONFIG_SPARC64) += sstate.o |
| 54 | obj-$(CONFIG_SPARC64) += mdesc.o | 54 | obj-$(CONFIG_SPARC64) += mdesc.o |
| 55 | obj-$(CONFIG_SPARC64) += pcr.o | ||
| 56 | obj-$(CONFIG_SPARC64) += nmi.o | ||
| 55 | 57 | ||
| 56 | # sparc32 do not use GENERIC_HARDIRQS but uses the generic devres implementation | 58 | # sparc32 do not use GENERIC_HARDIRQS but uses the generic devres implementation |
| 57 | obj-$(CONFIG_SPARC32) += devres.o | 59 | obj-$(CONFIG_SPARC32) += devres.o |
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c index 32d32b4824f5..d85c3dc4953a 100644 --- a/arch/sparc/kernel/cpu.c +++ b/arch/sparc/kernel/cpu.c | |||
| @@ -26,6 +26,7 @@ EXPORT_PER_CPU_SYMBOL(__cpu_data); | |||
| 26 | struct cpu_info { | 26 | struct cpu_info { |
| 27 | int psr_vers; | 27 | int psr_vers; |
| 28 | const char *name; | 28 | const char *name; |
| 29 | const char *pmu_name; | ||
| 29 | }; | 30 | }; |
| 30 | 31 | ||
| 31 | struct fpu_info { | 32 | struct fpu_info { |
| @@ -45,6 +46,9 @@ struct manufacturer_info { | |||
| 45 | #define CPU(ver, _name) \ | 46 | #define CPU(ver, _name) \ |
| 46 | { .psr_vers = ver, .name = _name } | 47 | { .psr_vers = ver, .name = _name } |
| 47 | 48 | ||
| 49 | #define CPU_PMU(ver, _name, _pmu_name) \ | ||
| 50 | { .psr_vers = ver, .name = _name, .pmu_name = _pmu_name } | ||
| 51 | |||
| 48 | #define FPU(ver, _name) \ | 52 | #define FPU(ver, _name) \ |
| 49 | { .fp_vers = ver, .name = _name } | 53 | { .fp_vers = ver, .name = _name } |
| 50 | 54 | ||
| @@ -183,10 +187,10 @@ static const struct manufacturer_info __initconst manufacturer_info[] = { | |||
| 183 | },{ | 187 | },{ |
| 184 | 0x17, | 188 | 0x17, |
| 185 | .cpu_info = { | 189 | .cpu_info = { |
| 186 | CPU(0x10, "TI UltraSparc I (SpitFire)"), | 190 | CPU_PMU(0x10, "TI UltraSparc I (SpitFire)", "ultra12"), |
| 187 | CPU(0x11, "TI UltraSparc II (BlackBird)"), | 191 | CPU_PMU(0x11, "TI UltraSparc II (BlackBird)", "ultra12"), |
| 188 | CPU(0x12, "TI UltraSparc IIi (Sabre)"), | 192 | CPU_PMU(0x12, "TI UltraSparc IIi (Sabre)", "ultra12"), |
| 189 | CPU(0x13, "TI UltraSparc IIe (Hummingbird)"), | 193 | CPU_PMU(0x13, "TI UltraSparc IIe (Hummingbird)", "ultra12"), |
| 190 | CPU(-1, NULL) | 194 | CPU(-1, NULL) |
| 191 | }, | 195 | }, |
| 192 | .fpu_info = { | 196 | .fpu_info = { |
| @@ -199,7 +203,7 @@ static const struct manufacturer_info __initconst manufacturer_info[] = { | |||
| 199 | },{ | 203 | },{ |
| 200 | 0x22, | 204 | 0x22, |
| 201 | .cpu_info = { | 205 | .cpu_info = { |
| 202 | CPU(0x10, "TI UltraSparc I (SpitFire)"), | 206 | CPU_PMU(0x10, "TI UltraSparc I (SpitFire)", "ultra12"), |
| 203 | CPU(-1, NULL) | 207 | CPU(-1, NULL) |
| 204 | }, | 208 | }, |
| 205 | .fpu_info = { | 209 | .fpu_info = { |
| @@ -209,12 +213,12 @@ static const struct manufacturer_info __initconst manufacturer_info[] = { | |||
| 209 | },{ | 213 | },{ |
| 210 | 0x3e, | 214 | 0x3e, |
| 211 | .cpu_info = { | 215 | .cpu_info = { |
| 212 | CPU(0x14, "TI UltraSparc III (Cheetah)"), | 216 | CPU_PMU(0x14, "TI UltraSparc III (Cheetah)", "ultra3"), |
| 213 | CPU(0x15, "TI UltraSparc III+ (Cheetah+)"), | 217 | CPU_PMU(0x15, "TI UltraSparc III+ (Cheetah+)", "ultra3+"), |
| 214 | CPU(0x16, "TI UltraSparc IIIi (Jalapeno)"), | 218 | CPU_PMU(0x16, "TI UltraSparc IIIi (Jalapeno)", "ultra3i"), |
| 215 | CPU(0x18, "TI UltraSparc IV (Jaguar)"), | 219 | CPU_PMU(0x18, "TI UltraSparc IV (Jaguar)", "ultra3+"), |
| 216 | CPU(0x19, "TI UltraSparc IV+ (Panther)"), | 220 | CPU_PMU(0x19, "TI UltraSparc IV+ (Panther)", "ultra4+"), |
| 217 | CPU(0x22, "TI UltraSparc IIIi+ (Serrano)"), | 221 | CPU_PMU(0x22, "TI UltraSparc IIIi+ (Serrano)", "ultra3i"), |
| 218 | CPU(-1, NULL) | 222 | CPU(-1, NULL) |
| 219 | }, | 223 | }, |
| 220 | .fpu_info = { | 224 | .fpu_info = { |
| @@ -234,6 +238,7 @@ static const struct manufacturer_info __initconst manufacturer_info[] = { | |||
| 234 | 238 | ||
| 235 | const char *sparc_cpu_type; | 239 | const char *sparc_cpu_type; |
| 236 | const char *sparc_fpu_type; | 240 | const char *sparc_fpu_type; |
| 241 | const char *sparc_pmu_type; | ||
| 237 | 242 | ||
| 238 | unsigned int fsr_storage; | 243 | unsigned int fsr_storage; |
| 239 | 244 | ||
| @@ -244,6 +249,7 @@ static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers) | |||
| 244 | 249 | ||
| 245 | sparc_cpu_type = NULL; | 250 | sparc_cpu_type = NULL; |
| 246 | sparc_fpu_type = NULL; | 251 | sparc_fpu_type = NULL; |
| 252 | sparc_pmu_type = NULL; | ||
| 247 | manuf = NULL; | 253 | manuf = NULL; |
| 248 | 254 | ||
| 249 | for (i = 0; i < ARRAY_SIZE(manufacturer_info); i++) | 255 | for (i = 0; i < ARRAY_SIZE(manufacturer_info); i++) |
| @@ -263,6 +269,7 @@ static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers) | |||
| 263 | { | 269 | { |
| 264 | if (cpu->psr_vers == psr_vers) { | 270 | if (cpu->psr_vers == psr_vers) { |
| 265 | sparc_cpu_type = cpu->name; | 271 | sparc_cpu_type = cpu->name; |
| 272 | sparc_pmu_type = cpu->pmu_name; | ||
| 266 | sparc_fpu_type = "No FPU"; | 273 | sparc_fpu_type = "No FPU"; |
| 267 | break; | 274 | break; |
| 268 | } | 275 | } |
| @@ -290,6 +297,8 @@ static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers) | |||
| 290 | psr_impl, fpu_vers); | 297 | psr_impl, fpu_vers); |
| 291 | sparc_fpu_type = "Unknown FPU"; | 298 | sparc_fpu_type = "Unknown FPU"; |
| 292 | } | 299 | } |
| 300 | if (sparc_pmu_type == NULL) | ||
| 301 | sparc_pmu_type = "Unknown PMU"; | ||
| 293 | } | 302 | } |
| 294 | 303 | ||
| 295 | #ifdef CONFIG_SPARC32 | 304 | #ifdef CONFIG_SPARC32 |
| @@ -315,11 +324,13 @@ static void __init sun4v_cpu_probe(void) | |||
| 315 | case SUN4V_CHIP_NIAGARA1: | 324 | case SUN4V_CHIP_NIAGARA1: |
| 316 | sparc_cpu_type = "UltraSparc T1 (Niagara)"; | 325 | sparc_cpu_type = "UltraSparc T1 (Niagara)"; |
| 317 | sparc_fpu_type = "UltraSparc T1 integrated FPU"; | 326 | sparc_fpu_type = "UltraSparc T1 integrated FPU"; |
| 327 | sparc_pmu_type = "niagara"; | ||
| 318 | break; | 328 | break; |
| 319 | 329 | ||
| 320 | case SUN4V_CHIP_NIAGARA2: | 330 | case SUN4V_CHIP_NIAGARA2: |
| 321 | sparc_cpu_type = "UltraSparc T2 (Niagara2)"; | 331 | sparc_cpu_type = "UltraSparc T2 (Niagara2)"; |
| 322 | sparc_fpu_type = "UltraSparc T2 integrated FPU"; | 332 | sparc_fpu_type = "UltraSparc T2 integrated FPU"; |
| 333 | sparc_pmu_type = "niagara2"; | ||
| 323 | break; | 334 | break; |
| 324 | 335 | ||
| 325 | default: | 336 | default: |
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c index cab8e0286871..e289376198eb 100644 --- a/arch/sparc/kernel/irq_64.c +++ b/arch/sparc/kernel/irq_64.c | |||
| @@ -196,6 +196,11 @@ int show_interrupts(struct seq_file *p, void *v) | |||
| 196 | seq_putc(p, '\n'); | 196 | seq_putc(p, '\n'); |
| 197 | skip: | 197 | skip: |
| 198 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | 198 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); |
| 199 | } else if (i == NR_IRQS) { | ||
| 200 | seq_printf(p, "NMI: "); | ||
| 201 | for_each_online_cpu(j) | ||
| 202 | seq_printf(p, "%10u ", cpu_data(j).__nmi_count); | ||
| 203 | seq_printf(p, " Non-maskable interrupts\n"); | ||
| 199 | } | 204 | } |
| 200 | return 0; | 205 | return 0; |
| 201 | } | 206 | } |
| @@ -778,69 +783,6 @@ void do_softirq(void) | |||
| 778 | local_irq_restore(flags); | 783 | local_irq_restore(flags); |
| 779 | } | 784 | } |
| 780 | 785 | ||
| 781 | static void unhandled_perf_irq(struct pt_regs *regs) | ||
| 782 | { | ||
| 783 | unsigned long pcr, pic; | ||
| 784 | |||
| 785 | read_pcr(pcr); | ||
| 786 | read_pic(pic); | ||
| 787 | |||
| 788 | write_pcr(0); | ||
| 789 | |||
| 790 | printk(KERN_EMERG "CPU %d: Got unexpected perf counter IRQ.\n", | ||
| 791 | smp_processor_id()); | ||
| 792 | printk(KERN_EMERG "CPU %d: PCR[%016lx] PIC[%016lx]\n", | ||
| 793 | smp_processor_id(), pcr, pic); | ||
| 794 | } | ||
| 795 | |||
| 796 | /* Almost a direct copy of the powerpc PMC code. */ | ||
| 797 | static DEFINE_SPINLOCK(perf_irq_lock); | ||
| 798 | static void *perf_irq_owner_caller; /* mostly for debugging */ | ||
| 799 | static void (*perf_irq)(struct pt_regs *regs) = unhandled_perf_irq; | ||
| 800 | |||
| 801 | /* Invoked from level 15 PIL handler in trap table. */ | ||
| 802 | void perfctr_irq(int irq, struct pt_regs *regs) | ||
| 803 | { | ||
| 804 | clear_softint(1 << irq); | ||
| 805 | perf_irq(regs); | ||
| 806 | } | ||
| 807 | |||
| 808 | int register_perfctr_intr(void (*handler)(struct pt_regs *)) | ||
| 809 | { | ||
| 810 | int ret; | ||
| 811 | |||
| 812 | if (!handler) | ||
| 813 | return -EINVAL; | ||
| 814 | |||
| 815 | spin_lock(&perf_irq_lock); | ||
| 816 | if (perf_irq != unhandled_perf_irq) { | ||
| 817 | printk(KERN_WARNING "register_perfctr_intr: " | ||
| 818 | "perf IRQ busy (reserved by caller %p)\n", | ||
| 819 | perf_irq_owner_caller); | ||
| 820 | ret = -EBUSY; | ||
| 821 | goto out; | ||
| 822 | } | ||
| 823 | |||
| 824 | perf_irq_owner_caller = __builtin_return_address(0); | ||
| 825 | perf_irq = handler; | ||
| 826 | |||
| 827 | ret = 0; | ||
| 828 | out: | ||
| 829 | spin_unlock(&perf_irq_lock); | ||
| 830 | |||
| 831 | return ret; | ||
| 832 | } | ||
| 833 | EXPORT_SYMBOL_GPL(register_perfctr_intr); | ||
| 834 | |||
| 835 | void release_perfctr_intr(void (*handler)(struct pt_regs *)) | ||
| 836 | { | ||
| 837 | spin_lock(&perf_irq_lock); | ||
| 838 | perf_irq_owner_caller = NULL; | ||
| 839 | perf_irq = unhandled_perf_irq; | ||
| 840 | spin_unlock(&perf_irq_lock); | ||
| 841 | } | ||
| 842 | EXPORT_SYMBOL_GPL(release_perfctr_intr); | ||
| 843 | |||
| 844 | #ifdef CONFIG_HOTPLUG_CPU | 786 | #ifdef CONFIG_HOTPLUG_CPU |
| 845 | void fixup_irqs(void) | 787 | void fixup_irqs(void) |
| 846 | { | 788 | { |
diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h index 81a972e8d8ea..15d8a3f645c9 100644 --- a/arch/sparc/kernel/kernel.h +++ b/arch/sparc/kernel/kernel.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | /* cpu.c */ | 6 | /* cpu.c */ |
| 7 | extern const char *sparc_cpu_type; | 7 | extern const char *sparc_cpu_type; |
| 8 | extern const char *sparc_pmu_type; | ||
| 8 | extern const char *sparc_fpu_type; | 9 | extern const char *sparc_fpu_type; |
| 9 | 10 | ||
| 10 | extern unsigned int fsr_storage; | 11 | extern unsigned int fsr_storage; |
diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c new file mode 100644 index 000000000000..09f088ed4a64 --- /dev/null +++ b/arch/sparc/kernel/nmi.c | |||
| @@ -0,0 +1,224 @@ | |||
| 1 | /* Pseudo NMI support on sparc64 systems. | ||
| 2 | * | ||
| 3 | * Copyright (C) 2009 David S. Miller <davem@davemloft.net> | ||
| 4 | * | ||
| 5 | * The NMI watchdog support and infrastructure is based almost | ||
| 6 | * entirely upon the x86 NMI support code. | ||
| 7 | */ | ||
| 8 | #include <linux/kernel.h> | ||
| 9 | #include <linux/param.h> | ||
| 10 | #include <linux/init.h> | ||
| 11 | #include <linux/percpu.h> | ||
| 12 | #include <linux/nmi.h> | ||
| 13 | #include <linux/module.h> | ||
| 14 | #include <linux/kprobes.h> | ||
| 15 | #include <linux/kernel_stat.h> | ||
| 16 | #include <linux/slab.h> | ||
| 17 | #include <linux/kdebug.h> | ||
| 18 | #include <linux/delay.h> | ||
| 19 | #include <linux/smp.h> | ||
| 20 | |||
| 21 | #include <asm/ptrace.h> | ||
| 22 | #include <asm/local.h> | ||
| 23 | #include <asm/pcr.h> | ||
| 24 | |||
| 25 | /* We don't have a real NMI on sparc64, but we can fake one | ||
| 26 | * up using profiling counter overflow interrupts and interrupt | ||
| 27 | * levels. | ||
| 28 | * | ||
| 29 | * The profile overflow interrupts at level 15, so we use | ||
| 30 | * level 14 as our IRQ off level. | ||
| 31 | */ | ||
| 32 | |||
| 33 | static int nmi_watchdog_active; | ||
| 34 | static int panic_on_timeout; | ||
| 35 | |||
| 36 | int nmi_usable; | ||
| 37 | EXPORT_SYMBOL_GPL(nmi_usable); | ||
| 38 | |||
| 39 | static unsigned int nmi_hz = HZ; | ||
| 40 | |||
| 41 | static DEFINE_PER_CPU(unsigned int, last_irq_sum); | ||
| 42 | static DEFINE_PER_CPU(local_t, alert_counter); | ||
| 43 | static DEFINE_PER_CPU(int, nmi_touch); | ||
| 44 | |||
| 45 | void touch_nmi_watchdog(void) | ||
| 46 | { | ||
| 47 | if (nmi_watchdog_active) { | ||
| 48 | int cpu; | ||
| 49 | |||
| 50 | for_each_present_cpu(cpu) { | ||
| 51 | if (per_cpu(nmi_touch, cpu) != 1) | ||
| 52 | per_cpu(nmi_touch, cpu) = 1; | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | touch_softlockup_watchdog(); | ||
| 57 | } | ||
| 58 | EXPORT_SYMBOL(touch_nmi_watchdog); | ||
| 59 | |||
| 60 | static void die_nmi(const char *str, struct pt_regs *regs, int do_panic) | ||
| 61 | { | ||
| 62 | if (notify_die(DIE_NMIWATCHDOG, str, regs, 0, | ||
| 63 | pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP) | ||
| 64 | return; | ||
| 65 | |||
| 66 | console_verbose(); | ||
| 67 | bust_spinlocks(1); | ||
| 68 | |||
| 69 | printk(KERN_EMERG "%s", str); | ||
| 70 | printk(" on CPU%d, ip %08lx, registers:\n", | ||
| 71 | smp_processor_id(), regs->tpc); | ||
| 72 | show_regs(regs); | ||
| 73 | |||
| 74 | bust_spinlocks(0); | ||
| 75 | |||
| 76 | if (do_panic || panic_on_oops) | ||
| 77 | panic("Non maskable interrupt"); | ||
| 78 | |||
| 79 | local_irq_enable(); | ||
| 80 | do_exit(SIGBUS); | ||
| 81 | } | ||
| 82 | |||
| 83 | notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs) | ||
| 84 | { | ||
| 85 | unsigned int sum, touched = 0; | ||
| 86 | int cpu = smp_processor_id(); | ||
| 87 | |||
| 88 | clear_softint(1 << irq); | ||
| 89 | pcr_ops->write(PCR_PIC_PRIV); | ||
| 90 | |||
| 91 | local_cpu_data().__nmi_count++; | ||
| 92 | |||
| 93 | if (notify_die(DIE_NMI, "nmi", regs, 0, | ||
| 94 | pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP) | ||
| 95 | touched = 1; | ||
| 96 | |||
| 97 | sum = kstat_irqs_cpu(0, cpu); | ||
| 98 | if (__get_cpu_var(nmi_touch)) { | ||
| 99 | __get_cpu_var(nmi_touch) = 0; | ||
| 100 | touched = 1; | ||
| 101 | } | ||
| 102 | if (!touched && __get_cpu_var(last_irq_sum) == sum) { | ||
| 103 | local_inc(&__get_cpu_var(alert_counter)); | ||
| 104 | if (local_read(&__get_cpu_var(alert_counter)) == 5 * nmi_hz) | ||
| 105 | die_nmi("BUG: NMI Watchdog detected LOCKUP", | ||
| 106 | regs, panic_on_timeout); | ||
| 107 | } else { | ||
| 108 | __get_cpu_var(last_irq_sum) = sum; | ||
| 109 | local_set(&__get_cpu_var(alert_counter), 0); | ||
| 110 | } | ||
| 111 | if (nmi_usable) { | ||
| 112 | write_pic(picl_value(nmi_hz)); | ||
| 113 | pcr_ops->write(pcr_enable); | ||
| 114 | } | ||
| 115 | } | ||
| 116 | |||
| 117 | static inline unsigned int get_nmi_count(int cpu) | ||
| 118 | { | ||
| 119 | return cpu_data(cpu).__nmi_count; | ||
| 120 | } | ||
| 121 | |||
| 122 | static int endflag __initdata; | ||
| 123 | |||
| 124 | static __init void nmi_cpu_busy(void *data) | ||
| 125 | { | ||
| 126 | local_irq_enable_in_hardirq(); | ||
| 127 | while (endflag == 0) | ||
| 128 | mb(); | ||
| 129 | } | ||
| 130 | |||
| 131 | static void report_broken_nmi(int cpu, int *prev_nmi_count) | ||
| 132 | { | ||
| 133 | printk(KERN_CONT "\n"); | ||
| 134 | |||
| 135 | printk(KERN_WARNING | ||
| 136 | "WARNING: CPU#%d: NMI appears to be stuck (%d->%d)!\n", | ||
| 137 | cpu, prev_nmi_count[cpu], get_nmi_count(cpu)); | ||
| 138 | |||
| 139 | printk(KERN_WARNING | ||
| 140 | "Please report this to bugzilla.kernel.org,\n"); | ||
| 141 | printk(KERN_WARNING | ||
| 142 | "and attach the output of the 'dmesg' command.\n"); | ||
| 143 | |||
| 144 | nmi_usable = 0; | ||
| 145 | } | ||
| 146 | |||
| 147 | static void stop_watchdog(void *unused) | ||
| 148 | { | ||
| 149 | pcr_ops->write(PCR_PIC_PRIV); | ||
| 150 | } | ||
| 151 | |||
| 152 | static int __init check_nmi_watchdog(void) | ||
| 153 | { | ||
| 154 | unsigned int *prev_nmi_count; | ||
| 155 | int cpu, err; | ||
| 156 | |||
| 157 | prev_nmi_count = kmalloc(nr_cpu_ids * sizeof(unsigned int), GFP_KERNEL); | ||
| 158 | if (!prev_nmi_count) { | ||
| 159 | err = -ENOMEM; | ||
| 160 | goto error; | ||
| 161 | } | ||
| 162 | |||
| 163 | printk(KERN_INFO "Testing NMI watchdog ... "); | ||
| 164 | |||
| 165 | smp_call_function(nmi_cpu_busy, (void *)&endflag, 0); | ||
| 166 | |||
| 167 | for_each_possible_cpu(cpu) | ||
| 168 | prev_nmi_count[cpu] = get_nmi_count(cpu); | ||
| 169 | local_irq_enable(); | ||
| 170 | mdelay((20 * 1000) / nmi_hz); /* wait 20 ticks */ | ||
| 171 | |||
| 172 | for_each_online_cpu(cpu) { | ||
| 173 | if (get_nmi_count(cpu) - prev_nmi_count[cpu] <= 5) | ||
| 174 | report_broken_nmi(cpu, prev_nmi_count); | ||
| 175 | } | ||
| 176 | endflag = 1; | ||
| 177 | if (!nmi_usable) { | ||
| 178 | kfree(prev_nmi_count); | ||
| 179 | err = -ENODEV; | ||
| 180 | goto error; | ||
| 181 | } | ||
| 182 | printk("OK.\n"); | ||
| 183 | |||
| 184 | nmi_hz = 1; | ||
| 185 | |||
| 186 | kfree(prev_nmi_count); | ||
| 187 | return 0; | ||
| 188 | error: | ||
| 189 | on_each_cpu(stop_watchdog, NULL, 1); | ||
| 190 | return err; | ||
| 191 | } | ||
| 192 | |||
| 193 | static void start_watchdog(void *unused) | ||
| 194 | { | ||
| 195 | pcr_ops->write(PCR_PIC_PRIV); | ||
| 196 | write_pic(picl_value(nmi_hz)); | ||
| 197 | |||
| 198 | pcr_ops->write(pcr_enable); | ||
| 199 | } | ||
| 200 | |||
| 201 | void nmi_adjust_hz(unsigned int new_hz) | ||
| 202 | { | ||
| 203 | nmi_hz = new_hz; | ||
| 204 | on_each_cpu(start_watchdog, NULL, 1); | ||
| 205 | } | ||
| 206 | EXPORT_SYMBOL_GPL(nmi_adjust_hz); | ||
| 207 | |||
| 208 | int __init nmi_init(void) | ||
| 209 | { | ||
| 210 | nmi_usable = 1; | ||
| 211 | |||
| 212 | on_each_cpu(start_watchdog, NULL, 1); | ||
| 213 | |||
| 214 | return check_nmi_watchdog(); | ||
| 215 | } | ||
| 216 | |||
| 217 | static int __init setup_nmi_watchdog(char *str) | ||
| 218 | { | ||
| 219 | if (!strncmp(str, "panic", 5)) | ||
| 220 | panic_on_timeout = 1; | ||
| 221 | |||
| 222 | return 0; | ||
| 223 | } | ||
| 224 | __setup("nmi_watchdog=", setup_nmi_watchdog); | ||
diff --git a/arch/sparc/kernel/pcr.c b/arch/sparc/kernel/pcr.c new file mode 100644 index 000000000000..92e0dda141a4 --- /dev/null +++ b/arch/sparc/kernel/pcr.c | |||
| @@ -0,0 +1,153 @@ | |||
| 1 | /* pcr.c: Generic sparc64 performance counter infrastructure. | ||
| 2 | * | ||
| 3 | * Copyright (C) 2009 David S. Miller (davem@davemloft.net) | ||
| 4 | */ | ||
| 5 | #include <linux/kernel.h> | ||
| 6 | #include <linux/module.h> | ||
| 7 | #include <linux/init.h> | ||
| 8 | #include <linux/irq.h> | ||
| 9 | |||
| 10 | #include <asm/pil.h> | ||
| 11 | #include <asm/pcr.h> | ||
| 12 | #include <asm/nmi.h> | ||
| 13 | |||
| 14 | /* This code is shared between various users of the performance | ||
| 15 | * counters. Users will be oprofile, pseudo-NMI watchdog, and the | ||
| 16 | * perf_counter support layer. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #define PCR_SUN4U_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE) | ||
| 20 | #define PCR_N2_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE | \ | ||
| 21 | PCR_N2_TOE_OV1 | \ | ||
| 22 | (2 << PCR_N2_SL1_SHIFT) | \ | ||
| 23 | (0xff << PCR_N2_MASK1_SHIFT)) | ||
| 24 | |||
| 25 | u64 pcr_enable; | ||
| 26 | unsigned int picl_shift; | ||
| 27 | |||
| 28 | /* Performance counter interrupts run unmasked at PIL level 15. | ||
| 29 | * Therefore we can't do things like wakeups and other work | ||
| 30 | * that expects IRQ disabling to be adhered to in locking etc. | ||
| 31 | * | ||
| 32 | * Therefore in such situations we defer the work by signalling | ||
| 33 | * a lower level cpu IRQ. | ||
| 34 | */ | ||
| 35 | void deferred_pcr_work_irq(int irq, struct pt_regs *regs) | ||
| 36 | { | ||
| 37 | clear_softint(1 << PIL_DEFERRED_PCR_WORK); | ||
| 38 | } | ||
| 39 | |||
| 40 | void schedule_deferred_pcr_work(void) | ||
| 41 | { | ||
| 42 | set_softint(1 << PIL_DEFERRED_PCR_WORK); | ||
| 43 | } | ||
| 44 | |||
| 45 | const struct pcr_ops *pcr_ops; | ||
| 46 | EXPORT_SYMBOL_GPL(pcr_ops); | ||
| 47 | |||
| 48 | static u64 direct_pcr_read(void) | ||
| 49 | { | ||
| 50 | u64 val; | ||
| 51 | |||
| 52 | read_pcr(val); | ||
| 53 | return val; | ||
| 54 | } | ||
| 55 | |||
| 56 | static void direct_pcr_write(u64 val) | ||
| 57 | { | ||
| 58 | write_pcr(val); | ||
| 59 | } | ||
| 60 | |||
| 61 | static const struct pcr_ops direct_pcr_ops = { | ||
| 62 | .read = direct_pcr_read, | ||
| 63 | .write = direct_pcr_write, | ||
| 64 | }; | ||
| 65 | |||
| 66 | static void n2_pcr_write(u64 val) | ||
| 67 | { | ||
| 68 | unsigned long ret; | ||
| 69 | |||
| 70 | ret = sun4v_niagara2_setperf(HV_N2_PERF_SPARC_CTL, val); | ||
| 71 | if (val != HV_EOK) | ||
| 72 | write_pcr(val); | ||
| 73 | } | ||
| 74 | |||
| 75 | static const struct pcr_ops n2_pcr_ops = { | ||
| 76 | .read = direct_pcr_read, | ||
| 77 | .write = n2_pcr_write, | ||
| 78 | }; | ||
| 79 | |||
| 80 | static unsigned long perf_hsvc_group; | ||
| 81 | static unsigned long perf_hsvc_major; | ||
| 82 | static unsigned long perf_hsvc_minor; | ||
| 83 | |||
| 84 | static int __init register_perf_hsvc(void) | ||
| 85 | { | ||
| 86 | if (tlb_type == hypervisor) { | ||
| 87 | switch (sun4v_chip_type) { | ||
| 88 | case SUN4V_CHIP_NIAGARA1: | ||
| 89 | perf_hsvc_group = HV_GRP_NIAG_PERF; | ||
| 90 | break; | ||
| 91 | |||
| 92 | case SUN4V_CHIP_NIAGARA2: | ||
| 93 | perf_hsvc_group = HV_GRP_N2_CPU; | ||
| 94 | break; | ||
| 95 | |||
| 96 | default: | ||
| 97 | return -ENODEV; | ||
| 98 | } | ||
| 99 | |||
| 100 | |||
| 101 | perf_hsvc_major = 1; | ||
| 102 | perf_hsvc_minor = 0; | ||
| 103 | if (sun4v_hvapi_register(perf_hsvc_group, | ||
| 104 | perf_hsvc_major, | ||
| 105 | &perf_hsvc_minor)) { | ||
| 106 | printk("perfmon: Could not register hvapi.\n"); | ||
| 107 | return -ENODEV; | ||
| 108 | } | ||
| 109 | } | ||
| 110 | return 0; | ||
| 111 | } | ||
| 112 | |||
| 113 | static void __init unregister_perf_hsvc(void) | ||
| 114 | { | ||
| 115 | if (tlb_type != hypervisor) | ||
| 116 | return; | ||
| 117 | sun4v_hvapi_unregister(perf_hsvc_group); | ||
| 118 | } | ||
| 119 | |||
| 120 | int __init pcr_arch_init(void) | ||
| 121 | { | ||
| 122 | int err = register_perf_hsvc(); | ||
| 123 | |||
| 124 | if (err) | ||
| 125 | return err; | ||
| 126 | |||
| 127 | switch (tlb_type) { | ||
| 128 | case hypervisor: | ||
| 129 | pcr_ops = &n2_pcr_ops; | ||
| 130 | pcr_enable = PCR_N2_ENABLE; | ||
| 131 | picl_shift = 2; | ||
| 132 | break; | ||
| 133 | |||
| 134 | case cheetah: | ||
| 135 | case cheetah_plus: | ||
| 136 | case spitfire: | ||
| 137 | pcr_ops = &direct_pcr_ops; | ||
| 138 | pcr_enable = PCR_SUN4U_ENABLE; | ||
| 139 | break; | ||
| 140 | |||
| 141 | default: | ||
| 142 | err = -ENODEV; | ||
| 143 | goto out_unregister; | ||
| 144 | } | ||
| 145 | |||
| 146 | return nmi_init(); | ||
| 147 | |||
| 148 | out_unregister: | ||
| 149 | unregister_perf_hsvc(); | ||
| 150 | return err; | ||
| 151 | } | ||
| 152 | |||
| 153 | arch_initcall(pcr_arch_init); | ||
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c index cc8b5604442c..a73954b87f0a 100644 --- a/arch/sparc/kernel/process_64.c +++ b/arch/sparc/kernel/process_64.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/cpu.h> | 29 | #include <linux/cpu.h> |
| 30 | #include <linux/elfcore.h> | 30 | #include <linux/elfcore.h> |
| 31 | #include <linux/sysrq.h> | 31 | #include <linux/sysrq.h> |
| 32 | #include <linux/nmi.h> | ||
| 32 | 33 | ||
| 33 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
| 34 | #include <asm/system.h> | 35 | #include <asm/system.h> |
| @@ -52,8 +53,10 @@ | |||
| 52 | 53 | ||
| 53 | static void sparc64_yield(int cpu) | 54 | static void sparc64_yield(int cpu) |
| 54 | { | 55 | { |
| 55 | if (tlb_type != hypervisor) | 56 | if (tlb_type != hypervisor) { |
| 57 | touch_nmi_watchdog(); | ||
| 56 | return; | 58 | return; |
| 59 | } | ||
| 57 | 60 | ||
| 58 | clear_thread_flag(TIF_POLLING_NRFLAG); | 61 | clear_thread_flag(TIF_POLLING_NRFLAG); |
| 59 | smp_mb__after_clear_bit(); | 62 | smp_mb__after_clear_bit(); |
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index 49d061f4ae9d..f2bcfd2967d7 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c | |||
| @@ -354,6 +354,7 @@ static int show_cpuinfo(struct seq_file *m, void *__unused) | |||
| 354 | seq_printf(m, | 354 | seq_printf(m, |
| 355 | "cpu\t\t: %s\n" | 355 | "cpu\t\t: %s\n" |
| 356 | "fpu\t\t: %s\n" | 356 | "fpu\t\t: %s\n" |
| 357 | "pmu\t\t: %s\n" | ||
| 357 | "prom\t\t: %s\n" | 358 | "prom\t\t: %s\n" |
| 358 | "type\t\t: %s\n" | 359 | "type\t\t: %s\n" |
| 359 | "ncpus probed\t: %d\n" | 360 | "ncpus probed\t: %d\n" |
| @@ -366,6 +367,7 @@ static int show_cpuinfo(struct seq_file *m, void *__unused) | |||
| 366 | , | 367 | , |
| 367 | sparc_cpu_type, | 368 | sparc_cpu_type, |
| 368 | sparc_fpu_type, | 369 | sparc_fpu_type, |
| 370 | sparc_pmu_type, | ||
| 369 | prom_version, | 371 | prom_version, |
| 370 | ((tlb_type == hypervisor) ? | 372 | ((tlb_type == hypervisor) ? |
| 371 | "sun4v" : | 373 | "sun4v" : |
diff --git a/arch/sparc/kernel/ttable.S b/arch/sparc/kernel/ttable.S index ea925503b42e..d9bdfb9d5c18 100644 --- a/arch/sparc/kernel/ttable.S +++ b/arch/sparc/kernel/ttable.S | |||
| @@ -63,7 +63,8 @@ tl0_irq6: TRAP_IRQ(smp_call_function_single_client, 6) | |||
| 63 | #else | 63 | #else |
| 64 | tl0_irq6: BTRAP(0x46) | 64 | tl0_irq6: BTRAP(0x46) |
| 65 | #endif | 65 | #endif |
| 66 | tl0_irq7: BTRAP(0x47) BTRAP(0x48) BTRAP(0x49) | 66 | tl0_irq7: TRAP_IRQ(deferred_pcr_work_irq, 7) |
| 67 | tl0_irq8: BTRAP(0x48) BTRAP(0x49) | ||
| 67 | tl0_irq10: BTRAP(0x4a) BTRAP(0x4b) BTRAP(0x4c) BTRAP(0x4d) | 68 | tl0_irq10: BTRAP(0x4a) BTRAP(0x4b) BTRAP(0x4c) BTRAP(0x4d) |
| 68 | tl0_irq14: TRAP_IRQ(timer_interrupt, 14) | 69 | tl0_irq14: TRAP_IRQ(timer_interrupt, 14) |
| 69 | tl0_irq15: TRAP_NMI_IRQ(perfctr_irq, 15) | 70 | tl0_irq15: TRAP_NMI_IRQ(perfctr_irq, 15) |
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c index a9e474bf6385..4ab8993b0863 100644 --- a/arch/sparc/mm/fault_64.c +++ b/arch/sparc/mm/fault_64.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
| 20 | #include <linux/kprobes.h> | 20 | #include <linux/kprobes.h> |
| 21 | #include <linux/kdebug.h> | 21 | #include <linux/kdebug.h> |
| 22 | #include <linux/percpu.h> | ||
| 22 | 23 | ||
| 23 | #include <asm/page.h> | 24 | #include <asm/page.h> |
| 24 | #include <asm/pgtable.h> | 25 | #include <asm/pgtable.h> |
| @@ -224,6 +225,30 @@ cannot_handle: | |||
| 224 | unhandled_fault (address, current, regs); | 225 | unhandled_fault (address, current, regs); |
| 225 | } | 226 | } |
| 226 | 227 | ||
| 228 | static void noinline bogus_32bit_fault_tpc(struct pt_regs *regs) | ||
| 229 | { | ||
| 230 | static int times; | ||
| 231 | |||
| 232 | if (times++ < 10) | ||
| 233 | printk(KERN_ERR "FAULT[%s:%d]: 32-bit process reports " | ||
| 234 | "64-bit TPC [%lx]\n", | ||
| 235 | current->comm, current->pid, | ||
| 236 | regs->tpc); | ||
| 237 | show_regs(regs); | ||
| 238 | } | ||
| 239 | |||
| 240 | static void noinline bogus_32bit_fault_address(struct pt_regs *regs, | ||
| 241 | unsigned long addr) | ||
| 242 | { | ||
| 243 | static int times; | ||
| 244 | |||
| 245 | if (times++ < 10) | ||
| 246 | printk(KERN_ERR "FAULT[%s:%d]: 32-bit process " | ||
| 247 | "reports 64-bit fault address [%lx]\n", | ||
| 248 | current->comm, current->pid, addr); | ||
| 249 | show_regs(regs); | ||
| 250 | } | ||
| 251 | |||
| 227 | asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) | 252 | asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) |
| 228 | { | 253 | { |
| 229 | struct mm_struct *mm = current->mm; | 254 | struct mm_struct *mm = current->mm; |
| @@ -244,6 +269,19 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) | |||
| 244 | (fault_code & FAULT_CODE_DTLB)) | 269 | (fault_code & FAULT_CODE_DTLB)) |
| 245 | BUG(); | 270 | BUG(); |
| 246 | 271 | ||
| 272 | if (test_thread_flag(TIF_32BIT)) { | ||
| 273 | if (!(regs->tstate & TSTATE_PRIV)) { | ||
| 274 | if (unlikely((regs->tpc >> 32) != 0)) { | ||
| 275 | bogus_32bit_fault_tpc(regs); | ||
| 276 | goto intr_or_no_mm; | ||
| 277 | } | ||
| 278 | } | ||
| 279 | if (unlikely((address >> 32) != 0)) { | ||
| 280 | bogus_32bit_fault_address(regs, address); | ||
| 281 | goto intr_or_no_mm; | ||
| 282 | } | ||
| 283 | } | ||
| 284 | |||
| 247 | if (regs->tstate & TSTATE_PRIV) { | 285 | if (regs->tstate & TSTATE_PRIV) { |
| 248 | unsigned long tpc = regs->tpc; | 286 | unsigned long tpc = regs->tpc; |
| 249 | 287 | ||
| @@ -264,12 +302,6 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) | |||
| 264 | if (in_atomic() || !mm) | 302 | if (in_atomic() || !mm) |
| 265 | goto intr_or_no_mm; | 303 | goto intr_or_no_mm; |
| 266 | 304 | ||
| 267 | if (test_thread_flag(TIF_32BIT)) { | ||
| 268 | if (!(regs->tstate & TSTATE_PRIV)) | ||
| 269 | regs->tpc &= 0xffffffff; | ||
| 270 | address &= 0xffffffff; | ||
| 271 | } | ||
| 272 | |||
| 273 | if (!down_read_trylock(&mm->mmap_sem)) { | 305 | if (!down_read_trylock(&mm->mmap_sem)) { |
| 274 | if ((regs->tstate & TSTATE_PRIV) && | 306 | if ((regs->tstate & TSTATE_PRIV) && |
| 275 | !search_exception_tables(regs->tpc)) { | 307 | !search_exception_tables(regs->tpc)) { |
diff --git a/arch/sparc/oprofile/init.c b/arch/sparc/oprofile/init.c index d6e170c074fc..d172f86439b1 100644 --- a/arch/sparc/oprofile/init.c +++ b/arch/sparc/oprofile/init.c | |||
| @@ -13,217 +13,57 @@ | |||
| 13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
| 14 | 14 | ||
| 15 | #ifdef CONFIG_SPARC64 | 15 | #ifdef CONFIG_SPARC64 |
| 16 | #include <asm/hypervisor.h> | 16 | #include <linux/notifier.h> |
| 17 | #include <asm/spitfire.h> | 17 | #include <linux/rcupdate.h> |
| 18 | #include <asm/cpudata.h> | 18 | #include <linux/kdebug.h> |
| 19 | #include <asm/irq.h> | 19 | #include <asm/nmi.h> |
| 20 | 20 | ||
| 21 | static int nmi_enabled; | 21 | static int profile_timer_exceptions_notify(struct notifier_block *self, |
| 22 | 22 | unsigned long val, void *data) | |
| 23 | struct pcr_ops { | ||
| 24 | u64 (*read)(void); | ||
| 25 | void (*write)(u64); | ||
| 26 | }; | ||
| 27 | static const struct pcr_ops *pcr_ops; | ||
| 28 | |||
| 29 | static u64 direct_pcr_read(void) | ||
| 30 | { | ||
| 31 | u64 val; | ||
| 32 | |||
| 33 | read_pcr(val); | ||
| 34 | return val; | ||
| 35 | } | ||
| 36 | |||
| 37 | static void direct_pcr_write(u64 val) | ||
| 38 | { | ||
| 39 | write_pcr(val); | ||
| 40 | } | ||
| 41 | |||
| 42 | static const struct pcr_ops direct_pcr_ops = { | ||
| 43 | .read = direct_pcr_read, | ||
| 44 | .write = direct_pcr_write, | ||
| 45 | }; | ||
| 46 | |||
| 47 | static void n2_pcr_write(u64 val) | ||
| 48 | { | 23 | { |
| 49 | unsigned long ret; | 24 | struct die_args *args = (struct die_args *)data; |
| 50 | 25 | int ret = NOTIFY_DONE; | |
| 51 | ret = sun4v_niagara2_setperf(HV_N2_PERF_SPARC_CTL, val); | ||
| 52 | if (val != HV_EOK) | ||
| 53 | write_pcr(val); | ||
| 54 | } | ||
| 55 | |||
| 56 | static const struct pcr_ops n2_pcr_ops = { | ||
| 57 | .read = direct_pcr_read, | ||
| 58 | .write = n2_pcr_write, | ||
| 59 | }; | ||
| 60 | |||
| 61 | /* In order to commonize as much of the implementation as | ||
| 62 | * possible, we use PICH as our counter. Mostly this is | ||
| 63 | * to accomodate Niagara-1 which can only count insn cycles | ||
| 64 | * in PICH. | ||
| 65 | */ | ||
| 66 | static u64 picl_value(void) | ||
| 67 | { | ||
| 68 | u32 delta = local_cpu_data().clock_tick / HZ; | ||
| 69 | |||
| 70 | return ((u64)((0 - delta) & 0xffffffff)) << 32; | ||
| 71 | } | ||
| 72 | |||
| 73 | #define PCR_PIC_PRIV 0x00000001 /* PIC access is privileged */ | ||
| 74 | #define PCR_STRACE 0x00000002 /* Trace supervisor events */ | ||
| 75 | #define PCR_UTRACE 0x00000004 /* Trace user events */ | ||
| 76 | #define PCR_N2_HTRACE 0x00000008 /* Trace hypervisor events */ | ||
| 77 | #define PCR_N2_TOE_OV0 0x00000010 /* Trap if PIC 0 overflows */ | ||
| 78 | #define PCR_N2_TOE_OV1 0x00000020 /* Trap if PIC 1 overflows */ | ||
| 79 | #define PCR_N2_MASK0 0x00003fc0 | ||
| 80 | #define PCR_N2_MASK0_SHIFT 6 | ||
| 81 | #define PCR_N2_SL0 0x0003c000 | ||
| 82 | #define PCR_N2_SL0_SHIFT 14 | ||
| 83 | #define PCR_N2_OV0 0x00040000 | ||
| 84 | #define PCR_N2_MASK1 0x07f80000 | ||
| 85 | #define PCR_N2_MASK1_SHIFT 19 | ||
| 86 | #define PCR_N2_SL1 0x78000000 | ||
| 87 | #define PCR_N2_SL1_SHIFT 27 | ||
| 88 | #define PCR_N2_OV1 0x80000000 | ||
| 89 | |||
| 90 | #define PCR_SUN4U_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE) | ||
| 91 | #define PCR_N2_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE | \ | ||
| 92 | PCR_N2_TOE_OV1 | \ | ||
| 93 | (2 << PCR_N2_SL1_SHIFT) | \ | ||
| 94 | (0xff << PCR_N2_MASK1_SHIFT)) | ||
| 95 | |||
| 96 | static u64 pcr_enable = PCR_SUN4U_ENABLE; | ||
| 97 | |||
| 98 | static void nmi_handler(struct pt_regs *regs) | ||
| 99 | { | ||
| 100 | pcr_ops->write(PCR_PIC_PRIV); | ||
| 101 | |||
| 102 | if (nmi_enabled) { | ||
| 103 | oprofile_add_sample(regs, 0); | ||
| 104 | |||
| 105 | write_pic(picl_value()); | ||
| 106 | pcr_ops->write(pcr_enable); | ||
| 107 | } | ||
| 108 | } | ||
| 109 | |||
| 110 | /* We count "clock cycle" events in the lower 32-bit PIC. | ||
| 111 | * Then configure it such that it overflows every HZ, and thus | ||
| 112 | * generates a level 15 interrupt at that frequency. | ||
| 113 | */ | ||
| 114 | static void cpu_nmi_start(void *_unused) | ||
| 115 | { | ||
| 116 | pcr_ops->write(PCR_PIC_PRIV); | ||
| 117 | write_pic(picl_value()); | ||
| 118 | |||
| 119 | pcr_ops->write(pcr_enable); | ||
| 120 | } | ||
| 121 | 26 | ||
| 122 | static void cpu_nmi_stop(void *_unused) | 27 | switch (val) { |
| 123 | { | 28 | case DIE_NMI: |
| 124 | pcr_ops->write(PCR_PIC_PRIV); | 29 | oprofile_add_sample(args->regs, 0); |
| 125 | } | 30 | ret = NOTIFY_STOP; |
| 126 | 31 | break; | |
| 127 | static int nmi_start(void) | 32 | default: |
| 128 | { | 33 | break; |
| 129 | int err = register_perfctr_intr(nmi_handler); | ||
| 130 | |||
| 131 | if (!err) { | ||
| 132 | nmi_enabled = 1; | ||
| 133 | wmb(); | ||
| 134 | err = on_each_cpu(cpu_nmi_start, NULL, 1); | ||
| 135 | if (err) { | ||
| 136 | nmi_enabled = 0; | ||
| 137 | wmb(); | ||
| 138 | on_each_cpu(cpu_nmi_stop, NULL, 1); | ||
| 139 | release_perfctr_intr(nmi_handler); | ||
| 140 | } | ||
| 141 | } | 34 | } |
| 142 | 35 | return ret; | |
| 143 | return err; | ||
| 144 | } | ||
| 145 | |||
| 146 | static void nmi_stop(void) | ||
| 147 | { | ||
| 148 | nmi_enabled = 0; | ||
| 149 | wmb(); | ||
| 150 | |||
| 151 | on_each_cpu(cpu_nmi_stop, NULL, 1); | ||
| 152 | release_perfctr_intr(nmi_handler); | ||
| 153 | synchronize_sched(); | ||
| 154 | } | 36 | } |
| 155 | 37 | ||
| 156 | static unsigned long perf_hsvc_group; | 38 | static struct notifier_block profile_timer_exceptions_nb = { |
| 157 | static unsigned long perf_hsvc_major; | 39 | .notifier_call = profile_timer_exceptions_notify, |
| 158 | static unsigned long perf_hsvc_minor; | 40 | }; |
| 159 | 41 | ||
| 160 | static int __init register_perf_hsvc(void) | 42 | static int timer_start(void) |
| 161 | { | 43 | { |
| 162 | if (tlb_type == hypervisor) { | 44 | if (register_die_notifier(&profile_timer_exceptions_nb)) |
| 163 | switch (sun4v_chip_type) { | 45 | return 1; |
| 164 | case SUN4V_CHIP_NIAGARA1: | 46 | nmi_adjust_hz(HZ); |
| 165 | perf_hsvc_group = HV_GRP_NIAG_PERF; | ||
| 166 | break; | ||
| 167 | |||
| 168 | case SUN4V_CHIP_NIAGARA2: | ||
| 169 | perf_hsvc_group = HV_GRP_N2_CPU; | ||
| 170 | break; | ||
| 171 | |||
| 172 | default: | ||
| 173 | return -ENODEV; | ||
| 174 | } | ||
| 175 | |||
| 176 | |||
| 177 | perf_hsvc_major = 1; | ||
| 178 | perf_hsvc_minor = 0; | ||
| 179 | if (sun4v_hvapi_register(perf_hsvc_group, | ||
| 180 | perf_hsvc_major, | ||
| 181 | &perf_hsvc_minor)) { | ||
| 182 | printk("perfmon: Could not register N2 hvapi.\n"); | ||
| 183 | return -ENODEV; | ||
| 184 | } | ||
| 185 | } | ||
| 186 | return 0; | 47 | return 0; |
| 187 | } | 48 | } |
| 188 | 49 | ||
| 189 | static void unregister_perf_hsvc(void) | 50 | |
| 51 | static void timer_stop(void) | ||
| 190 | { | 52 | { |
| 191 | if (tlb_type != hypervisor) | 53 | nmi_adjust_hz(1); |
| 192 | return; | 54 | unregister_die_notifier(&profile_timer_exceptions_nb); |
| 193 | sun4v_hvapi_unregister(perf_hsvc_group); | 55 | synchronize_sched(); /* Allow already-started NMIs to complete. */ |
| 194 | } | 56 | } |
| 195 | 57 | ||
| 196 | static int oprofile_nmi_init(struct oprofile_operations *ops) | 58 | static int op_nmi_timer_init(struct oprofile_operations *ops) |
| 197 | { | 59 | { |
| 198 | int err = register_perf_hsvc(); | 60 | if (!nmi_usable) |
| 199 | |||
| 200 | if (err) | ||
| 201 | return err; | ||
| 202 | |||
| 203 | switch (tlb_type) { | ||
| 204 | case hypervisor: | ||
| 205 | pcr_ops = &n2_pcr_ops; | ||
| 206 | pcr_enable = PCR_N2_ENABLE; | ||
| 207 | break; | ||
| 208 | |||
| 209 | case cheetah: | ||
| 210 | case cheetah_plus: | ||
| 211 | pcr_ops = &direct_pcr_ops; | ||
| 212 | break; | ||
| 213 | |||
| 214 | default: | ||
| 215 | return -ENODEV; | 61 | return -ENODEV; |
| 216 | } | ||
| 217 | 62 | ||
| 218 | ops->create_files = NULL; | 63 | ops->start = timer_start; |
| 219 | ops->setup = NULL; | 64 | ops->stop = timer_stop; |
| 220 | ops->shutdown = NULL; | ||
| 221 | ops->start = nmi_start; | ||
| 222 | ops->stop = nmi_stop; | ||
| 223 | ops->cpu_type = "timer"; | 65 | ops->cpu_type = "timer"; |
| 224 | 66 | printk(KERN_INFO "oprofile: Using perfctr NMI timer interrupt.\n"); | |
| 225 | printk(KERN_INFO "oprofile: Using perfctr based NMI timer interrupt.\n"); | ||
| 226 | |||
| 227 | return 0; | 67 | return 0; |
| 228 | } | 68 | } |
| 229 | #endif | 69 | #endif |
| @@ -233,7 +73,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) | |||
| 233 | int ret = -ENODEV; | 73 | int ret = -ENODEV; |
| 234 | 74 | ||
| 235 | #ifdef CONFIG_SPARC64 | 75 | #ifdef CONFIG_SPARC64 |
| 236 | ret = oprofile_nmi_init(ops); | 76 | ret = op_nmi_timer_init(ops); |
| 237 | if (!ret) | 77 | if (!ret) |
| 238 | return ret; | 78 | return ret; |
| 239 | #endif | 79 | #endif |
| @@ -241,10 +81,6 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) | |||
| 241 | return ret; | 81 | return ret; |
| 242 | } | 82 | } |
| 243 | 83 | ||
| 244 | |||
| 245 | void oprofile_arch_exit(void) | 84 | void oprofile_arch_exit(void) |
| 246 | { | 85 | { |
| 247 | #ifdef CONFIG_SPARC64 | ||
| 248 | unregister_perf_hsvc(); | ||
| 249 | #endif | ||
| 250 | } | 86 | } |
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index 256b00b61892..5a0d76dc56a4 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
| @@ -418,9 +418,9 @@ ENTRY(ia32_syscall) | |||
| 418 | orl $TS_COMPAT,TI_status(%r10) | 418 | orl $TS_COMPAT,TI_status(%r10) |
| 419 | testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10) | 419 | testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10) |
| 420 | jnz ia32_tracesys | 420 | jnz ia32_tracesys |
| 421 | ia32_do_syscall: | ||
| 422 | cmpl $(IA32_NR_syscalls-1),%eax | 421 | cmpl $(IA32_NR_syscalls-1),%eax |
| 423 | ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */ | 422 | ja ia32_badsys |
| 423 | ia32_do_call: | ||
| 424 | IA32_ARG_FIXUP | 424 | IA32_ARG_FIXUP |
| 425 | call *ia32_sys_call_table(,%rax,8) # xxx: rip relative | 425 | call *ia32_sys_call_table(,%rax,8) # xxx: rip relative |
| 426 | ia32_sysret: | 426 | ia32_sysret: |
| @@ -435,7 +435,9 @@ ia32_tracesys: | |||
| 435 | call syscall_trace_enter | 435 | call syscall_trace_enter |
| 436 | LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */ | 436 | LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */ |
| 437 | RESTORE_REST | 437 | RESTORE_REST |
| 438 | jmp ia32_do_syscall | 438 | cmpl $(IA32_NR_syscalls-1),%eax |
| 439 | ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */ | ||
| 440 | jmp ia32_do_call | ||
| 439 | END(ia32_syscall) | 441 | END(ia32_syscall) |
| 440 | 442 | ||
| 441 | ia32_badsys: | 443 | ia32_badsys: |
diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c index 4b6df2469fe3..115449f869ee 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic.c | |||
| @@ -1436,7 +1436,7 @@ static int __init detect_init_APIC(void) | |||
| 1436 | switch (boot_cpu_data.x86_vendor) { | 1436 | switch (boot_cpu_data.x86_vendor) { |
| 1437 | case X86_VENDOR_AMD: | 1437 | case X86_VENDOR_AMD: |
| 1438 | if ((boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model > 1) || | 1438 | if ((boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model > 1) || |
| 1439 | (boot_cpu_data.x86 == 15)) | 1439 | (boot_cpu_data.x86 >= 15)) |
| 1440 | break; | 1440 | break; |
| 1441 | goto no_apic; | 1441 | goto no_apic; |
| 1442 | case X86_VENDOR_INTEL: | 1442 | case X86_VENDOR_INTEL: |
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index 48533d77be78..da299eb85fc0 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
| @@ -36,8 +36,11 @@ static struct _cache_table cache_table[] __cpuinitdata = | |||
| 36 | { | 36 | { |
| 37 | { 0x06, LVL_1_INST, 8 }, /* 4-way set assoc, 32 byte line size */ | 37 | { 0x06, LVL_1_INST, 8 }, /* 4-way set assoc, 32 byte line size */ |
| 38 | { 0x08, LVL_1_INST, 16 }, /* 4-way set assoc, 32 byte line size */ | 38 | { 0x08, LVL_1_INST, 16 }, /* 4-way set assoc, 32 byte line size */ |
| 39 | { 0x09, LVL_1_INST, 32 }, /* 4-way set assoc, 64 byte line size */ | ||
| 39 | { 0x0a, LVL_1_DATA, 8 }, /* 2 way set assoc, 32 byte line size */ | 40 | { 0x0a, LVL_1_DATA, 8 }, /* 2 way set assoc, 32 byte line size */ |
| 40 | { 0x0c, LVL_1_DATA, 16 }, /* 4-way set assoc, 32 byte line size */ | 41 | { 0x0c, LVL_1_DATA, 16 }, /* 4-way set assoc, 32 byte line size */ |
| 42 | { 0x0d, LVL_1_DATA, 16 }, /* 4-way set assoc, 64 byte line size */ | ||
| 43 | { 0x21, LVL_2, 256 }, /* 8-way set assoc, 64 byte line size */ | ||
| 41 | { 0x22, LVL_3, 512 }, /* 4-way set assoc, sectored cache, 64 byte line size */ | 44 | { 0x22, LVL_3, 512 }, /* 4-way set assoc, sectored cache, 64 byte line size */ |
| 42 | { 0x23, LVL_3, 1024 }, /* 8-way set assoc, sectored cache, 64 byte line size */ | 45 | { 0x23, LVL_3, 1024 }, /* 8-way set assoc, sectored cache, 64 byte line size */ |
| 43 | { 0x25, LVL_3, 2048 }, /* 8-way set assoc, sectored cache, 64 byte line size */ | 46 | { 0x25, LVL_3, 2048 }, /* 8-way set assoc, sectored cache, 64 byte line size */ |
| @@ -85,6 +88,18 @@ static struct _cache_table cache_table[] __cpuinitdata = | |||
| 85 | { 0x85, LVL_2, 2048 }, /* 8-way set assoc, 32 byte line size */ | 88 | { 0x85, LVL_2, 2048 }, /* 8-way set assoc, 32 byte line size */ |
| 86 | { 0x86, LVL_2, 512 }, /* 4-way set assoc, 64 byte line size */ | 89 | { 0x86, LVL_2, 512 }, /* 4-way set assoc, 64 byte line size */ |
| 87 | { 0x87, LVL_2, 1024 }, /* 8-way set assoc, 64 byte line size */ | 90 | { 0x87, LVL_2, 1024 }, /* 8-way set assoc, 64 byte line size */ |
| 91 | { 0xd0, LVL_3, 512 }, /* 4-way set assoc, 64 byte line size */ | ||
| 92 | { 0xd1, LVL_3, 1024 }, /* 4-way set assoc, 64 byte line size */ | ||
| 93 | { 0xd2, LVL_3, 2048 }, /* 4-way set assoc, 64 byte line size */ | ||
| 94 | { 0xd6, LVL_3, 1024 }, /* 8-way set assoc, 64 byte line size */ | ||
| 95 | { 0xd7, LVL_3, 2038 }, /* 8-way set assoc, 64 byte line size */ | ||
| 96 | { 0xd8, LVL_3, 4096 }, /* 12-way set assoc, 64 byte line size */ | ||
| 97 | { 0xdc, LVL_3, 2048 }, /* 12-way set assoc, 64 byte line size */ | ||
| 98 | { 0xdd, LVL_3, 4096 }, /* 12-way set assoc, 64 byte line size */ | ||
| 99 | { 0xde, LVL_3, 8192 }, /* 12-way set assoc, 64 byte line size */ | ||
| 100 | { 0xe2, LVL_3, 2048 }, /* 16-way set assoc, 64 byte line size */ | ||
| 101 | { 0xe3, LVL_3, 4096 }, /* 16-way set assoc, 64 byte line size */ | ||
| 102 | { 0xe4, LVL_3, 8192 }, /* 16-way set assoc, 64 byte line size */ | ||
| 88 | { 0x00, 0, 0} | 103 | { 0x00, 0, 0} |
| 89 | }; | 104 | }; |
| 90 | 105 | ||
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index e28c7a987793..a1346217e43c 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
| @@ -346,6 +346,7 @@ ENTRY(save_args) | |||
| 346 | popq_cfi %rax /* move return address... */ | 346 | popq_cfi %rax /* move return address... */ |
| 347 | mov %gs:pda_irqstackptr,%rsp | 347 | mov %gs:pda_irqstackptr,%rsp |
| 348 | EMPTY_FRAME 0 | 348 | EMPTY_FRAME 0 |
| 349 | pushq_cfi %rbp /* backlink for unwinder */ | ||
| 349 | pushq_cfi %rax /* ... to the new stack */ | 350 | pushq_cfi %rax /* ... to the new stack */ |
| 350 | /* | 351 | /* |
| 351 | * We entered an interrupt context - irqs are off: | 352 | * We entered an interrupt context - irqs are off: |
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c index 1c4a1302536c..9b0c480c383b 100644 --- a/arch/x86/kernel/io_apic.c +++ b/arch/x86/kernel/io_apic.c | |||
| @@ -2528,14 +2528,15 @@ static void irq_complete_move(struct irq_desc **descp) | |||
| 2528 | 2528 | ||
| 2529 | vector = ~get_irq_regs()->orig_ax; | 2529 | vector = ~get_irq_regs()->orig_ax; |
| 2530 | me = smp_processor_id(); | 2530 | me = smp_processor_id(); |
| 2531 | |||
| 2532 | if (vector == cfg->vector && cpumask_test_cpu(me, cfg->domain)) { | ||
| 2531 | #ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC | 2533 | #ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC |
| 2532 | *descp = desc = move_irq_desc(desc, me); | 2534 | *descp = desc = move_irq_desc(desc, me); |
| 2533 | /* get the new one */ | 2535 | /* get the new one */ |
| 2534 | cfg = desc->chip_data; | 2536 | cfg = desc->chip_data; |
| 2535 | #endif | 2537 | #endif |
| 2536 | |||
| 2537 | if (vector == cfg->vector && cpumask_test_cpu(me, cfg->domain)) | ||
| 2538 | send_cleanup_vector(cfg); | 2538 | send_cleanup_vector(cfg); |
| 2539 | } | ||
| 2539 | } | 2540 | } |
| 2540 | #else | 2541 | #else |
| 2541 | static inline void irq_complete_move(struct irq_desc **descp) {} | 2542 | static inline void irq_complete_move(struct irq_desc **descp) {} |
diff --git a/arch/x86/kernel/irqinit_32.c b/arch/x86/kernel/irqinit_32.c index 1507ad4e674d..10a09c2f1828 100644 --- a/arch/x86/kernel/irqinit_32.c +++ b/arch/x86/kernel/irqinit_32.c | |||
| @@ -78,15 +78,6 @@ void __init init_ISA_irqs(void) | |||
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | /* | ||
| 82 | * IRQ2 is cascade interrupt to second interrupt controller | ||
| 83 | */ | ||
| 84 | static struct irqaction irq2 = { | ||
| 85 | .handler = no_action, | ||
| 86 | .mask = CPU_MASK_NONE, | ||
| 87 | .name = "cascade", | ||
| 88 | }; | ||
| 89 | |||
| 90 | DEFINE_PER_CPU(vector_irq_t, vector_irq) = { | 81 | DEFINE_PER_CPU(vector_irq_t, vector_irq) = { |
| 91 | [0 ... IRQ0_VECTOR - 1] = -1, | 82 | [0 ... IRQ0_VECTOR - 1] = -1, |
| 92 | [IRQ0_VECTOR] = 0, | 83 | [IRQ0_VECTOR] = 0, |
| @@ -178,9 +169,6 @@ void __init native_init_IRQ(void) | |||
| 178 | alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt); | 169 | alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt); |
| 179 | #endif | 170 | #endif |
| 180 | 171 | ||
| 181 | if (!acpi_ioapic) | ||
| 182 | setup_irq(2, &irq2); | ||
| 183 | |||
| 184 | /* setup after call gates are initialised (usually add in | 172 | /* setup after call gates are initialised (usually add in |
| 185 | * the architecture specific gates) | 173 | * the architecture specific gates) |
| 186 | */ | 174 | */ |
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c index 309949e9e1c1..697d1b78cfbf 100644 --- a/arch/x86/kernel/quirks.c +++ b/arch/x86/kernel/quirks.c | |||
| @@ -172,7 +172,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_4, | |||
| 172 | ich_force_enable_hpet); | 172 | ich_force_enable_hpet); |
| 173 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_7, | 173 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_7, |
| 174 | ich_force_enable_hpet); | 174 | ich_force_enable_hpet); |
| 175 | 175 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x3a16, /* ICH10 */ | |
| 176 | ich_force_enable_hpet); | ||
| 176 | 177 | ||
| 177 | static struct pci_dev *cached_dev; | 178 | static struct pci_dev *cached_dev; |
| 178 | 179 | ||
diff --git a/arch/x86/mach-default/setup.c b/arch/x86/mach-default/setup.c index df167f265622..a265a7c63190 100644 --- a/arch/x86/mach-default/setup.c +++ b/arch/x86/mach-default/setup.c | |||
| @@ -38,6 +38,15 @@ void __init pre_intr_init_hook(void) | |||
| 38 | init_ISA_irqs(); | 38 | init_ISA_irqs(); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | /* | ||
| 42 | * IRQ2 is cascade interrupt to second interrupt controller | ||
| 43 | */ | ||
| 44 | static struct irqaction irq2 = { | ||
| 45 | .handler = no_action, | ||
| 46 | .mask = CPU_MASK_NONE, | ||
| 47 | .name = "cascade", | ||
| 48 | }; | ||
| 49 | |||
| 41 | /** | 50 | /** |
| 42 | * intr_init_hook - post gate setup interrupt initialisation | 51 | * intr_init_hook - post gate setup interrupt initialisation |
| 43 | * | 52 | * |
| @@ -53,6 +62,9 @@ void __init intr_init_hook(void) | |||
| 53 | if (x86_quirks->arch_intr_init()) | 62 | if (x86_quirks->arch_intr_init()) |
| 54 | return; | 63 | return; |
| 55 | } | 64 | } |
| 65 | if (!acpi_ioapic) | ||
| 66 | setup_irq(2, &irq2); | ||
| 67 | |||
| 56 | } | 68 | } |
| 57 | 69 | ||
| 58 | /** | 70 | /** |
diff --git a/arch/x86/mach-voyager/setup.c b/arch/x86/mach-voyager/setup.c index a580b9562e76..d914a7996a66 100644 --- a/arch/x86/mach-voyager/setup.c +++ b/arch/x86/mach-voyager/setup.c | |||
| @@ -33,13 +33,23 @@ void __init intr_init_hook(void) | |||
| 33 | setup_irq(2, &irq2); | 33 | setup_irq(2, &irq2); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | void __init pre_setup_arch_hook(void) | 36 | static void voyager_disable_tsc(void) |
| 37 | { | 37 | { |
| 38 | /* Voyagers run their CPUs from independent clocks, so disable | 38 | /* Voyagers run their CPUs from independent clocks, so disable |
| 39 | * the TSC code because we can't sync them */ | 39 | * the TSC code because we can't sync them */ |
| 40 | setup_clear_cpu_cap(X86_FEATURE_TSC); | 40 | setup_clear_cpu_cap(X86_FEATURE_TSC); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | void __init pre_setup_arch_hook(void) | ||
| 44 | { | ||
| 45 | voyager_disable_tsc(); | ||
| 46 | } | ||
| 47 | |||
| 48 | void __init pre_time_init_hook(void) | ||
| 49 | { | ||
| 50 | voyager_disable_tsc(); | ||
| 51 | } | ||
| 52 | |||
| 43 | void __init trap_init_hook(void) | 53 | void __init trap_init_hook(void) |
| 44 | { | 54 | { |
| 45 | } | 55 | } |
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c index 9840b7ec749a..7ffcdeec4631 100644 --- a/arch/x86/mach-voyager/voyager_smp.c +++ b/arch/x86/mach-voyager/voyager_smp.c | |||
| @@ -81,7 +81,7 @@ static void enable_local_vic_irq(unsigned int irq); | |||
| 81 | static void disable_local_vic_irq(unsigned int irq); | 81 | static void disable_local_vic_irq(unsigned int irq); |
| 82 | static void before_handle_vic_irq(unsigned int irq); | 82 | static void before_handle_vic_irq(unsigned int irq); |
| 83 | static void after_handle_vic_irq(unsigned int irq); | 83 | static void after_handle_vic_irq(unsigned int irq); |
| 84 | static void set_vic_irq_affinity(unsigned int irq, cpumask_t mask); | 84 | static void set_vic_irq_affinity(unsigned int irq, const struct cpumask *mask); |
| 85 | static void ack_vic_irq(unsigned int irq); | 85 | static void ack_vic_irq(unsigned int irq); |
| 86 | static void vic_enable_cpi(void); | 86 | static void vic_enable_cpi(void); |
| 87 | static void do_boot_cpu(__u8 cpuid); | 87 | static void do_boot_cpu(__u8 cpuid); |
| @@ -211,8 +211,6 @@ static __u32 cpu_booted_map; | |||
| 211 | static cpumask_t smp_commenced_mask = CPU_MASK_NONE; | 211 | static cpumask_t smp_commenced_mask = CPU_MASK_NONE; |
| 212 | 212 | ||
| 213 | /* This is for the new dynamic CPU boot code */ | 213 | /* This is for the new dynamic CPU boot code */ |
| 214 | cpumask_t cpu_callin_map = CPU_MASK_NONE; | ||
| 215 | cpumask_t cpu_callout_map = CPU_MASK_NONE; | ||
| 216 | 214 | ||
| 217 | /* The per processor IRQ masks (these are usually kept in sync) */ | 215 | /* The per processor IRQ masks (these are usually kept in sync) */ |
| 218 | static __u16 vic_irq_mask[NR_CPUS] __cacheline_aligned; | 216 | static __u16 vic_irq_mask[NR_CPUS] __cacheline_aligned; |
| @@ -378,7 +376,7 @@ void __init find_smp_config(void) | |||
| 378 | cpus_addr(phys_cpu_present_map)[0] |= | 376 | cpus_addr(phys_cpu_present_map)[0] |= |
| 379 | voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + | 377 | voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + |
| 380 | 3) << 24; | 378 | 3) << 24; |
| 381 | cpu_possible_map = phys_cpu_present_map; | 379 | init_cpu_possible(&phys_cpu_present_map); |
| 382 | printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n", | 380 | printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n", |
| 383 | cpus_addr(phys_cpu_present_map)[0]); | 381 | cpus_addr(phys_cpu_present_map)[0]); |
| 384 | /* Here we set up the VIC to enable SMP */ | 382 | /* Here we set up the VIC to enable SMP */ |
| @@ -1599,16 +1597,16 @@ static void after_handle_vic_irq(unsigned int irq) | |||
| 1599 | * change the mask and then do an interrupt enable CPI to re-enable on | 1597 | * change the mask and then do an interrupt enable CPI to re-enable on |
| 1600 | * the selected processors */ | 1598 | * the selected processors */ |
| 1601 | 1599 | ||
| 1602 | void set_vic_irq_affinity(unsigned int irq, cpumask_t mask) | 1600 | void set_vic_irq_affinity(unsigned int irq, const struct cpumask *mask) |
| 1603 | { | 1601 | { |
| 1604 | /* Only extended processors handle interrupts */ | 1602 | /* Only extended processors handle interrupts */ |
| 1605 | unsigned long real_mask; | 1603 | unsigned long real_mask; |
| 1606 | unsigned long irq_mask = 1 << irq; | 1604 | unsigned long irq_mask = 1 << irq; |
| 1607 | int cpu; | 1605 | int cpu; |
| 1608 | 1606 | ||
| 1609 | real_mask = cpus_addr(mask)[0] & voyager_extended_vic_processors; | 1607 | real_mask = cpus_addr(*mask)[0] & voyager_extended_vic_processors; |
| 1610 | 1608 | ||
| 1611 | if (cpus_addr(mask)[0] == 0) | 1609 | if (cpus_addr(*mask)[0] == 0) |
| 1612 | /* can't have no CPUs to accept the interrupt -- extremely | 1610 | /* can't have no CPUs to accept the interrupt -- extremely |
| 1613 | * bad things will happen */ | 1611 | * bad things will happen */ |
| 1614 | return; | 1612 | return; |
| @@ -1750,10 +1748,11 @@ static void __cpuinit voyager_smp_prepare_boot_cpu(void) | |||
| 1750 | init_gdt(smp_processor_id()); | 1748 | init_gdt(smp_processor_id()); |
| 1751 | switch_to_new_gdt(); | 1749 | switch_to_new_gdt(); |
| 1752 | 1750 | ||
| 1753 | cpu_set(smp_processor_id(), cpu_online_map); | 1751 | cpu_online_map = cpumask_of_cpu(smp_processor_id()); |
| 1754 | cpu_set(smp_processor_id(), cpu_callout_map); | 1752 | cpu_callout_map = cpumask_of_cpu(smp_processor_id()); |
| 1755 | cpu_set(smp_processor_id(), cpu_possible_map); | 1753 | cpu_callin_map = CPU_MASK_NONE; |
| 1756 | cpu_set(smp_processor_id(), cpu_present_map); | 1754 | cpu_present_map = cpumask_of_cpu(smp_processor_id()); |
| 1755 | |||
| 1757 | } | 1756 | } |
| 1758 | 1757 | ||
| 1759 | static int __cpuinit voyager_cpu_up(unsigned int cpu) | 1758 | static int __cpuinit voyager_cpu_up(unsigned int cpu) |
| @@ -1783,9 +1782,9 @@ void __init smp_setup_processor_id(void) | |||
| 1783 | x86_write_percpu(cpu_number, hard_smp_processor_id()); | 1782 | x86_write_percpu(cpu_number, hard_smp_processor_id()); |
| 1784 | } | 1783 | } |
| 1785 | 1784 | ||
| 1786 | static void voyager_send_call_func(cpumask_t callmask) | 1785 | static void voyager_send_call_func(const struct cpumask *callmask) |
| 1787 | { | 1786 | { |
| 1788 | __u32 mask = cpus_addr(callmask)[0] & ~(1 << smp_processor_id()); | 1787 | __u32 mask = cpus_addr(*callmask)[0] & ~(1 << smp_processor_id()); |
| 1789 | send_CPI(mask, VIC_CALL_FUNCTION_CPI); | 1788 | send_CPI(mask, VIC_CALL_FUNCTION_CPI); |
| 1790 | } | 1789 | } |
| 1791 | 1790 | ||
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 90dfae511a41..c76ef1d701c9 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
| @@ -603,8 +603,6 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
| 603 | 603 | ||
| 604 | si_code = SEGV_MAPERR; | 604 | si_code = SEGV_MAPERR; |
| 605 | 605 | ||
| 606 | if (notify_page_fault(regs)) | ||
| 607 | return; | ||
| 608 | if (unlikely(kmmio_fault(regs, address))) | 606 | if (unlikely(kmmio_fault(regs, address))) |
| 609 | return; | 607 | return; |
| 610 | 608 | ||
| @@ -634,6 +632,9 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
| 634 | if (spurious_fault(address, error_code)) | 632 | if (spurious_fault(address, error_code)) |
| 635 | return; | 633 | return; |
| 636 | 634 | ||
| 635 | /* kprobes don't want to hook the spurious faults. */ | ||
| 636 | if (notify_page_fault(regs)) | ||
| 637 | return; | ||
| 637 | /* | 638 | /* |
| 638 | * Don't take the mm semaphore here. If we fixup a prefetch | 639 | * Don't take the mm semaphore here. If we fixup a prefetch |
| 639 | * fault we could otherwise deadlock. | 640 | * fault we could otherwise deadlock. |
| @@ -641,6 +642,9 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
| 641 | goto bad_area_nosemaphore; | 642 | goto bad_area_nosemaphore; |
| 642 | } | 643 | } |
| 643 | 644 | ||
| 645 | /* kprobes don't want to hook the spurious faults. */ | ||
| 646 | if (notify_page_fault(regs)) | ||
| 647 | return; | ||
| 644 | 648 | ||
| 645 | /* | 649 | /* |
| 646 | * It's safe to allow irq's after cr2 has been saved and the | 650 | * It's safe to allow irq's after cr2 has been saved and the |
diff --git a/arch/x86/xen/multicalls.h b/arch/x86/xen/multicalls.h index 858938241616..fa3e10725d98 100644 --- a/arch/x86/xen/multicalls.h +++ b/arch/x86/xen/multicalls.h | |||
| @@ -19,8 +19,10 @@ DECLARE_PER_CPU(unsigned long, xen_mc_irq_flags); | |||
| 19 | paired with xen_mc_issue() */ | 19 | paired with xen_mc_issue() */ |
| 20 | static inline void xen_mc_batch(void) | 20 | static inline void xen_mc_batch(void) |
| 21 | { | 21 | { |
| 22 | unsigned long flags; | ||
| 22 | /* need to disable interrupts until this entry is complete */ | 23 | /* need to disable interrupts until this entry is complete */ |
| 23 | local_irq_save(__get_cpu_var(xen_mc_irq_flags)); | 24 | local_irq_save(flags); |
| 25 | __get_cpu_var(xen_mc_irq_flags) = flags; | ||
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | static inline struct multicall_space xen_mc_entry(size_t args) | 28 | static inline struct multicall_space xen_mc_entry(size_t args) |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 77bba4c083cb..a603bbf9b1b7 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
| @@ -61,9 +61,14 @@ | |||
| 61 | #define EM_MSG_LED_VALUE_ON 0x00010000 | 61 | #define EM_MSG_LED_VALUE_ON 0x00010000 |
| 62 | 62 | ||
| 63 | static int ahci_skip_host_reset; | 63 | static int ahci_skip_host_reset; |
| 64 | static int ahci_ignore_sss; | ||
| 65 | |||
| 64 | module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); | 66 | module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); |
| 65 | MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); | 67 | MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); |
| 66 | 68 | ||
| 69 | module_param_named(ignore_sss, ahci_ignore_sss, int, 0444); | ||
| 70 | MODULE_PARM_DESC(ignore_sss, "Ignore staggered spinup flag (0=don't ignore, 1=ignore)"); | ||
| 71 | |||
| 67 | static int ahci_enable_alpm(struct ata_port *ap, | 72 | static int ahci_enable_alpm(struct ata_port *ap, |
| 68 | enum link_pm policy); | 73 | enum link_pm policy); |
| 69 | static void ahci_disable_alpm(struct ata_port *ap); | 74 | static void ahci_disable_alpm(struct ata_port *ap); |
| @@ -2692,8 +2697,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2692 | host->iomap = pcim_iomap_table(pdev); | 2697 | host->iomap = pcim_iomap_table(pdev); |
| 2693 | host->private_data = hpriv; | 2698 | host->private_data = hpriv; |
| 2694 | 2699 | ||
| 2695 | if (!(hpriv->cap & HOST_CAP_SSS)) | 2700 | if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss) |
| 2696 | host->flags |= ATA_HOST_PARALLEL_SCAN; | 2701 | host->flags |= ATA_HOST_PARALLEL_SCAN; |
| 2702 | else | ||
| 2703 | printk(KERN_INFO "ahci: SSS flag set, parallel bus scan disabled\n"); | ||
| 2697 | 2704 | ||
| 2698 | if (pi.flags & ATA_FLAG_EM) | 2705 | if (pi.flags & ATA_FLAG_EM) |
| 2699 | ahci_reset_em(host); | 2706 | ahci_reset_em(host); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 88c242856dae..9fbf0595f3d4 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -164,6 +164,11 @@ MODULE_LICENSE("GPL"); | |||
| 164 | MODULE_VERSION(DRV_VERSION); | 164 | MODULE_VERSION(DRV_VERSION); |
| 165 | 165 | ||
| 166 | 166 | ||
| 167 | static bool ata_sstatus_online(u32 sstatus) | ||
| 168 | { | ||
| 169 | return (sstatus & 0xf) == 0x3; | ||
| 170 | } | ||
| 171 | |||
| 167 | /** | 172 | /** |
| 168 | * ata_link_next - link iteration helper | 173 | * ata_link_next - link iteration helper |
| 169 | * @link: the previous link, NULL to start | 174 | * @link: the previous link, NULL to start |
| @@ -1015,18 +1020,6 @@ static const char *sata_spd_string(unsigned int spd) | |||
| 1015 | return spd_str[spd - 1]; | 1020 | return spd_str[spd - 1]; |
| 1016 | } | 1021 | } |
| 1017 | 1022 | ||
| 1018 | void ata_dev_disable(struct ata_device *dev) | ||
| 1019 | { | ||
| 1020 | if (ata_dev_enabled(dev)) { | ||
| 1021 | if (ata_msg_drv(dev->link->ap)) | ||
| 1022 | ata_dev_printk(dev, KERN_WARNING, "disabled\n"); | ||
| 1023 | ata_acpi_on_disable(dev); | ||
| 1024 | ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | | ||
| 1025 | ATA_DNXFER_QUIET); | ||
| 1026 | dev->class++; | ||
| 1027 | } | ||
| 1028 | } | ||
| 1029 | |||
| 1030 | static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy) | 1023 | static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy) |
| 1031 | { | 1024 | { |
| 1032 | struct ata_link *link = dev->link; | 1025 | struct ata_link *link = dev->link; |
| @@ -2239,6 +2232,40 @@ retry: | |||
| 2239 | return rc; | 2232 | return rc; |
| 2240 | } | 2233 | } |
| 2241 | 2234 | ||
| 2235 | static int ata_do_link_spd_horkage(struct ata_device *dev) | ||
| 2236 | { | ||
| 2237 | struct ata_link *plink = ata_dev_phys_link(dev); | ||
| 2238 | u32 target, target_limit; | ||
| 2239 | |||
| 2240 | if (!sata_scr_valid(plink)) | ||
| 2241 | return 0; | ||
| 2242 | |||
| 2243 | if (dev->horkage & ATA_HORKAGE_1_5_GBPS) | ||
| 2244 | target = 1; | ||
| 2245 | else | ||
| 2246 | return 0; | ||
| 2247 | |||
| 2248 | target_limit = (1 << target) - 1; | ||
| 2249 | |||
| 2250 | /* if already on stricter limit, no need to push further */ | ||
| 2251 | if (plink->sata_spd_limit <= target_limit) | ||
| 2252 | return 0; | ||
| 2253 | |||
| 2254 | plink->sata_spd_limit = target_limit; | ||
| 2255 | |||
| 2256 | /* Request another EH round by returning -EAGAIN if link is | ||
| 2257 | * going faster than the target speed. Forward progress is | ||
| 2258 | * guaranteed by setting sata_spd_limit to target_limit above. | ||
| 2259 | */ | ||
| 2260 | if (plink->sata_spd > target) { | ||
| 2261 | ata_dev_printk(dev, KERN_INFO, | ||
| 2262 | "applying link speed limit horkage to %s\n", | ||
| 2263 | sata_spd_string(target)); | ||
| 2264 | return -EAGAIN; | ||
| 2265 | } | ||
| 2266 | return 0; | ||
| 2267 | } | ||
| 2268 | |||
| 2242 | static inline u8 ata_dev_knobble(struct ata_device *dev) | 2269 | static inline u8 ata_dev_knobble(struct ata_device *dev) |
| 2243 | { | 2270 | { |
| 2244 | struct ata_port *ap = dev->link->ap; | 2271 | struct ata_port *ap = dev->link->ap; |
| @@ -2329,6 +2356,10 @@ int ata_dev_configure(struct ata_device *dev) | |||
| 2329 | return 0; | 2356 | return 0; |
| 2330 | } | 2357 | } |
| 2331 | 2358 | ||
| 2359 | rc = ata_do_link_spd_horkage(dev); | ||
| 2360 | if (rc) | ||
| 2361 | return rc; | ||
| 2362 | |||
| 2332 | /* let ACPI work its magic */ | 2363 | /* let ACPI work its magic */ |
| 2333 | rc = ata_acpi_on_devcfg(dev); | 2364 | rc = ata_acpi_on_devcfg(dev); |
| 2334 | if (rc) | 2365 | if (rc) |
| @@ -2784,7 +2815,7 @@ int ata_bus_probe(struct ata_port *ap) | |||
| 2784 | /* This is the last chance, better to slow | 2815 | /* This is the last chance, better to slow |
| 2785 | * down than lose it. | 2816 | * down than lose it. |
| 2786 | */ | 2817 | */ |
| 2787 | sata_down_spd_limit(&ap->link); | 2818 | sata_down_spd_limit(&ap->link, 0); |
| 2788 | ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); | 2819 | ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); |
| 2789 | } | 2820 | } |
| 2790 | } | 2821 | } |
| @@ -2880,21 +2911,27 @@ void ata_port_disable(struct ata_port *ap) | |||
| 2880 | /** | 2911 | /** |
| 2881 | * sata_down_spd_limit - adjust SATA spd limit downward | 2912 | * sata_down_spd_limit - adjust SATA spd limit downward |
| 2882 | * @link: Link to adjust SATA spd limit for | 2913 | * @link: Link to adjust SATA spd limit for |
| 2914 | * @spd_limit: Additional limit | ||
| 2883 | * | 2915 | * |
| 2884 | * Adjust SATA spd limit of @link downward. Note that this | 2916 | * Adjust SATA spd limit of @link downward. Note that this |
| 2885 | * function only adjusts the limit. The change must be applied | 2917 | * function only adjusts the limit. The change must be applied |
| 2886 | * using sata_set_spd(). | 2918 | * using sata_set_spd(). |
| 2887 | * | 2919 | * |
| 2920 | * If @spd_limit is non-zero, the speed is limited to equal to or | ||
| 2921 | * lower than @spd_limit if such speed is supported. If | ||
| 2922 | * @spd_limit is slower than any supported speed, only the lowest | ||
| 2923 | * supported speed is allowed. | ||
| 2924 | * | ||
| 2888 | * LOCKING: | 2925 | * LOCKING: |
| 2889 | * Inherited from caller. | 2926 | * Inherited from caller. |
| 2890 | * | 2927 | * |
| 2891 | * RETURNS: | 2928 | * RETURNS: |
| 2892 | * 0 on success, negative errno on failure | 2929 | * 0 on success, negative errno on failure |
| 2893 | */ | 2930 | */ |
| 2894 | int sata_down_spd_limit(struct ata_link *link) | 2931 | int sata_down_spd_limit(struct ata_link *link, u32 spd_limit) |
| 2895 | { | 2932 | { |
| 2896 | u32 sstatus, spd, mask; | 2933 | u32 sstatus, spd, mask; |
| 2897 | int rc, highbit; | 2934 | int rc, bit; |
| 2898 | 2935 | ||
| 2899 | if (!sata_scr_valid(link)) | 2936 | if (!sata_scr_valid(link)) |
| 2900 | return -EOPNOTSUPP; | 2937 | return -EOPNOTSUPP; |
| @@ -2903,7 +2940,7 @@ int sata_down_spd_limit(struct ata_link *link) | |||
| 2903 | * If not, use cached value in link->sata_spd. | 2940 | * If not, use cached value in link->sata_spd. |
| 2904 | */ | 2941 | */ |
| 2905 | rc = sata_scr_read(link, SCR_STATUS, &sstatus); | 2942 | rc = sata_scr_read(link, SCR_STATUS, &sstatus); |
| 2906 | if (rc == 0) | 2943 | if (rc == 0 && ata_sstatus_online(sstatus)) |
| 2907 | spd = (sstatus >> 4) & 0xf; | 2944 | spd = (sstatus >> 4) & 0xf; |
| 2908 | else | 2945 | else |
| 2909 | spd = link->sata_spd; | 2946 | spd = link->sata_spd; |
| @@ -2913,8 +2950,8 @@ int sata_down_spd_limit(struct ata_link *link) | |||
| 2913 | return -EINVAL; | 2950 | return -EINVAL; |
| 2914 | 2951 | ||
| 2915 | /* unconditionally mask off the highest bit */ | 2952 | /* unconditionally mask off the highest bit */ |
| 2916 | highbit = fls(mask) - 1; | 2953 | bit = fls(mask) - 1; |
| 2917 | mask &= ~(1 << highbit); | 2954 | mask &= ~(1 << bit); |
| 2918 | 2955 | ||
| 2919 | /* Mask off all speeds higher than or equal to the current | 2956 | /* Mask off all speeds higher than or equal to the current |
| 2920 | * one. Force 1.5Gbps if current SPD is not available. | 2957 | * one. Force 1.5Gbps if current SPD is not available. |
| @@ -2928,6 +2965,15 @@ int sata_down_spd_limit(struct ata_link *link) | |||
| 2928 | if (!mask) | 2965 | if (!mask) |
| 2929 | return -EINVAL; | 2966 | return -EINVAL; |
| 2930 | 2967 | ||
| 2968 | if (spd_limit) { | ||
| 2969 | if (mask & ((1 << spd_limit) - 1)) | ||
| 2970 | mask &= (1 << spd_limit) - 1; | ||
| 2971 | else { | ||
| 2972 | bit = ffs(mask) - 1; | ||
| 2973 | mask = 1 << bit; | ||
| 2974 | } | ||
| 2975 | } | ||
| 2976 | |||
| 2931 | link->sata_spd_limit = mask; | 2977 | link->sata_spd_limit = mask; |
| 2932 | 2978 | ||
| 2933 | ata_link_printk(link, KERN_WARNING, "limiting SATA link speed to %s\n", | 2979 | ata_link_printk(link, KERN_WARNING, "limiting SATA link speed to %s\n", |
| @@ -4215,6 +4261,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
| 4215 | /* Devices that do not need bridging limits applied */ | 4261 | /* Devices that do not need bridging limits applied */ |
| 4216 | { "MTRON MSP-SATA*", NULL, ATA_HORKAGE_BRIDGE_OK, }, | 4262 | { "MTRON MSP-SATA*", NULL, ATA_HORKAGE_BRIDGE_OK, }, |
| 4217 | 4263 | ||
| 4264 | /* Devices which aren't very happy with higher link speeds */ | ||
| 4265 | { "WD My Book", NULL, ATA_HORKAGE_1_5_GBPS, }, | ||
| 4266 | |||
| 4218 | /* End Marker */ | 4267 | /* End Marker */ |
| 4219 | { } | 4268 | { } |
| 4220 | }; | 4269 | }; |
| @@ -4709,8 +4758,7 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
| 4709 | 4758 | ||
| 4710 | /** | 4759 | /** |
| 4711 | * ata_qc_new - Request an available ATA command, for queueing | 4760 | * ata_qc_new - Request an available ATA command, for queueing |
| 4712 | * @ap: Port associated with device @dev | 4761 | * @ap: target port |
| 4713 | * @dev: Device from whom we request an available command structure | ||
| 4714 | * | 4762 | * |
| 4715 | * LOCKING: | 4763 | * LOCKING: |
| 4716 | * None. | 4764 | * None. |
| @@ -5175,7 +5223,7 @@ bool ata_phys_link_online(struct ata_link *link) | |||
| 5175 | u32 sstatus; | 5223 | u32 sstatus; |
| 5176 | 5224 | ||
| 5177 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && | 5225 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && |
| 5178 | (sstatus & 0xf) == 0x3) | 5226 | ata_sstatus_online(sstatus)) |
| 5179 | return true; | 5227 | return true; |
| 5180 | return false; | 5228 | return false; |
| 5181 | } | 5229 | } |
| @@ -5199,7 +5247,7 @@ bool ata_phys_link_offline(struct ata_link *link) | |||
| 5199 | u32 sstatus; | 5247 | u32 sstatus; |
| 5200 | 5248 | ||
| 5201 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && | 5249 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && |
| 5202 | (sstatus & 0xf) != 0x3) | 5250 | !ata_sstatus_online(sstatus)) |
| 5203 | return true; | 5251 | return true; |
| 5204 | return false; | 5252 | return false; |
| 5205 | } | 5253 | } |
| @@ -5412,8 +5460,8 @@ void ata_dev_init(struct ata_device *dev) | |||
| 5412 | dev->horkage = 0; | 5460 | dev->horkage = 0; |
| 5413 | spin_unlock_irqrestore(ap->lock, flags); | 5461 | spin_unlock_irqrestore(ap->lock, flags); |
| 5414 | 5462 | ||
| 5415 | memset((void *)dev + ATA_DEVICE_CLEAR_OFFSET, 0, | 5463 | memset((void *)dev + ATA_DEVICE_CLEAR_BEGIN, 0, |
| 5416 | sizeof(*dev) - ATA_DEVICE_CLEAR_OFFSET); | 5464 | ATA_DEVICE_CLEAR_END - ATA_DEVICE_CLEAR_BEGIN); |
| 5417 | dev->pio_mask = UINT_MAX; | 5465 | dev->pio_mask = UINT_MAX; |
| 5418 | dev->mwdma_mask = UINT_MAX; | 5466 | dev->mwdma_mask = UINT_MAX; |
| 5419 | dev->udma_mask = UINT_MAX; | 5467 | dev->udma_mask = UINT_MAX; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 8147a8386370..ce2ef0475339 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
| @@ -82,6 +82,10 @@ enum { | |||
| 82 | ATA_EH_FASTDRAIN_INTERVAL = 3000, | 82 | ATA_EH_FASTDRAIN_INTERVAL = 3000, |
| 83 | 83 | ||
| 84 | ATA_EH_UA_TRIES = 5, | 84 | ATA_EH_UA_TRIES = 5, |
| 85 | |||
| 86 | /* probe speed down parameters, see ata_eh_schedule_probe() */ | ||
| 87 | ATA_EH_PROBE_TRIAL_INTERVAL = 60000, /* 1 min */ | ||
| 88 | ATA_EH_PROBE_TRIALS = 2, | ||
| 85 | }; | 89 | }; |
| 86 | 90 | ||
| 87 | /* The following table determines how we sequence resets. Each entry | 91 | /* The following table determines how we sequence resets. Each entry |
| @@ -1176,6 +1180,32 @@ void ata_eh_qc_retry(struct ata_queued_cmd *qc) | |||
| 1176 | } | 1180 | } |
| 1177 | 1181 | ||
| 1178 | /** | 1182 | /** |
| 1183 | * ata_dev_disable - disable ATA device | ||
| 1184 | * @dev: ATA device to disable | ||
| 1185 | * | ||
| 1186 | * Disable @dev. | ||
| 1187 | * | ||
| 1188 | * Locking: | ||
| 1189 | * EH context. | ||
| 1190 | */ | ||
| 1191 | void ata_dev_disable(struct ata_device *dev) | ||
| 1192 | { | ||
| 1193 | if (!ata_dev_enabled(dev)) | ||
| 1194 | return; | ||
| 1195 | |||
| 1196 | if (ata_msg_drv(dev->link->ap)) | ||
| 1197 | ata_dev_printk(dev, KERN_WARNING, "disabled\n"); | ||
| 1198 | ata_acpi_on_disable(dev); | ||
| 1199 | ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | ATA_DNXFER_QUIET); | ||
| 1200 | dev->class++; | ||
| 1201 | |||
| 1202 | /* From now till the next successful probe, ering is used to | ||
| 1203 | * track probe failures. Clear accumulated device error info. | ||
| 1204 | */ | ||
| 1205 | ata_ering_clear(&dev->ering); | ||
| 1206 | } | ||
| 1207 | |||
| 1208 | /** | ||
| 1179 | * ata_eh_detach_dev - detach ATA device | 1209 | * ata_eh_detach_dev - detach ATA device |
| 1180 | * @dev: ATA device to detach | 1210 | * @dev: ATA device to detach |
| 1181 | * | 1211 | * |
| @@ -1849,7 +1879,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, | |||
| 1849 | /* speed down? */ | 1879 | /* speed down? */ |
| 1850 | if (verdict & ATA_EH_SPDN_SPEED_DOWN) { | 1880 | if (verdict & ATA_EH_SPDN_SPEED_DOWN) { |
| 1851 | /* speed down SATA link speed if possible */ | 1881 | /* speed down SATA link speed if possible */ |
| 1852 | if (sata_down_spd_limit(link) == 0) { | 1882 | if (sata_down_spd_limit(link, 0) == 0) { |
| 1853 | action |= ATA_EH_RESET; | 1883 | action |= ATA_EH_RESET; |
| 1854 | goto done; | 1884 | goto done; |
| 1855 | } | 1885 | } |
| @@ -2601,11 +2631,11 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
| 2601 | } | 2631 | } |
| 2602 | 2632 | ||
| 2603 | if (try == max_tries - 1) { | 2633 | if (try == max_tries - 1) { |
| 2604 | sata_down_spd_limit(link); | 2634 | sata_down_spd_limit(link, 0); |
| 2605 | if (slave) | 2635 | if (slave) |
| 2606 | sata_down_spd_limit(slave); | 2636 | sata_down_spd_limit(slave, 0); |
| 2607 | } else if (rc == -EPIPE) | 2637 | } else if (rc == -EPIPE) |
| 2608 | sata_down_spd_limit(failed_link); | 2638 | sata_down_spd_limit(failed_link, 0); |
| 2609 | 2639 | ||
| 2610 | if (hardreset) | 2640 | if (hardreset) |
| 2611 | reset = hardreset; | 2641 | reset = hardreset; |
| @@ -2744,6 +2774,8 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, | |||
| 2744 | readid_flags, dev->id); | 2774 | readid_flags, dev->id); |
| 2745 | switch (rc) { | 2775 | switch (rc) { |
| 2746 | case 0: | 2776 | case 0: |
| 2777 | /* clear error info accumulated during probe */ | ||
| 2778 | ata_ering_clear(&dev->ering); | ||
| 2747 | new_mask |= 1 << dev->devno; | 2779 | new_mask |= 1 << dev->devno; |
| 2748 | break; | 2780 | break; |
| 2749 | case -ENOENT: | 2781 | case -ENOENT: |
| @@ -2947,9 +2979,24 @@ static int ata_eh_skip_recovery(struct ata_link *link) | |||
| 2947 | return 1; | 2979 | return 1; |
| 2948 | } | 2980 | } |
| 2949 | 2981 | ||
| 2982 | static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg) | ||
| 2983 | { | ||
| 2984 | u64 interval = msecs_to_jiffies(ATA_EH_PROBE_TRIAL_INTERVAL); | ||
| 2985 | u64 now = get_jiffies_64(); | ||
| 2986 | int *trials = void_arg; | ||
| 2987 | |||
| 2988 | if (ent->timestamp < now - min(now, interval)) | ||
| 2989 | return -1; | ||
| 2990 | |||
| 2991 | (*trials)++; | ||
| 2992 | return 0; | ||
| 2993 | } | ||
| 2994 | |||
| 2950 | static int ata_eh_schedule_probe(struct ata_device *dev) | 2995 | static int ata_eh_schedule_probe(struct ata_device *dev) |
| 2951 | { | 2996 | { |
| 2952 | struct ata_eh_context *ehc = &dev->link->eh_context; | 2997 | struct ata_eh_context *ehc = &dev->link->eh_context; |
| 2998 | struct ata_link *link = ata_dev_phys_link(dev); | ||
| 2999 | int trials = 0; | ||
| 2953 | 3000 | ||
| 2954 | if (!(ehc->i.probe_mask & (1 << dev->devno)) || | 3001 | if (!(ehc->i.probe_mask & (1 << dev->devno)) || |
| 2955 | (ehc->did_probe_mask & (1 << dev->devno))) | 3002 | (ehc->did_probe_mask & (1 << dev->devno))) |
| @@ -2962,6 +3009,25 @@ static int ata_eh_schedule_probe(struct ata_device *dev) | |||
| 2962 | ehc->saved_xfer_mode[dev->devno] = 0; | 3009 | ehc->saved_xfer_mode[dev->devno] = 0; |
| 2963 | ehc->saved_ncq_enabled &= ~(1 << dev->devno); | 3010 | ehc->saved_ncq_enabled &= ~(1 << dev->devno); |
| 2964 | 3011 | ||
| 3012 | /* Record and count probe trials on the ering. The specific | ||
| 3013 | * error mask used is irrelevant. Because a successful device | ||
| 3014 | * detection clears the ering, this count accumulates only if | ||
| 3015 | * there are consecutive failed probes. | ||
| 3016 | * | ||
| 3017 | * If the count is equal to or higher than ATA_EH_PROBE_TRIALS | ||
| 3018 | * in the last ATA_EH_PROBE_TRIAL_INTERVAL, link speed is | ||
| 3019 | * forced to 1.5Gbps. | ||
| 3020 | * | ||
| 3021 | * This is to work around cases where failed link speed | ||
| 3022 | * negotiation results in device misdetection leading to | ||
| 3023 | * infinite DEVXCHG or PHRDY CHG events. | ||
| 3024 | */ | ||
| 3025 | ata_ering_record(&dev->ering, 0, AC_ERR_OTHER); | ||
| 3026 | ata_ering_map(&dev->ering, ata_count_probe_trials_cb, &trials); | ||
| 3027 | |||
| 3028 | if (trials > ATA_EH_PROBE_TRIALS) | ||
| 3029 | sata_down_spd_limit(link, 1); | ||
| 3030 | |||
| 2965 | return 1; | 3031 | return 1; |
| 2966 | } | 3032 | } |
| 2967 | 3033 | ||
| @@ -2969,7 +3035,11 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) | |||
| 2969 | { | 3035 | { |
| 2970 | struct ata_eh_context *ehc = &dev->link->eh_context; | 3036 | struct ata_eh_context *ehc = &dev->link->eh_context; |
| 2971 | 3037 | ||
| 2972 | ehc->tries[dev->devno]--; | 3038 | /* -EAGAIN from EH routine indicates retry without prejudice. |
| 3039 | * The requester is responsible for ensuring forward progress. | ||
| 3040 | */ | ||
| 3041 | if (err != -EAGAIN) | ||
| 3042 | ehc->tries[dev->devno]--; | ||
| 2973 | 3043 | ||
| 2974 | switch (err) { | 3044 | switch (err) { |
| 2975 | case -ENODEV: | 3045 | case -ENODEV: |
| @@ -2979,12 +3049,13 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) | |||
| 2979 | /* give it just one more chance */ | 3049 | /* give it just one more chance */ |
| 2980 | ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); | 3050 | ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); |
| 2981 | case -EIO: | 3051 | case -EIO: |
| 2982 | if (ehc->tries[dev->devno] == 1 && dev->pio_mode > XFER_PIO_0) { | 3052 | if (ehc->tries[dev->devno] == 1) { |
| 2983 | /* This is the last chance, better to slow | 3053 | /* This is the last chance, better to slow |
| 2984 | * down than lose it. | 3054 | * down than lose it. |
| 2985 | */ | 3055 | */ |
| 2986 | sata_down_spd_limit(ata_dev_phys_link(dev)); | 3056 | sata_down_spd_limit(ata_dev_phys_link(dev), 0); |
| 2987 | ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); | 3057 | if (dev->pio_mode > XFER_PIO_0) |
| 3058 | ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); | ||
| 2988 | } | 3059 | } |
| 2989 | } | 3060 | } |
| 2990 | 3061 | ||
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c index 98ca07a2db87..619f2c33950e 100644 --- a/drivers/ata/libata-pmp.c +++ b/drivers/ata/libata-pmp.c | |||
| @@ -729,7 +729,7 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap, | |||
| 729 | if (tries) { | 729 | if (tries) { |
| 730 | /* consecutive revalidation failures? speed down */ | 730 | /* consecutive revalidation failures? speed down */ |
| 731 | if (reval_failed) | 731 | if (reval_failed) |
| 732 | sata_down_spd_limit(link); | 732 | sata_down_spd_limit(link, 0); |
| 733 | else | 733 | else |
| 734 | reval_failed = 1; | 734 | reval_failed = 1; |
| 735 | 735 | ||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 3c4c5ae277ba..b9747fa59e54 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
| @@ -415,6 +415,7 @@ int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev, | |||
| 415 | 415 | ||
| 416 | /** | 416 | /** |
| 417 | * ata_get_identity - Handler for HDIO_GET_IDENTITY ioctl | 417 | * ata_get_identity - Handler for HDIO_GET_IDENTITY ioctl |
| 418 | * @ap: target port | ||
| 418 | * @sdev: SCSI device to get identify data for | 419 | * @sdev: SCSI device to get identify data for |
| 419 | * @arg: User buffer area for identify data | 420 | * @arg: User buffer area for identify data |
| 420 | * | 421 | * |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index fe2839e58774..cea8014cd87e 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
| @@ -79,7 +79,6 @@ extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, | |||
| 79 | u64 block, u32 n_block, unsigned int tf_flags, | 79 | u64 block, u32 n_block, unsigned int tf_flags, |
| 80 | unsigned int tag); | 80 | unsigned int tag); |
| 81 | extern u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev); | 81 | extern u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev); |
| 82 | extern void ata_dev_disable(struct ata_device *dev); | ||
| 83 | extern void ata_pio_queue_task(struct ata_port *ap, void *data, | 82 | extern void ata_pio_queue_task(struct ata_port *ap, void *data, |
| 84 | unsigned long delay); | 83 | unsigned long delay); |
| 85 | extern void ata_port_flush_task(struct ata_port *ap); | 84 | extern void ata_port_flush_task(struct ata_port *ap); |
| @@ -100,7 +99,7 @@ extern int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags); | |||
| 100 | extern int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class, | 99 | extern int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class, |
| 101 | unsigned int readid_flags); | 100 | unsigned int readid_flags); |
| 102 | extern int ata_dev_configure(struct ata_device *dev); | 101 | extern int ata_dev_configure(struct ata_device *dev); |
| 103 | extern int sata_down_spd_limit(struct ata_link *link); | 102 | extern int sata_down_spd_limit(struct ata_link *link, u32 spd_limit); |
| 104 | extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); | 103 | extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); |
| 105 | extern void ata_sg_clean(struct ata_queued_cmd *qc); | 104 | extern void ata_sg_clean(struct ata_queued_cmd *qc); |
| 106 | extern void ata_qc_free(struct ata_queued_cmd *qc); | 105 | extern void ata_qc_free(struct ata_queued_cmd *qc); |
| @@ -160,6 +159,7 @@ extern void ata_scsi_error(struct Scsi_Host *host); | |||
| 160 | extern void ata_port_wait_eh(struct ata_port *ap); | 159 | extern void ata_port_wait_eh(struct ata_port *ap); |
| 161 | extern void ata_eh_fastdrain_timerfn(unsigned long arg); | 160 | extern void ata_eh_fastdrain_timerfn(unsigned long arg); |
| 162 | extern void ata_qc_schedule_eh(struct ata_queued_cmd *qc); | 161 | extern void ata_qc_schedule_eh(struct ata_queued_cmd *qc); |
| 162 | extern void ata_dev_disable(struct ata_device *dev); | ||
| 163 | extern void ata_eh_detach_dev(struct ata_device *dev); | 163 | extern void ata_eh_detach_dev(struct ata_device *dev); |
| 164 | extern void ata_eh_about_to_do(struct ata_link *link, struct ata_device *dev, | 164 | extern void ata_eh_about_to_do(struct ata_link *link, struct ata_device *dev, |
| 165 | unsigned int action); | 165 | unsigned int action); |
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c index 3080f371222c..f1b26f7c8e4d 100644 --- a/drivers/ata/pata_qdi.c +++ b/drivers/ata/pata_qdi.c | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | * | 12 | * |
| 13 | * Probe code based on drivers/ide/legacy/qd65xx.c | 13 | * Probe code based on drivers/ide/legacy/qd65xx.c |
| 14 | * Rewritten from the work of Colten Edwards <pje120@cs.usask.ca> by | 14 | * Rewritten from the work of Colten Edwards <pje120@cs.usask.ca> by |
| 15 | * Samuel Thibault <samuel.thibault@fnac.net> | 15 | * Samuel Thibault <samuel.thibault@ens-lyon.org> |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index f2d8a020ea53..4ae1a4138b47 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
| @@ -663,8 +663,8 @@ static const struct pci_device_id mv_pci_tbl[] = { | |||
| 663 | { PCI_VDEVICE(MARVELL, 0x5081), chip_508x }, | 663 | { PCI_VDEVICE(MARVELL, 0x5081), chip_508x }, |
| 664 | /* RocketRAID 1720/174x have different identifiers */ | 664 | /* RocketRAID 1720/174x have different identifiers */ |
| 665 | { PCI_VDEVICE(TTI, 0x1720), chip_6042 }, | 665 | { PCI_VDEVICE(TTI, 0x1720), chip_6042 }, |
| 666 | { PCI_VDEVICE(TTI, 0x1740), chip_508x }, | 666 | { PCI_VDEVICE(TTI, 0x1740), chip_6042 }, |
| 667 | { PCI_VDEVICE(TTI, 0x1742), chip_508x }, | 667 | { PCI_VDEVICE(TTI, 0x1742), chip_6042 }, |
| 668 | 668 | ||
| 669 | { PCI_VDEVICE(MARVELL, 0x6040), chip_604x }, | 669 | { PCI_VDEVICE(MARVELL, 0x6040), chip_604x }, |
| 670 | { PCI_VDEVICE(MARVELL, 0x6041), chip_604x }, | 670 | { PCI_VDEVICE(MARVELL, 0x6041), chip_604x }, |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index c49ad0e61b6f..444af0415ca1 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
| @@ -436,11 +436,16 @@ static struct ata_port_operations nv_nf2_ops = { | |||
| 436 | .hardreset = nv_noclassify_hardreset, | 436 | .hardreset = nv_noclassify_hardreset, |
| 437 | }; | 437 | }; |
| 438 | 438 | ||
| 439 | /* CK804 finally gets hardreset right */ | 439 | /* For initial probing after boot and hot plugging, hardreset mostly |
| 440 | * works fine on CK804 but curiously, reprobing on the initial port by | ||
| 441 | * rescanning or rmmod/insmod fails to acquire the initial D2H Reg FIS | ||
| 442 | * in somewhat undeterministic way. Use noclassify hardreset. | ||
| 443 | */ | ||
| 440 | static struct ata_port_operations nv_ck804_ops = { | 444 | static struct ata_port_operations nv_ck804_ops = { |
| 441 | .inherits = &nv_common_ops, | 445 | .inherits = &nv_common_ops, |
| 442 | .freeze = nv_ck804_freeze, | 446 | .freeze = nv_ck804_freeze, |
| 443 | .thaw = nv_ck804_thaw, | 447 | .thaw = nv_ck804_thaw, |
| 448 | .hardreset = nv_noclassify_hardreset, | ||
| 444 | .host_stop = nv_ck804_host_stop, | 449 | .host_stop = nv_ck804_host_stop, |
| 445 | }; | 450 | }; |
| 446 | 451 | ||
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index 9f029595f454..d0091609e210 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
| @@ -324,7 +324,7 @@ static void sil_fill_sg(struct ata_queued_cmd *qc) | |||
| 324 | 324 | ||
| 325 | prd->addr = cpu_to_le32(addr); | 325 | prd->addr = cpu_to_le32(addr); |
| 326 | prd->flags_len = cpu_to_le32(sg_len); | 326 | prd->flags_len = cpu_to_le32(sg_len); |
| 327 | VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, sg_len); | 327 | VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", si, addr, sg_len); |
| 328 | 328 | ||
| 329 | last_prd = prd; | 329 | last_prd = prd; |
| 330 | prd++; | 330 | prd++; |
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index f5be8081cd81..735bbe2be51a 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
| @@ -761,7 +761,7 @@ source "drivers/char/hw_random/Kconfig" | |||
| 761 | 761 | ||
| 762 | config NVRAM | 762 | config NVRAM |
| 763 | tristate "/dev/nvram support" | 763 | tristate "/dev/nvram support" |
| 764 | depends on ATARI || X86 || ARM || GENERIC_NVRAM | 764 | depends on ATARI || X86 || (ARM && RTC_DRV_CMOS) || GENERIC_NVRAM |
| 765 | ---help--- | 765 | ---help--- |
| 766 | If you say Y here and create a character special file /dev/nvram | 766 | If you say Y here and create a character special file /dev/nvram |
| 767 | with major number 10 and minor number 144 using mknod ("man mknod"), | 767 | with major number 10 and minor number 144 using mknod ("man mknod"), |
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index b60be7b0decf..f146e90404fa 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
| @@ -1713,8 +1713,8 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd, | |||
| 1713 | for (i = 0; i < SX_NBOARDS; i++) | 1713 | for (i = 0; i < SX_NBOARDS; i++) |
| 1714 | sx_dprintk(SX_DEBUG_FIRMWARE, "<%x> ", boards[i].flags); | 1714 | sx_dprintk(SX_DEBUG_FIRMWARE, "<%x> ", boards[i].flags); |
| 1715 | sx_dprintk(SX_DEBUG_FIRMWARE, "\n"); | 1715 | sx_dprintk(SX_DEBUG_FIRMWARE, "\n"); |
| 1716 | unlock_kernel(); | 1716 | rc = -EIO; |
| 1717 | return -EIO; | 1717 | goto out; |
| 1718 | } | 1718 | } |
| 1719 | 1719 | ||
| 1720 | switch (cmd) { | 1720 | switch (cmd) { |
| @@ -1747,7 +1747,8 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd, | |||
| 1747 | break; | 1747 | break; |
| 1748 | case SXIO_DO_RAMTEST: | 1748 | case SXIO_DO_RAMTEST: |
| 1749 | if (sx_initialized) /* Already initialized: better not ramtest the board. */ | 1749 | if (sx_initialized) /* Already initialized: better not ramtest the board. */ |
| 1750 | return -EPERM; | 1750 | rc = -EPERM; |
| 1751 | break; | ||
| 1751 | if (IS_SX_BOARD(board)) { | 1752 | if (IS_SX_BOARD(board)) { |
| 1752 | rc = do_memtest(board, 0, 0x7000); | 1753 | rc = do_memtest(board, 0, 0x7000); |
| 1753 | if (!rc) | 1754 | if (!rc) |
| @@ -1844,6 +1845,7 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd, | |||
| 1844 | rc = -ENOTTY; | 1845 | rc = -ENOTTY; |
| 1845 | break; | 1846 | break; |
| 1846 | } | 1847 | } |
| 1848 | out: | ||
| 1847 | unlock_kernel(); | 1849 | unlock_kernel(); |
| 1848 | func_exit(); | 1850 | func_exit(); |
| 1849 | return rc; | 1851 | return rc; |
diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c index 55433849bfa6..33bd75347518 100644 --- a/drivers/dca/dca-core.c +++ b/drivers/dca/dca-core.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | #include <linux/device.h> | 28 | #include <linux/device.h> |
| 29 | #include <linux/dca.h> | 29 | #include <linux/dca.h> |
| 30 | 30 | ||
| 31 | #define DCA_VERSION "1.4" | 31 | #define DCA_VERSION "1.8" |
| 32 | 32 | ||
| 33 | MODULE_VERSION(DCA_VERSION); | 33 | MODULE_VERSION(DCA_VERSION); |
| 34 | MODULE_LICENSE("GPL"); | 34 | MODULE_LICENSE("GPL"); |
| @@ -60,16 +60,17 @@ int dca_add_requester(struct device *dev) | |||
| 60 | { | 60 | { |
| 61 | struct dca_provider *dca; | 61 | struct dca_provider *dca; |
| 62 | int err, slot = -ENODEV; | 62 | int err, slot = -ENODEV; |
| 63 | unsigned long flags; | ||
| 63 | 64 | ||
| 64 | if (!dev) | 65 | if (!dev) |
| 65 | return -EFAULT; | 66 | return -EFAULT; |
| 66 | 67 | ||
| 67 | spin_lock(&dca_lock); | 68 | spin_lock_irqsave(&dca_lock, flags); |
| 68 | 69 | ||
| 69 | /* check if the requester has not been added already */ | 70 | /* check if the requester has not been added already */ |
| 70 | dca = dca_find_provider_by_dev(dev); | 71 | dca = dca_find_provider_by_dev(dev); |
| 71 | if (dca) { | 72 | if (dca) { |
| 72 | spin_unlock(&dca_lock); | 73 | spin_unlock_irqrestore(&dca_lock, flags); |
| 73 | return -EEXIST; | 74 | return -EEXIST; |
| 74 | } | 75 | } |
| 75 | 76 | ||
| @@ -78,19 +79,21 @@ int dca_add_requester(struct device *dev) | |||
| 78 | if (slot >= 0) | 79 | if (slot >= 0) |
| 79 | break; | 80 | break; |
| 80 | } | 81 | } |
| 81 | if (slot < 0) { | 82 | |
| 82 | spin_unlock(&dca_lock); | 83 | spin_unlock_irqrestore(&dca_lock, flags); |
| 84 | |||
| 85 | if (slot < 0) | ||
| 83 | return slot; | 86 | return slot; |
| 84 | } | ||
| 85 | 87 | ||
| 86 | err = dca_sysfs_add_req(dca, dev, slot); | 88 | err = dca_sysfs_add_req(dca, dev, slot); |
| 87 | if (err) { | 89 | if (err) { |
| 88 | dca->ops->remove_requester(dca, dev); | 90 | spin_lock_irqsave(&dca_lock, flags); |
| 89 | spin_unlock(&dca_lock); | 91 | if (dca == dca_find_provider_by_dev(dev)) |
| 92 | dca->ops->remove_requester(dca, dev); | ||
| 93 | spin_unlock_irqrestore(&dca_lock, flags); | ||
| 90 | return err; | 94 | return err; |
| 91 | } | 95 | } |
| 92 | 96 | ||
| 93 | spin_unlock(&dca_lock); | ||
| 94 | return 0; | 97 | return 0; |
| 95 | } | 98 | } |
| 96 | EXPORT_SYMBOL_GPL(dca_add_requester); | 99 | EXPORT_SYMBOL_GPL(dca_add_requester); |
| @@ -103,25 +106,25 @@ int dca_remove_requester(struct device *dev) | |||
| 103 | { | 106 | { |
| 104 | struct dca_provider *dca; | 107 | struct dca_provider *dca; |
| 105 | int slot; | 108 | int slot; |
| 109 | unsigned long flags; | ||
| 106 | 110 | ||
| 107 | if (!dev) | 111 | if (!dev) |
| 108 | return -EFAULT; | 112 | return -EFAULT; |
| 109 | 113 | ||
| 110 | spin_lock(&dca_lock); | 114 | spin_lock_irqsave(&dca_lock, flags); |
| 111 | dca = dca_find_provider_by_dev(dev); | 115 | dca = dca_find_provider_by_dev(dev); |
| 112 | if (!dca) { | 116 | if (!dca) { |
| 113 | spin_unlock(&dca_lock); | 117 | spin_unlock_irqrestore(&dca_lock, flags); |
| 114 | return -ENODEV; | 118 | return -ENODEV; |
| 115 | } | 119 | } |
| 116 | slot = dca->ops->remove_requester(dca, dev); | 120 | slot = dca->ops->remove_requester(dca, dev); |
| 117 | if (slot < 0) { | 121 | spin_unlock_irqrestore(&dca_lock, flags); |
| 118 | spin_unlock(&dca_lock); | 122 | |
| 123 | if (slot < 0) | ||
| 119 | return slot; | 124 | return slot; |
| 120 | } | ||
| 121 | 125 | ||
| 122 | dca_sysfs_remove_req(dca, slot); | 126 | dca_sysfs_remove_req(dca, slot); |
| 123 | 127 | ||
| 124 | spin_unlock(&dca_lock); | ||
| 125 | return 0; | 128 | return 0; |
| 126 | } | 129 | } |
| 127 | EXPORT_SYMBOL_GPL(dca_remove_requester); | 130 | EXPORT_SYMBOL_GPL(dca_remove_requester); |
| @@ -135,17 +138,18 @@ u8 dca_common_get_tag(struct device *dev, int cpu) | |||
| 135 | { | 138 | { |
| 136 | struct dca_provider *dca; | 139 | struct dca_provider *dca; |
| 137 | u8 tag; | 140 | u8 tag; |
| 141 | unsigned long flags; | ||
| 138 | 142 | ||
| 139 | spin_lock(&dca_lock); | 143 | spin_lock_irqsave(&dca_lock, flags); |
| 140 | 144 | ||
| 141 | dca = dca_find_provider_by_dev(dev); | 145 | dca = dca_find_provider_by_dev(dev); |
| 142 | if (!dca) { | 146 | if (!dca) { |
| 143 | spin_unlock(&dca_lock); | 147 | spin_unlock_irqrestore(&dca_lock, flags); |
| 144 | return -ENODEV; | 148 | return -ENODEV; |
| 145 | } | 149 | } |
| 146 | tag = dca->ops->get_tag(dca, dev, cpu); | 150 | tag = dca->ops->get_tag(dca, dev, cpu); |
| 147 | 151 | ||
| 148 | spin_unlock(&dca_lock); | 152 | spin_unlock_irqrestore(&dca_lock, flags); |
| 149 | return tag; | 153 | return tag; |
| 150 | } | 154 | } |
| 151 | 155 | ||
| @@ -217,11 +221,16 @@ static BLOCKING_NOTIFIER_HEAD(dca_provider_chain); | |||
| 217 | int register_dca_provider(struct dca_provider *dca, struct device *dev) | 221 | int register_dca_provider(struct dca_provider *dca, struct device *dev) |
| 218 | { | 222 | { |
| 219 | int err; | 223 | int err; |
| 224 | unsigned long flags; | ||
| 220 | 225 | ||
| 221 | err = dca_sysfs_add_provider(dca, dev); | 226 | err = dca_sysfs_add_provider(dca, dev); |
| 222 | if (err) | 227 | if (err) |
| 223 | return err; | 228 | return err; |
| 229 | |||
| 230 | spin_lock_irqsave(&dca_lock, flags); | ||
| 224 | list_add(&dca->node, &dca_providers); | 231 | list_add(&dca->node, &dca_providers); |
| 232 | spin_unlock_irqrestore(&dca_lock, flags); | ||
| 233 | |||
| 225 | blocking_notifier_call_chain(&dca_provider_chain, | 234 | blocking_notifier_call_chain(&dca_provider_chain, |
| 226 | DCA_PROVIDER_ADD, NULL); | 235 | DCA_PROVIDER_ADD, NULL); |
| 227 | return 0; | 236 | return 0; |
| @@ -234,9 +243,15 @@ EXPORT_SYMBOL_GPL(register_dca_provider); | |||
| 234 | */ | 243 | */ |
| 235 | void unregister_dca_provider(struct dca_provider *dca) | 244 | void unregister_dca_provider(struct dca_provider *dca) |
| 236 | { | 245 | { |
| 246 | unsigned long flags; | ||
| 247 | |||
| 237 | blocking_notifier_call_chain(&dca_provider_chain, | 248 | blocking_notifier_call_chain(&dca_provider_chain, |
| 238 | DCA_PROVIDER_REMOVE, NULL); | 249 | DCA_PROVIDER_REMOVE, NULL); |
| 250 | |||
| 251 | spin_lock_irqsave(&dca_lock, flags); | ||
| 239 | list_del(&dca->node); | 252 | list_del(&dca->node); |
| 253 | spin_unlock_irqrestore(&dca_lock, flags); | ||
| 254 | |||
| 240 | dca_sysfs_remove_provider(dca); | 255 | dca_sysfs_remove_provider(dca); |
| 241 | } | 256 | } |
| 242 | EXPORT_SYMBOL_GPL(unregister_dca_provider); | 257 | EXPORT_SYMBOL_GPL(unregister_dca_provider); |
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c index 7be2cf3514e7..a5dd7a665aa8 100644 --- a/drivers/firewire/fw-card.c +++ b/drivers/firewire/fw-card.c | |||
| @@ -412,6 +412,7 @@ fw_card_add(struct fw_card *card, | |||
| 412 | { | 412 | { |
| 413 | u32 *config_rom; | 413 | u32 *config_rom; |
| 414 | size_t length; | 414 | size_t length; |
| 415 | int err; | ||
| 415 | 416 | ||
| 416 | card->max_receive = max_receive; | 417 | card->max_receive = max_receive; |
| 417 | card->link_speed = link_speed; | 418 | card->link_speed = link_speed; |
| @@ -422,7 +423,13 @@ fw_card_add(struct fw_card *card, | |||
| 422 | list_add_tail(&card->link, &card_list); | 423 | list_add_tail(&card->link, &card_list); |
| 423 | mutex_unlock(&card_mutex); | 424 | mutex_unlock(&card_mutex); |
| 424 | 425 | ||
| 425 | return card->driver->enable(card, config_rom, length); | 426 | err = card->driver->enable(card, config_rom, length); |
| 427 | if (err < 0) { | ||
| 428 | mutex_lock(&card_mutex); | ||
| 429 | list_del(&card->link); | ||
| 430 | mutex_unlock(&card_mutex); | ||
| 431 | } | ||
| 432 | return err; | ||
| 426 | } | 433 | } |
| 427 | EXPORT_SYMBOL(fw_card_add); | 434 | EXPORT_SYMBOL(fw_card_add); |
| 428 | 435 | ||
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c index 03705240000f..abf4dfc8ec22 100644 --- a/drivers/hwmon/hp_accel.c +++ b/drivers/hwmon/hp_accel.c | |||
| @@ -153,7 +153,10 @@ static struct axis_conversion lis3lv02d_axis_y_inverted = {1, -2, 3}; | |||
| 153 | static struct axis_conversion lis3lv02d_axis_x_inverted = {-1, 2, 3}; | 153 | static struct axis_conversion lis3lv02d_axis_x_inverted = {-1, 2, 3}; |
| 154 | static struct axis_conversion lis3lv02d_axis_z_inverted = {1, 2, -3}; | 154 | static struct axis_conversion lis3lv02d_axis_z_inverted = {1, 2, -3}; |
| 155 | static struct axis_conversion lis3lv02d_axis_xy_rotated_left = {-2, 1, 3}; | 155 | static struct axis_conversion lis3lv02d_axis_xy_rotated_left = {-2, 1, 3}; |
| 156 | static struct axis_conversion lis3lv02d_axis_xy_rotated_left_usd = {-2, 1, -3}; | ||
| 156 | static struct axis_conversion lis3lv02d_axis_xy_swap_inverted = {-2, -1, 3}; | 157 | static struct axis_conversion lis3lv02d_axis_xy_swap_inverted = {-2, -1, 3}; |
| 158 | static struct axis_conversion lis3lv02d_axis_xy_rotated_right = {2, -1, 3}; | ||
| 159 | static struct axis_conversion lis3lv02d_axis_xy_swap_yz_inverted = {2, -1, -3}; | ||
| 157 | 160 | ||
| 158 | #define AXIS_DMI_MATCH(_ident, _name, _axis) { \ | 161 | #define AXIS_DMI_MATCH(_ident, _name, _axis) { \ |
| 159 | .ident = _ident, \ | 162 | .ident = _ident, \ |
| @@ -172,10 +175,12 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = { | |||
| 172 | AXIS_DMI_MATCH("NC2510", "HP Compaq 2510", y_inverted), | 175 | AXIS_DMI_MATCH("NC2510", "HP Compaq 2510", y_inverted), |
| 173 | AXIS_DMI_MATCH("NC8510", "HP Compaq 8510", xy_swap_inverted), | 176 | AXIS_DMI_MATCH("NC8510", "HP Compaq 8510", xy_swap_inverted), |
| 174 | AXIS_DMI_MATCH("HP2133", "HP 2133", xy_rotated_left), | 177 | AXIS_DMI_MATCH("HP2133", "HP 2133", xy_rotated_left), |
| 178 | AXIS_DMI_MATCH("NC653x", "HP Compaq 653", xy_rotated_left_usd), | ||
| 179 | AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd), | ||
| 180 | AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right), | ||
| 181 | AXIS_DMI_MATCH("NC671xx", "HP Compaq 671", xy_swap_yz_inverted), | ||
| 175 | { NULL, } | 182 | { NULL, } |
| 176 | /* Laptop models without axis info (yet): | 183 | /* Laptop models without axis info (yet): |
| 177 | * "NC651xx" "HP Compaq 651" | ||
| 178 | * "NC671xx" "HP Compaq 671" | ||
| 179 | * "NC6910" "HP Compaq 6910" | 184 | * "NC6910" "HP Compaq 6910" |
| 180 | * HP Compaq 8710x Notebook PC / Mobile Workstation | 185 | * HP Compaq 8710x Notebook PC / Mobile Workstation |
| 181 | * "NC2400" "HP Compaq nc2400" | 186 | * "NC2400" "HP Compaq nc2400" |
diff --git a/drivers/ide/qd65xx.c b/drivers/ide/qd65xx.c index 5b2e3af43c4b..08c4fa35e9b1 100644 --- a/drivers/ide/qd65xx.c +++ b/drivers/ide/qd65xx.c | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | /* | 17 | /* |
| 18 | * Rewritten from the work of Colten Edwards <pje120@cs.usask.ca> by | 18 | * Rewritten from the work of Colten Edwards <pje120@cs.usask.ca> by |
| 19 | * Samuel Thibault <samuel.thibault@fnac.net> | 19 | * Samuel Thibault <samuel.thibault@ens-lyon.org> |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
diff --git a/drivers/ide/qd65xx.h b/drivers/ide/qd65xx.h index 6636f9665d16..d7e67a1a1dcc 100644 --- a/drivers/ide/qd65xx.h +++ b/drivers/ide/qd65xx.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | /* | 5 | /* |
| 6 | * Authors: Petr Soucek <petr@ryston.cz> | 6 | * Authors: Petr Soucek <petr@ryston.cz> |
| 7 | * Samuel Thibault <samuel.thibault@fnac.net> | 7 | * Samuel Thibault <samuel.thibault@ens-lyon.org> |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | /* truncates a in [b,c] */ | 10 | /* truncates a in [b,c] */ |
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index a329e6bd5d2d..3838bc4acaba 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c | |||
| @@ -1823,6 +1823,10 @@ static int dv1394_open(struct inode *inode, struct file *file) | |||
| 1823 | 1823 | ||
| 1824 | #endif | 1824 | #endif |
| 1825 | 1825 | ||
| 1826 | printk(KERN_INFO "%s: NOTE, the dv1394 interface is unsupported " | ||
| 1827 | "and will not be available in the new firewire driver stack. " | ||
| 1828 | "Try libraw1394 based programs instead.\n", current->comm); | ||
| 1829 | |||
| 1826 | return 0; | 1830 | return 0; |
| 1827 | } | 1831 | } |
| 1828 | 1832 | ||
| @@ -2567,10 +2571,6 @@ static int __init dv1394_init_module(void) | |||
| 2567 | { | 2571 | { |
| 2568 | int ret; | 2572 | int ret; |
| 2569 | 2573 | ||
| 2570 | printk(KERN_WARNING | ||
| 2571 | "NOTE: The dv1394 driver is unsupported and may be removed in a " | ||
| 2572 | "future Linux release. Use raw1394 instead.\n"); | ||
| 2573 | |||
| 2574 | cdev_init(&dv1394_cdev, &dv1394_fops); | 2574 | cdev_init(&dv1394_cdev, &dv1394_fops); |
| 2575 | dv1394_cdev.owner = THIS_MODULE; | 2575 | dv1394_cdev.owner = THIS_MODULE; |
| 2576 | ret = cdev_add(&dv1394_cdev, IEEE1394_DV1394_DEV, 16); | 2576 | ret = cdev_add(&dv1394_cdev, IEEE1394_DV1394_DEV, 16); |
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 1e3aea9eecf1..09658b218474 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
| @@ -25,13 +25,13 @@ static inline dev_info_t *which_dev(mddev_t *mddev, sector_t sector) | |||
| 25 | { | 25 | { |
| 26 | dev_info_t *hash; | 26 | dev_info_t *hash; |
| 27 | linear_conf_t *conf = mddev_to_conf(mddev); | 27 | linear_conf_t *conf = mddev_to_conf(mddev); |
| 28 | sector_t idx = sector >> conf->sector_shift; | ||
| 28 | 29 | ||
| 29 | /* | 30 | /* |
| 30 | * sector_div(a,b) returns the remainer and sets a to a/b | 31 | * sector_div(a,b) returns the remainer and sets a to a/b |
| 31 | */ | 32 | */ |
| 32 | sector >>= conf->sector_shift; | 33 | (void)sector_div(idx, conf->spacing); |
| 33 | (void)sector_div(sector, conf->spacing); | 34 | hash = conf->hash_table[idx]; |
| 34 | hash = conf->hash_table[sector]; | ||
| 35 | 35 | ||
| 36 | while (sector >= hash->num_sectors + hash->start_sector) | 36 | while (sector >= hash->num_sectors + hash->start_sector) |
| 37 | hash++; | 37 | hash++; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 41e2509bf896..4495104f6c9f 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -1481,6 +1481,11 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) | |||
| 1481 | if (find_rdev_nr(mddev, rdev->desc_nr)) | 1481 | if (find_rdev_nr(mddev, rdev->desc_nr)) |
| 1482 | return -EBUSY; | 1482 | return -EBUSY; |
| 1483 | } | 1483 | } |
| 1484 | if (mddev->max_disks && rdev->desc_nr >= mddev->max_disks) { | ||
| 1485 | printk(KERN_WARNING "md: %s: array is limited to %d devices\n", | ||
| 1486 | mdname(mddev), mddev->max_disks); | ||
| 1487 | return -EBUSY; | ||
| 1488 | } | ||
| 1484 | bdevname(rdev->bdev,b); | 1489 | bdevname(rdev->bdev,b); |
| 1485 | while ( (s=strchr(b, '/')) != NULL) | 1490 | while ( (s=strchr(b, '/')) != NULL) |
| 1486 | *s = '!'; | 1491 | *s = '!'; |
| @@ -2441,6 +2446,15 @@ static void analyze_sbs(mddev_t * mddev) | |||
| 2441 | 2446 | ||
| 2442 | i = 0; | 2447 | i = 0; |
| 2443 | rdev_for_each(rdev, tmp, mddev) { | 2448 | rdev_for_each(rdev, tmp, mddev) { |
| 2449 | if (rdev->desc_nr >= mddev->max_disks || | ||
| 2450 | i > mddev->max_disks) { | ||
| 2451 | printk(KERN_WARNING | ||
| 2452 | "md: %s: %s: only %d devices permitted\n", | ||
| 2453 | mdname(mddev), bdevname(rdev->bdev, b), | ||
| 2454 | mddev->max_disks); | ||
| 2455 | kick_rdev_from_array(rdev); | ||
| 2456 | continue; | ||
| 2457 | } | ||
| 2444 | if (rdev != freshest) | 2458 | if (rdev != freshest) |
| 2445 | if (super_types[mddev->major_version]. | 2459 | if (super_types[mddev->major_version]. |
| 2446 | validate_super(mddev, rdev)) { | 2460 | validate_super(mddev, rdev)) { |
| @@ -4614,13 +4628,6 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev) | |||
| 4614 | * noticed in interrupt contexts ... | 4628 | * noticed in interrupt contexts ... |
| 4615 | */ | 4629 | */ |
| 4616 | 4630 | ||
| 4617 | if (rdev->desc_nr == mddev->max_disks) { | ||
| 4618 | printk(KERN_WARNING "%s: can not hot-add to full array!\n", | ||
| 4619 | mdname(mddev)); | ||
| 4620 | err = -EBUSY; | ||
| 4621 | goto abort_unbind_export; | ||
| 4622 | } | ||
| 4623 | |||
| 4624 | rdev->raid_disk = -1; | 4631 | rdev->raid_disk = -1; |
| 4625 | 4632 | ||
| 4626 | md_update_sb(mddev, 1); | 4633 | md_update_sb(mddev, 1); |
| @@ -4634,9 +4641,6 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev) | |||
| 4634 | md_new_event(mddev); | 4641 | md_new_event(mddev); |
| 4635 | return 0; | 4642 | return 0; |
| 4636 | 4643 | ||
| 4637 | abort_unbind_export: | ||
| 4638 | unbind_rdev_from_array(rdev); | ||
| 4639 | |||
| 4640 | abort_export: | 4644 | abort_export: |
| 4641 | export_rdev(rdev); | 4645 | export_rdev(rdev); |
| 4642 | return err; | 4646 | return err; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 7b4f5f7155d8..01e3cffd03b8 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
| @@ -1640,7 +1640,8 @@ static void raid1d(mddev_t *mddev) | |||
| 1640 | } | 1640 | } |
| 1641 | 1641 | ||
| 1642 | bio = r1_bio->bios[r1_bio->read_disk]; | 1642 | bio = r1_bio->bios[r1_bio->read_disk]; |
| 1643 | if ((disk=read_balance(conf, r1_bio)) == -1) { | 1643 | if ((disk=read_balance(conf, r1_bio)) == -1 || |
| 1644 | disk == r1_bio->read_disk) { | ||
| 1644 | printk(KERN_ALERT "raid1: %s: unrecoverable I/O" | 1645 | printk(KERN_ALERT "raid1: %s: unrecoverable I/O" |
| 1645 | " read error for block %llu\n", | 1646 | " read error for block %llu\n", |
| 1646 | bdevname(bio->bi_bdev,b), | 1647 | bdevname(bio->bi_bdev,b), |
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c index 24508e28e3fb..ea9488e7ad6d 100644 --- a/drivers/mfd/pcf50633-core.c +++ b/drivers/mfd/pcf50633-core.c | |||
| @@ -626,7 +626,6 @@ static int __devinit pcf50633_probe(struct i2c_client *client, | |||
| 626 | } | 626 | } |
| 627 | 627 | ||
| 628 | if (client->irq) { | 628 | if (client->irq) { |
| 629 | set_irq_handler(client->irq, handle_level_irq); | ||
| 630 | ret = request_irq(client->irq, pcf50633_irq, | 629 | ret = request_irq(client->irq, pcf50633_irq, |
| 631 | IRQF_TRIGGER_LOW, "pcf50633", pcf); | 630 | IRQF_TRIGGER_LOW, "pcf50633", pcf); |
| 632 | 631 | ||
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 56073199ceba..c64e6798878a 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
| @@ -217,6 +217,7 @@ config DELL_LAPTOP | |||
| 217 | depends on EXPERIMENTAL | 217 | depends on EXPERIMENTAL |
| 218 | depends on BACKLIGHT_CLASS_DEVICE | 218 | depends on BACKLIGHT_CLASS_DEVICE |
| 219 | depends on RFKILL | 219 | depends on RFKILL |
| 220 | depends on POWER_SUPPLY | ||
| 220 | default n | 221 | default n |
| 221 | ---help--- | 222 | ---help--- |
| 222 | This driver adds support for rfkill and backlight control to Dell | 223 | This driver adds support for rfkill and backlight control to Dell |
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c index bf5e4d065436..558bf3f2c276 100644 --- a/drivers/misc/atmel-ssc.c +++ b/drivers/misc/atmel-ssc.c | |||
| @@ -35,7 +35,7 @@ struct ssc_device *ssc_request(unsigned int ssc_num) | |||
| 35 | 35 | ||
| 36 | if (!ssc_valid) { | 36 | if (!ssc_valid) { |
| 37 | spin_unlock(&user_lock); | 37 | spin_unlock(&user_lock); |
| 38 | dev_dbg(&ssc->pdev->dev, "could not find requested device\n"); | 38 | pr_err("ssc: ssc%d platform device is missing\n", ssc_num); |
| 39 | return ERR_PTR(-ENODEV); | 39 | return ERR_PTR(-ENODEV); |
| 40 | } | 40 | } |
| 41 | 41 | ||
diff --git a/drivers/misc/hpilo.c b/drivers/misc/hpilo.c index 10c421b73eaf..f26667a7abf7 100644 --- a/drivers/misc/hpilo.c +++ b/drivers/misc/hpilo.c | |||
| @@ -207,7 +207,7 @@ static void ilo_ccb_close(struct pci_dev *pdev, struct ccb_data *data) | |||
| 207 | &device_ccb->recv_ctrl); | 207 | &device_ccb->recv_ctrl); |
| 208 | 208 | ||
| 209 | /* give iLO some time to process stop request */ | 209 | /* give iLO some time to process stop request */ |
| 210 | for (retries = 1000; retries > 0; retries--) { | 210 | for (retries = MAX_WAIT; retries > 0; retries--) { |
| 211 | doorbell_set(driver_ccb); | 211 | doorbell_set(driver_ccb); |
| 212 | udelay(1); | 212 | udelay(1); |
| 213 | if (!(ioread32(&device_ccb->send_ctrl) & (1 << CTRL_BITPOS_A)) | 213 | if (!(ioread32(&device_ccb->send_ctrl) & (1 << CTRL_BITPOS_A)) |
| @@ -309,7 +309,7 @@ static int ilo_ccb_open(struct ilo_hwinfo *hw, struct ccb_data *data, int slot) | |||
| 309 | doorbell_clr(driver_ccb); | 309 | doorbell_clr(driver_ccb); |
| 310 | 310 | ||
| 311 | /* make sure iLO is really handling requests */ | 311 | /* make sure iLO is really handling requests */ |
| 312 | for (i = 1000; i > 0; i--) { | 312 | for (i = MAX_WAIT; i > 0; i--) { |
| 313 | if (ilo_pkt_dequeue(hw, driver_ccb, SENDQ, &pkt_id, NULL, NULL)) | 313 | if (ilo_pkt_dequeue(hw, driver_ccb, SENDQ, &pkt_id, NULL, NULL)) |
| 314 | break; | 314 | break; |
| 315 | udelay(1); | 315 | udelay(1); |
| @@ -326,7 +326,7 @@ static int ilo_ccb_open(struct ilo_hwinfo *hw, struct ccb_data *data, int slot) | |||
| 326 | 326 | ||
| 327 | return 0; | 327 | return 0; |
| 328 | free: | 328 | free: |
| 329 | pci_free_consistent(pdev, data->dma_size, data->dma_va, data->dma_pa); | 329 | ilo_ccb_close(pdev, data); |
| 330 | out: | 330 | out: |
| 331 | return error; | 331 | return error; |
| 332 | } | 332 | } |
diff --git a/drivers/misc/hpilo.h b/drivers/misc/hpilo.h index a281207696c1..b64a20ef07e3 100644 --- a/drivers/misc/hpilo.h +++ b/drivers/misc/hpilo.h | |||
| @@ -19,6 +19,8 @@ | |||
| 19 | #define MAX_ILO_DEV 1 | 19 | #define MAX_ILO_DEV 1 |
| 20 | /* max number of files */ | 20 | /* max number of files */ |
| 21 | #define MAX_OPEN (MAX_CCB * MAX_ILO_DEV) | 21 | #define MAX_OPEN (MAX_CCB * MAX_ILO_DEV) |
| 22 | /* spin counter for open/close delay */ | ||
| 23 | #define MAX_WAIT 10000 | ||
| 22 | 24 | ||
| 23 | /* | 25 | /* |
| 24 | * Per device, used to track global memory allocations. | 26 | * Per device, used to track global memory allocations. |
diff --git a/drivers/misc/sgi-xp/xpc.h b/drivers/misc/sgi-xp/xpc.h index a5bd658c2e83..275b78896a73 100644 --- a/drivers/misc/sgi-xp/xpc.h +++ b/drivers/misc/sgi-xp/xpc.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. | 4 | * for more details. |
| 5 | * | 5 | * |
| 6 | * Copyright (c) 2004-2008 Silicon Graphics, Inc. All Rights Reserved. | 6 | * Copyright (c) 2004-2009 Silicon Graphics, Inc. All Rights Reserved. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | /* | 9 | /* |
| @@ -514,7 +514,8 @@ struct xpc_channel_uv { | |||
| 514 | /* partition's notify mq */ | 514 | /* partition's notify mq */ |
| 515 | 515 | ||
| 516 | struct xpc_send_msg_slot_uv *send_msg_slots; | 516 | struct xpc_send_msg_slot_uv *send_msg_slots; |
| 517 | struct xpc_notify_mq_msg_uv *recv_msg_slots; | 517 | void *recv_msg_slots; /* each slot will hold a xpc_notify_mq_msg_uv */ |
| 518 | /* structure plus the user's payload */ | ||
| 518 | 519 | ||
| 519 | struct xpc_fifo_head_uv msg_slot_free_list; | 520 | struct xpc_fifo_head_uv msg_slot_free_list; |
| 520 | struct xpc_fifo_head_uv recv_msg_list; /* deliverable payloads */ | 521 | struct xpc_fifo_head_uv recv_msg_list; /* deliverable payloads */ |
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c index f17f7d40ea2c..29c0502a96b2 100644 --- a/drivers/misc/sgi-xp/xpc_uv.c +++ b/drivers/misc/sgi-xp/xpc_uv.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. | 4 | * for more details. |
| 5 | * | 5 | * |
| 6 | * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved. | 6 | * Copyright (c) 2008-2009 Silicon Graphics, Inc. All Rights Reserved. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | /* | 9 | /* |
| @@ -1010,8 +1010,8 @@ xpc_allocate_recv_msg_slot_uv(struct xpc_channel *ch) | |||
| 1010 | continue; | 1010 | continue; |
| 1011 | 1011 | ||
| 1012 | for (entry = 0; entry < nentries; entry++) { | 1012 | for (entry = 0; entry < nentries; entry++) { |
| 1013 | msg_slot = ch_uv->recv_msg_slots + entry * | 1013 | msg_slot = ch_uv->recv_msg_slots + |
| 1014 | ch->entry_size; | 1014 | entry * ch->entry_size; |
| 1015 | 1015 | ||
| 1016 | msg_slot->hdr.msg_slot_number = entry; | 1016 | msg_slot->hdr.msg_slot_number = entry; |
| 1017 | } | 1017 | } |
| @@ -1308,9 +1308,8 @@ xpc_handle_notify_mq_msg_uv(struct xpc_partition *part, | |||
| 1308 | /* we're dealing with a normal message sent via the notify_mq */ | 1308 | /* we're dealing with a normal message sent via the notify_mq */ |
| 1309 | ch_uv = &ch->sn.uv; | 1309 | ch_uv = &ch->sn.uv; |
| 1310 | 1310 | ||
| 1311 | msg_slot = (struct xpc_notify_mq_msg_uv *)((u64)ch_uv->recv_msg_slots + | 1311 | msg_slot = ch_uv->recv_msg_slots + |
| 1312 | (msg->hdr.msg_slot_number % ch->remote_nentries) * | 1312 | (msg->hdr.msg_slot_number % ch->remote_nentries) * ch->entry_size; |
| 1313 | ch->entry_size); | ||
| 1314 | 1313 | ||
| 1315 | BUG_ON(msg->hdr.msg_slot_number != msg_slot->hdr.msg_slot_number); | 1314 | BUG_ON(msg->hdr.msg_slot_number != msg_slot->hdr.msg_slot_number); |
| 1316 | BUG_ON(msg_slot->hdr.size != 0); | 1315 | BUG_ON(msg_slot->hdr.size != 0); |
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c index 7957f525b2f4..6faefcffcb53 100644 --- a/drivers/misc/sgi-xp/xpnet.c +++ b/drivers/misc/sgi-xp/xpnet.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. | 4 | * for more details. |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 1999-2008 Silicon Graphics, Inc. All rights reserved. | 6 | * Copyright (C) 1999-2009 Silicon Graphics, Inc. All rights reserved. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | /* | 9 | /* |
| @@ -551,6 +551,7 @@ xpnet_init(void) | |||
| 551 | 551 | ||
| 552 | netif_carrier_off(xpnet_device); | 552 | netif_carrier_off(xpnet_device); |
| 553 | 553 | ||
| 554 | xpnet_device->netdev_ops = &xpnet_netdev_ops; | ||
| 554 | xpnet_device->mtu = XPNET_DEF_MTU; | 555 | xpnet_device->mtu = XPNET_DEF_MTU; |
| 555 | 556 | ||
| 556 | /* | 557 | /* |
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index 7df6bbf0e4d9..6f6a0f6dafd6 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c | |||
| @@ -453,7 +453,7 @@ static struct platform_driver sa1100_mtd_driver = { | |||
| 453 | .resume = sa1100_mtd_resume, | 453 | .resume = sa1100_mtd_resume, |
| 454 | .shutdown = sa1100_mtd_shutdown, | 454 | .shutdown = sa1100_mtd_shutdown, |
| 455 | .driver = { | 455 | .driver = { |
| 456 | .name = "flash", | 456 | .name = "sa1100-mtd", |
| 457 | .owner = THIS_MODULE, | 457 | .owner = THIS_MODULE, |
| 458 | }, | 458 | }, |
| 459 | }; | 459 | }; |
| @@ -474,4 +474,4 @@ module_exit(sa1100_mtd_exit); | |||
| 474 | MODULE_AUTHOR("Nicolas Pitre"); | 474 | MODULE_AUTHOR("Nicolas Pitre"); |
| 475 | MODULE_DESCRIPTION("SA1100 CFI map driver"); | 475 | MODULE_DESCRIPTION("SA1100 CFI map driver"); |
| 476 | MODULE_LICENSE("GPL"); | 476 | MODULE_LICENSE("GPL"); |
| 477 | MODULE_ALIAS("platform:flash"); | 477 | MODULE_ALIAS("platform:sa1100-mtd"); |
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c index d15d8b79d8e5..54b52e5b1821 100644 --- a/drivers/net/arm/etherh.c +++ b/drivers/net/arm/etherh.c | |||
| @@ -646,7 +646,7 @@ static const struct net_device_ops etherh_netdev_ops = { | |||
| 646 | .ndo_get_stats = ei_get_stats, | 646 | .ndo_get_stats = ei_get_stats, |
| 647 | .ndo_set_multicast_list = ei_set_multicast_list, | 647 | .ndo_set_multicast_list = ei_set_multicast_list, |
| 648 | .ndo_validate_addr = eth_validate_addr, | 648 | .ndo_validate_addr = eth_validate_addr, |
| 649 | .ndo_set_mac_address = eth_set_mac_addr, | 649 | .ndo_set_mac_address = eth_mac_addr, |
| 650 | .ndo_change_mtu = eth_change_mtu, | 650 | .ndo_change_mtu = eth_change_mtu, |
| 651 | #ifdef CONFIG_NET_POLL_CONTROLLER | 651 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 652 | .ndo_poll_controller = ei_poll, | 652 | .ndo_poll_controller = ei_poll, |
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 840b3d1a22f5..bbbc3bb08aa5 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
| @@ -806,7 +806,7 @@ static int cas_reset_mii_phy(struct cas *cp) | |||
| 806 | 806 | ||
| 807 | cas_phy_write(cp, MII_BMCR, BMCR_RESET); | 807 | cas_phy_write(cp, MII_BMCR, BMCR_RESET); |
| 808 | udelay(100); | 808 | udelay(100); |
| 809 | while (limit--) { | 809 | while (--limit) { |
| 810 | val = cas_phy_read(cp, MII_BMCR); | 810 | val = cas_phy_read(cp, MII_BMCR); |
| 811 | if ((val & BMCR_RESET) == 0) | 811 | if ((val & BMCR_RESET) == 0) |
| 812 | break; | 812 | break; |
| @@ -979,7 +979,7 @@ static void cas_phy_init(struct cas *cp) | |||
| 979 | writel(val, cp->regs + REG_PCS_MII_CTRL); | 979 | writel(val, cp->regs + REG_PCS_MII_CTRL); |
| 980 | 980 | ||
| 981 | limit = STOP_TRIES; | 981 | limit = STOP_TRIES; |
| 982 | while (limit-- > 0) { | 982 | while (--limit > 0) { |
| 983 | udelay(10); | 983 | udelay(10); |
| 984 | if ((readl(cp->regs + REG_PCS_MII_CTRL) & | 984 | if ((readl(cp->regs + REG_PCS_MII_CTRL) & |
| 985 | PCS_MII_RESET) == 0) | 985 | PCS_MII_RESET) == 0) |
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index 379a1324db4e..d31791f60292 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
| @@ -2276,8 +2276,7 @@ no_mem: | |||
| 2276 | } else if ((len = ntohl(r->len_cq)) != 0) { | 2276 | } else if ((len = ntohl(r->len_cq)) != 0) { |
| 2277 | struct sge_fl *fl; | 2277 | struct sge_fl *fl; |
| 2278 | 2278 | ||
| 2279 | if (eth) | 2279 | lro &= eth && is_eth_tcp(rss_hi); |
| 2280 | lro = qs->lro_enabled && is_eth_tcp(rss_hi); | ||
| 2281 | 2280 | ||
| 2282 | fl = (len & F_RSPD_FLQ) ? &qs->fl[1] : &qs->fl[0]; | 2281 | fl = (len & F_RSPD_FLQ) ? &qs->fl[1] : &qs->fl[0]; |
| 2283 | if (fl->use_pages) { | 2282 | if (fl->use_pages) { |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index c986978ce761..6bd63cc67b3e 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
| @@ -940,7 +940,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
| 940 | err = pci_enable_device(pdev); | 940 | err = pci_enable_device(pdev); |
| 941 | } else { | 941 | } else { |
| 942 | bars = pci_select_bars(pdev, IORESOURCE_MEM); | 942 | bars = pci_select_bars(pdev, IORESOURCE_MEM); |
| 943 | err = pci_enable_device(pdev); | 943 | err = pci_enable_device_mem(pdev); |
| 944 | } | 944 | } |
| 945 | if (err) | 945 | if (err) |
| 946 | return err; | 946 | return err; |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 3f7eab42aef1..acae2d8cd688 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
| @@ -351,6 +351,9 @@ static int gfar_probe(struct of_device *ofdev, | |||
| 351 | /* Reset MAC layer */ | 351 | /* Reset MAC layer */ |
| 352 | gfar_write(&priv->regs->maccfg1, MACCFG1_SOFT_RESET); | 352 | gfar_write(&priv->regs->maccfg1, MACCFG1_SOFT_RESET); |
| 353 | 353 | ||
| 354 | /* We need to delay at least 3 TX clocks */ | ||
| 355 | udelay(2); | ||
| 356 | |||
| 354 | tempval = (MACCFG1_TX_FLOW | MACCFG1_RX_FLOW); | 357 | tempval = (MACCFG1_TX_FLOW | MACCFG1_RX_FLOW); |
| 355 | gfar_write(&priv->regs->maccfg1, tempval); | 358 | gfar_write(&priv->regs->maccfg1, tempval); |
| 356 | 359 | ||
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index b1a83344acc7..eaa86897f5c3 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
| @@ -312,7 +312,7 @@ extern const char gfar_driver_version[]; | |||
| 312 | #define ATTRELI_EI(x) (x) | 312 | #define ATTRELI_EI(x) (x) |
| 313 | 313 | ||
| 314 | #define BD_LFLAG(flags) ((flags) << 16) | 314 | #define BD_LFLAG(flags) ((flags) << 16) |
| 315 | #define BD_LENGTH_MASK 0x00ff | 315 | #define BD_LENGTH_MASK 0x0000ffff |
| 316 | 316 | ||
| 317 | /* TxBD status field bits */ | 317 | /* TxBD status field bits */ |
| 318 | #define TXBD_READY 0x8000 | 318 | #define TXBD_READY 0x8000 |
diff --git a/drivers/net/ibm_newemac/phy.c b/drivers/net/ibm_newemac/phy.c index c40cd8df2212..ac9d964e59ec 100644 --- a/drivers/net/ibm_newemac/phy.c +++ b/drivers/net/ibm_newemac/phy.c | |||
| @@ -60,7 +60,7 @@ int emac_mii_reset_phy(struct mii_phy *phy) | |||
| 60 | 60 | ||
| 61 | udelay(300); | 61 | udelay(300); |
| 62 | 62 | ||
| 63 | while (limit--) { | 63 | while (--limit) { |
| 64 | val = phy_read(phy, MII_BMCR); | 64 | val = phy_read(phy, MII_BMCR); |
| 65 | if (val >= 0 && (val & BMCR_RESET) == 0) | 65 | if (val >= 0 && (val & BMCR_RESET) == 0) |
| 66 | break; | 66 | break; |
| @@ -84,7 +84,7 @@ int emac_mii_reset_gpcs(struct mii_phy *phy) | |||
| 84 | 84 | ||
| 85 | udelay(300); | 85 | udelay(300); |
| 86 | 86 | ||
| 87 | while (limit--) { | 87 | while (--limit) { |
| 88 | val = gpcs_phy_read(phy, MII_BMCR); | 88 | val = gpcs_phy_read(phy, MII_BMCR); |
| 89 | if (val >= 0 && (val & BMCR_RESET) == 0) | 89 | if (val >= 0 && (val & BMCR_RESET) == 0) |
| 90 | break; | 90 | break; |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index c38ed777f0a8..a6999403f37b 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
| @@ -586,7 +586,7 @@ static int pcnet_config(struct pcmcia_device *link) | |||
| 586 | } | 586 | } |
| 587 | 587 | ||
| 588 | if ((link->conf.ConfigBase == 0x03c0) | 588 | if ((link->conf.ConfigBase == 0x03c0) |
| 589 | && (link->manf_id == 0x149) && (link->card_id = 0xc1ab)) { | 589 | && (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) { |
| 590 | printk(KERN_INFO "pcnet_cs: this is an AX88190 card!\n"); | 590 | printk(KERN_INFO "pcnet_cs: this is an AX88190 card!\n"); |
| 591 | printk(KERN_INFO "pcnet_cs: use axnet_cs instead.\n"); | 591 | printk(KERN_INFO "pcnet_cs: use axnet_cs instead.\n"); |
| 592 | goto failed; | 592 | goto failed; |
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h index c1dadadfab18..e6fdce9206cc 100644 --- a/drivers/net/qlge/qlge.h +++ b/drivers/net/qlge/qlge.h | |||
| @@ -787,12 +787,12 @@ struct mbox_params { | |||
| 787 | 787 | ||
| 788 | struct flash_params { | 788 | struct flash_params { |
| 789 | u8 dev_id_str[4]; | 789 | u8 dev_id_str[4]; |
| 790 | u16 size; | 790 | __le16 size; |
| 791 | u16 csum; | 791 | __le16 csum; |
| 792 | u16 ver; | 792 | __le16 ver; |
| 793 | u16 sub_dev_id; | 793 | __le16 sub_dev_id; |
| 794 | u8 mac_addr[6]; | 794 | u8 mac_addr[6]; |
| 795 | u16 res; | 795 | __le16 res; |
| 796 | }; | 796 | }; |
| 797 | 797 | ||
| 798 | 798 | ||
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 45421c8b6010..3d1d7b6e55aa 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
| @@ -641,7 +641,7 @@ static void ql_enable_all_completion_interrupts(struct ql_adapter *qdev) | |||
| 641 | 641 | ||
| 642 | } | 642 | } |
| 643 | 643 | ||
| 644 | static int ql_read_flash_word(struct ql_adapter *qdev, int offset, u32 *data) | 644 | static int ql_read_flash_word(struct ql_adapter *qdev, int offset, __le32 *data) |
| 645 | { | 645 | { |
| 646 | int status = 0; | 646 | int status = 0; |
| 647 | /* wait for reg to come ready */ | 647 | /* wait for reg to come ready */ |
| @@ -656,8 +656,11 @@ static int ql_read_flash_word(struct ql_adapter *qdev, int offset, u32 *data) | |||
| 656 | FLASH_ADDR, FLASH_ADDR_RDY, FLASH_ADDR_ERR); | 656 | FLASH_ADDR, FLASH_ADDR_RDY, FLASH_ADDR_ERR); |
| 657 | if (status) | 657 | if (status) |
| 658 | goto exit; | 658 | goto exit; |
| 659 | /* get the data */ | 659 | /* This data is stored on flash as an array of |
| 660 | *data = ql_read32(qdev, FLASH_DATA); | 660 | * __le32. Since ql_read32() returns cpu endian |
| 661 | * we need to swap it back. | ||
| 662 | */ | ||
| 663 | *data = cpu_to_le32(ql_read32(qdev, FLASH_DATA)); | ||
| 661 | exit: | 664 | exit: |
| 662 | return status; | 665 | return status; |
| 663 | } | 666 | } |
| @@ -666,13 +669,20 @@ static int ql_get_flash_params(struct ql_adapter *qdev) | |||
| 666 | { | 669 | { |
| 667 | int i; | 670 | int i; |
| 668 | int status; | 671 | int status; |
| 669 | u32 *p = (u32 *)&qdev->flash; | 672 | __le32 *p = (__le32 *)&qdev->flash; |
| 673 | u32 offset = 0; | ||
| 674 | |||
| 675 | /* Second function's parameters follow the first | ||
| 676 | * function's. | ||
| 677 | */ | ||
| 678 | if (qdev->func) | ||
| 679 | offset = sizeof(qdev->flash) / sizeof(u32); | ||
| 670 | 680 | ||
| 671 | if (ql_sem_spinlock(qdev, SEM_FLASH_MASK)) | 681 | if (ql_sem_spinlock(qdev, SEM_FLASH_MASK)) |
| 672 | return -ETIMEDOUT; | 682 | return -ETIMEDOUT; |
| 673 | 683 | ||
| 674 | for (i = 0; i < sizeof(qdev->flash) / sizeof(u32); i++, p++) { | 684 | for (i = 0; i < sizeof(qdev->flash) / sizeof(u32); i++, p++) { |
| 675 | status = ql_read_flash_word(qdev, i, p); | 685 | status = ql_read_flash_word(qdev, i+offset, p); |
| 676 | if (status) { | 686 | if (status) { |
| 677 | QPRINTK(qdev, IFUP, ERR, "Error reading flash.\n"); | 687 | QPRINTK(qdev, IFUP, ERR, "Error reading flash.\n"); |
| 678 | goto exit; | 688 | goto exit; |
| @@ -3826,7 +3836,7 @@ static int qlge_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 3826 | { | 3836 | { |
| 3827 | struct net_device *ndev = pci_get_drvdata(pdev); | 3837 | struct net_device *ndev = pci_get_drvdata(pdev); |
| 3828 | struct ql_adapter *qdev = netdev_priv(ndev); | 3838 | struct ql_adapter *qdev = netdev_priv(ndev); |
| 3829 | int err; | 3839 | int err, i; |
| 3830 | 3840 | ||
| 3831 | netif_device_detach(ndev); | 3841 | netif_device_detach(ndev); |
| 3832 | 3842 | ||
| @@ -3836,6 +3846,9 @@ static int qlge_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 3836 | return err; | 3846 | return err; |
| 3837 | } | 3847 | } |
| 3838 | 3848 | ||
| 3849 | for (i = qdev->rss_ring_first_cq_id; i < qdev->rx_ring_count; i++) | ||
| 3850 | netif_napi_del(&qdev->rx_ring[i].napi); | ||
| 3851 | |||
| 3839 | err = pci_save_state(pdev); | 3852 | err = pci_save_state(pdev); |
| 3840 | if (err) | 3853 | if (err) |
| 3841 | return err; | 3854 | return err; |
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index bf3aa2a1effe..223cde0d43be 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c | |||
| @@ -220,9 +220,9 @@ static void smc911x_reset(struct net_device *dev) | |||
| 220 | 220 | ||
| 221 | /* make sure EEPROM has finished loading before setting GPIO_CFG */ | 221 | /* make sure EEPROM has finished loading before setting GPIO_CFG */ |
| 222 | timeout=1000; | 222 | timeout=1000; |
| 223 | while ( timeout-- && (SMC_GET_E2P_CMD(lp) & E2P_CMD_EPC_BUSY_)) { | 223 | while (--timeout && (SMC_GET_E2P_CMD(lp) & E2P_CMD_EPC_BUSY_)) |
| 224 | udelay(10); | 224 | udelay(10); |
| 225 | } | 225 | |
| 226 | if (timeout == 0){ | 226 | if (timeout == 0){ |
| 227 | PRINTK("%s: smc911x_reset timeout waiting for EEPROM busy\n", dev->name); | 227 | PRINTK("%s: smc911x_reset timeout waiting for EEPROM busy\n", dev->name); |
| 228 | return; | 228 | return; |
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c index d801900a5036..a1e4b3895b33 100644 --- a/drivers/net/smsc9420.c +++ b/drivers/net/smsc9420.c | |||
| @@ -498,7 +498,7 @@ static void smsc9420_check_mac_address(struct net_device *dev) | |||
| 498 | static void smsc9420_stop_tx(struct smsc9420_pdata *pd) | 498 | static void smsc9420_stop_tx(struct smsc9420_pdata *pd) |
| 499 | { | 499 | { |
| 500 | u32 dmac_control, mac_cr, dma_intr_ena; | 500 | u32 dmac_control, mac_cr, dma_intr_ena; |
| 501 | int timeOut = 1000; | 501 | int timeout = 1000; |
| 502 | 502 | ||
| 503 | /* disable TX DMAC */ | 503 | /* disable TX DMAC */ |
| 504 | dmac_control = smsc9420_reg_read(pd, DMAC_CONTROL); | 504 | dmac_control = smsc9420_reg_read(pd, DMAC_CONTROL); |
| @@ -506,13 +506,13 @@ static void smsc9420_stop_tx(struct smsc9420_pdata *pd) | |||
| 506 | smsc9420_reg_write(pd, DMAC_CONTROL, dmac_control); | 506 | smsc9420_reg_write(pd, DMAC_CONTROL, dmac_control); |
| 507 | 507 | ||
| 508 | /* Wait max 10ms for transmit process to stop */ | 508 | /* Wait max 10ms for transmit process to stop */ |
| 509 | while (timeOut--) { | 509 | while (--timeout) { |
| 510 | if (smsc9420_reg_read(pd, DMAC_STATUS) & DMAC_STS_TS_) | 510 | if (smsc9420_reg_read(pd, DMAC_STATUS) & DMAC_STS_TS_) |
| 511 | break; | 511 | break; |
| 512 | udelay(10); | 512 | udelay(10); |
| 513 | } | 513 | } |
| 514 | 514 | ||
| 515 | if (!timeOut) | 515 | if (!timeout) |
| 516 | smsc_warn(IFDOWN, "TX DMAC failed to stop"); | 516 | smsc_warn(IFDOWN, "TX DMAC failed to stop"); |
| 517 | 517 | ||
| 518 | /* ACK Tx DMAC stop bit */ | 518 | /* ACK Tx DMAC stop bit */ |
| @@ -596,7 +596,7 @@ static void smsc9420_free_rx_ring(struct smsc9420_pdata *pd) | |||
| 596 | 596 | ||
| 597 | static void smsc9420_stop_rx(struct smsc9420_pdata *pd) | 597 | static void smsc9420_stop_rx(struct smsc9420_pdata *pd) |
| 598 | { | 598 | { |
| 599 | int timeOut = 1000; | 599 | int timeout = 1000; |
| 600 | u32 mac_cr, dmac_control, dma_intr_ena; | 600 | u32 mac_cr, dmac_control, dma_intr_ena; |
| 601 | 601 | ||
| 602 | /* mask RX DMAC interrupts */ | 602 | /* mask RX DMAC interrupts */ |
| @@ -617,13 +617,13 @@ static void smsc9420_stop_rx(struct smsc9420_pdata *pd) | |||
| 617 | smsc9420_pci_flush_write(pd); | 617 | smsc9420_pci_flush_write(pd); |
| 618 | 618 | ||
| 619 | /* wait up to 10ms for receive to stop */ | 619 | /* wait up to 10ms for receive to stop */ |
| 620 | while (timeOut--) { | 620 | while (--timeout) { |
| 621 | if (smsc9420_reg_read(pd, DMAC_STATUS) & DMAC_STS_RS_) | 621 | if (smsc9420_reg_read(pd, DMAC_STATUS) & DMAC_STS_RS_) |
| 622 | break; | 622 | break; |
| 623 | udelay(10); | 623 | udelay(10); |
| 624 | } | 624 | } |
| 625 | 625 | ||
| 626 | if (!timeOut) | 626 | if (!timeout) |
| 627 | smsc_warn(IFDOWN, "RX DMAC did not stop! timeout."); | 627 | smsc_warn(IFDOWN, "RX DMAC did not stop! timeout."); |
| 628 | 628 | ||
| 629 | /* ACK the Rx DMAC stop bit */ | 629 | /* ACK the Rx DMAC stop bit */ |
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 86c765d83de1..b17efa9cc530 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
| @@ -148,7 +148,7 @@ static u16 __phy_read(struct gem *gp, int phy_addr, int reg) | |||
| 148 | cmd |= (MIF_FRAME_TAMSB); | 148 | cmd |= (MIF_FRAME_TAMSB); |
| 149 | writel(cmd, gp->regs + MIF_FRAME); | 149 | writel(cmd, gp->regs + MIF_FRAME); |
| 150 | 150 | ||
| 151 | while (limit--) { | 151 | while (--limit) { |
| 152 | cmd = readl(gp->regs + MIF_FRAME); | 152 | cmd = readl(gp->regs + MIF_FRAME); |
| 153 | if (cmd & MIF_FRAME_TALSB) | 153 | if (cmd & MIF_FRAME_TALSB) |
| 154 | break; | 154 | break; |
diff --git a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c index 61843fd57525..78f8cee5fd74 100644 --- a/drivers/net/sungem_phy.c +++ b/drivers/net/sungem_phy.c | |||
| @@ -79,7 +79,7 @@ static int reset_one_mii_phy(struct mii_phy* phy, int phy_id) | |||
| 79 | 79 | ||
| 80 | udelay(100); | 80 | udelay(100); |
| 81 | 81 | ||
| 82 | while (limit--) { | 82 | while (--limit) { |
| 83 | val = __phy_read(phy, phy_id, MII_BMCR); | 83 | val = __phy_read(phy, phy_id, MII_BMCR); |
| 84 | if ((val & BMCR_RESET) == 0) | 84 | if ((val & BMCR_RESET) == 0) |
| 85 | break; | 85 | break; |
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c index 6e8f377355fe..fe0c3f244562 100644 --- a/drivers/net/sunqe.c +++ b/drivers/net/sunqe.c | |||
| @@ -227,7 +227,7 @@ static int qe_init(struct sunqe *qep, int from_irq) | |||
| 227 | if (!(sbus_readb(mregs + MREGS_PHYCONFIG) & MREGS_PHYCONFIG_LTESTDIS)) { | 227 | if (!(sbus_readb(mregs + MREGS_PHYCONFIG) & MREGS_PHYCONFIG_LTESTDIS)) { |
| 228 | int tries = 50; | 228 | int tries = 50; |
| 229 | 229 | ||
| 230 | while (tries--) { | 230 | while (--tries) { |
| 231 | u8 tmp; | 231 | u8 tmp; |
| 232 | 232 | ||
| 233 | mdelay(5); | 233 | mdelay(5); |
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c index 75461dbd4876..a9fd2b2ccaf6 100644 --- a/drivers/net/tsi108_eth.c +++ b/drivers/net/tsi108_eth.c | |||
| @@ -1237,7 +1237,7 @@ static void tsi108_init_phy(struct net_device *dev) | |||
| 1237 | spin_lock_irqsave(&phy_lock, flags); | 1237 | spin_lock_irqsave(&phy_lock, flags); |
| 1238 | 1238 | ||
| 1239 | tsi108_write_mii(data, MII_BMCR, BMCR_RESET); | 1239 | tsi108_write_mii(data, MII_BMCR, BMCR_RESET); |
| 1240 | while (i--){ | 1240 | while (--i) { |
| 1241 | if(!(tsi108_read_mii(data, MII_BMCR) & BMCR_RESET)) | 1241 | if(!(tsi108_read_mii(data, MII_BMCR) & BMCR_RESET)) |
| 1242 | break; | 1242 | break; |
| 1243 | udelay(10); | 1243 | udelay(10); |
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index d5d53b633cf8..0bf2114738be 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
| @@ -392,7 +392,7 @@ static void de_rx (struct de_private *de) | |||
| 392 | unsigned drop = 0; | 392 | unsigned drop = 0; |
| 393 | int rc; | 393 | int rc; |
| 394 | 394 | ||
| 395 | while (rx_work--) { | 395 | while (--rx_work) { |
| 396 | u32 status, len; | 396 | u32 status, len; |
| 397 | dma_addr_t mapping; | 397 | dma_addr_t mapping; |
| 398 | struct sk_buff *skb, *copy_skb; | 398 | struct sk_buff *skb, *copy_skb; |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 0d0fa91c0251..fe98acaead97 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
| @@ -455,6 +455,7 @@ static const struct usb_device_id hso_ids[] = { | |||
| 455 | {icon321_port_device(0x0af0, 0xd033)}, /* Icon-322 */ | 455 | {icon321_port_device(0x0af0, 0xd033)}, /* Icon-322 */ |
| 456 | {USB_DEVICE(0x0af0, 0x7301)}, /* GE40x */ | 456 | {USB_DEVICE(0x0af0, 0x7301)}, /* GE40x */ |
| 457 | {USB_DEVICE(0x0af0, 0x7361)}, /* GE40x */ | 457 | {USB_DEVICE(0x0af0, 0x7361)}, /* GE40x */ |
| 458 | {USB_DEVICE(0x0af0, 0x7381)}, /* GE40x */ | ||
| 458 | {USB_DEVICE(0x0af0, 0x7401)}, /* GI 0401 */ | 459 | {USB_DEVICE(0x0af0, 0x7401)}, /* GI 0401 */ |
| 459 | {USB_DEVICE(0x0af0, 0x7501)}, /* GTM 382 */ | 460 | {USB_DEVICE(0x0af0, 0x7501)}, /* GTM 382 */ |
| 460 | {USB_DEVICE(0x0af0, 0x7601)}, /* GE40x */ | 461 | {USB_DEVICE(0x0af0, 0x7601)}, /* GE40x */ |
| @@ -462,7 +463,8 @@ static const struct usb_device_id hso_ids[] = { | |||
| 462 | {USB_DEVICE(0x0af0, 0x7801)}, | 463 | {USB_DEVICE(0x0af0, 0x7801)}, |
| 463 | {USB_DEVICE(0x0af0, 0x7901)}, | 464 | {USB_DEVICE(0x0af0, 0x7901)}, |
| 464 | {USB_DEVICE(0x0af0, 0x7361)}, | 465 | {USB_DEVICE(0x0af0, 0x7361)}, |
| 465 | {icon321_port_device(0x0af0, 0xd051)}, | 466 | {USB_DEVICE(0x0af0, 0xd057)}, |
| 467 | {USB_DEVICE(0x0af0, 0xd055)}, | ||
| 466 | {} | 468 | {} |
| 467 | }; | 469 | }; |
| 468 | MODULE_DEVICE_TABLE(usb, hso_ids); | 470 | MODULE_DEVICE_TABLE(usb, hso_ids); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index b35c8813bef4..c01ea48da5fe 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
| @@ -4042,6 +4042,7 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 4042 | priv->is_open = 1; | 4042 | priv->is_open = 1; |
| 4043 | } | 4043 | } |
| 4044 | 4044 | ||
| 4045 | pci_save_state(pdev); | ||
| 4045 | pci_set_power_state(pdev, PCI_D3hot); | 4046 | pci_set_power_state(pdev, PCI_D3hot); |
| 4046 | 4047 | ||
| 4047 | return 0; | 4048 | return 0; |
| @@ -4052,6 +4053,7 @@ static int iwl_pci_resume(struct pci_dev *pdev) | |||
| 4052 | struct iwl_priv *priv = pci_get_drvdata(pdev); | 4053 | struct iwl_priv *priv = pci_get_drvdata(pdev); |
| 4053 | 4054 | ||
| 4054 | pci_set_power_state(pdev, PCI_D0); | 4055 | pci_set_power_state(pdev, PCI_D0); |
| 4056 | pci_restore_state(pdev); | ||
| 4055 | 4057 | ||
| 4056 | if (priv->is_open) | 4058 | if (priv->is_open) |
| 4057 | iwl_mac_start(priv->hw); | 4059 | iwl_mac_start(priv->hw); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index 412f66bac1af..70a8b21ca39b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
| @@ -480,6 +480,9 @@ void iwl_clear_stations_table(struct iwl_priv *priv) | |||
| 480 | priv->num_stations = 0; | 480 | priv->num_stations = 0; |
| 481 | memset(priv->stations, 0, sizeof(priv->stations)); | 481 | memset(priv->stations, 0, sizeof(priv->stations)); |
| 482 | 482 | ||
| 483 | /* clean ucode key table bit map */ | ||
| 484 | priv->ucode_key_table = 0; | ||
| 485 | |||
| 483 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 486 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
| 484 | } | 487 | } |
| 485 | EXPORT_SYMBOL(iwl_clear_stations_table); | 488 | EXPORT_SYMBOL(iwl_clear_stations_table); |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 95d01984c80e..5b44d322b99f 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
| @@ -8143,6 +8143,7 @@ static int iwl3945_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 8143 | priv->is_open = 1; | 8143 | priv->is_open = 1; |
| 8144 | } | 8144 | } |
| 8145 | 8145 | ||
| 8146 | pci_save_state(pdev); | ||
| 8146 | pci_set_power_state(pdev, PCI_D3hot); | 8147 | pci_set_power_state(pdev, PCI_D3hot); |
| 8147 | 8148 | ||
| 8148 | return 0; | 8149 | return 0; |
| @@ -8153,6 +8154,7 @@ static int iwl3945_pci_resume(struct pci_dev *pdev) | |||
| 8153 | struct iwl3945_priv *priv = pci_get_drvdata(pdev); | 8154 | struct iwl3945_priv *priv = pci_get_drvdata(pdev); |
| 8154 | 8155 | ||
| 8155 | pci_set_power_state(pdev, PCI_D0); | 8156 | pci_set_power_state(pdev, PCI_D0); |
| 8157 | pci_restore_state(pdev); | ||
| 8156 | 8158 | ||
| 8157 | if (priv->is_open) | 8159 | if (priv->is_open) |
| 8158 | iwl3945_mac_start(priv->hw); | 8160 | iwl3945_mac_start(priv->hw); |
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index de91ddab0a86..f41135f2fb29 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
| @@ -463,9 +463,11 @@ static int __init hp_wmi_bios_setup(struct platform_device *device) | |||
| 463 | 463 | ||
| 464 | return 0; | 464 | return 0; |
| 465 | register_wwan_err: | 465 | register_wwan_err: |
| 466 | rfkill_unregister(bluetooth_rfkill); | 466 | if (bluetooth_rfkill) |
| 467 | rfkill_unregister(bluetooth_rfkill); | ||
| 467 | register_bluetooth_error: | 468 | register_bluetooth_error: |
| 468 | rfkill_unregister(wifi_rfkill); | 469 | if (wifi_rfkill) |
| 470 | rfkill_unregister(wifi_rfkill); | ||
| 469 | add_sysfs_error: | 471 | add_sysfs_error: |
| 470 | cleanup_sysfs(device); | 472 | cleanup_sysfs(device); |
| 471 | return err; | 473 | return err; |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index cced4d108319..81450fbd8b12 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
| @@ -241,6 +241,12 @@ config RTC_DRV_M41T80_WDT | |||
| 241 | If you say Y here you will get support for the | 241 | If you say Y here you will get support for the |
| 242 | watchdog timer in the ST M41T60 and M41T80 RTC chips series. | 242 | watchdog timer in the ST M41T60 and M41T80 RTC chips series. |
| 243 | 243 | ||
| 244 | config RTC_DRV_DM355EVM | ||
| 245 | tristate "TI DaVinci DM355 EVM RTC" | ||
| 246 | depends on MFD_DM355EVM_MSP | ||
| 247 | help | ||
| 248 | Supports the RTC firmware in the MSP430 on the DM355 EVM. | ||
| 249 | |||
| 244 | config RTC_DRV_TWL92330 | 250 | config RTC_DRV_TWL92330 |
| 245 | boolean "TI TWL92330/Menelaus" | 251 | boolean "TI TWL92330/Menelaus" |
| 246 | depends on MENELAUS | 252 | depends on MENELAUS |
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 6e28021abb9d..0e697aa51caa 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile | |||
| @@ -23,6 +23,7 @@ obj-$(CONFIG_RTC_DRV_AT91SAM9) += rtc-at91sam9.o | |||
| 23 | obj-$(CONFIG_RTC_DRV_AU1XXX) += rtc-au1xxx.o | 23 | obj-$(CONFIG_RTC_DRV_AU1XXX) += rtc-au1xxx.o |
| 24 | obj-$(CONFIG_RTC_DRV_BFIN) += rtc-bfin.o | 24 | obj-$(CONFIG_RTC_DRV_BFIN) += rtc-bfin.o |
| 25 | obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o | 25 | obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o |
| 26 | obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o | ||
| 26 | obj-$(CONFIG_RTC_DRV_DS1216) += rtc-ds1216.o | 27 | obj-$(CONFIG_RTC_DRV_DS1216) += rtc-ds1216.o |
| 27 | obj-$(CONFIG_RTC_DRV_DS1286) += rtc-ds1286.o | 28 | obj-$(CONFIG_RTC_DRV_DS1286) += rtc-ds1286.o |
| 28 | obj-$(CONFIG_RTC_DRV_DS1302) += rtc-ds1302.o | 29 | obj-$(CONFIG_RTC_DRV_DS1302) += rtc-ds1302.o |
diff --git a/drivers/rtc/rtc-dm355evm.c b/drivers/rtc/rtc-dm355evm.c new file mode 100644 index 000000000000..58d4e18530da --- /dev/null +++ b/drivers/rtc/rtc-dm355evm.c | |||
| @@ -0,0 +1,175 @@ | |||
| 1 | /* | ||
| 2 | * rtc-dm355evm.c - access battery-backed counter in MSP430 firmware | ||
| 3 | * | ||
| 4 | * Copyright (c) 2008 by David Brownell | ||
| 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 | #include <linux/kernel.h> | ||
| 12 | #include <linux/init.h> | ||
| 13 | #include <linux/rtc.h> | ||
| 14 | #include <linux/platform_device.h> | ||
| 15 | |||
| 16 | #include <linux/i2c/dm355evm_msp.h> | ||
| 17 | |||
| 18 | |||
| 19 | /* | ||
| 20 | * The MSP430 firmware on the DM355 EVM uses a watch crystal to feed | ||
| 21 | * a 1 Hz counter. When a backup battery is supplied, that makes a | ||
| 22 | * reasonable RTC for applications where alarms and non-NTP drift | ||
| 23 | * compensation aren't important. | ||
| 24 | * | ||
| 25 | * The only real glitch is the inability to read or write all four | ||
| 26 | * counter bytes atomically: the count may increment in the middle | ||
| 27 | * of an operation, causing trouble when the LSB rolls over. | ||
| 28 | * | ||
| 29 | * This driver was tested with firmware revision A4. | ||
| 30 | */ | ||
| 31 | union evm_time { | ||
| 32 | u8 bytes[4]; | ||
| 33 | u32 value; | ||
| 34 | }; | ||
| 35 | |||
| 36 | static int dm355evm_rtc_read_time(struct device *dev, struct rtc_time *tm) | ||
| 37 | { | ||
| 38 | union evm_time time; | ||
| 39 | int status; | ||
| 40 | int tries = 0; | ||
| 41 | |||
| 42 | do { | ||
| 43 | /* | ||
| 44 | * Read LSB(0) to MSB(3) bytes. Defend against the counter | ||
| 45 | * rolling over by re-reading until the value is stable, | ||
| 46 | * and assuming the four reads take at most a few seconds. | ||
| 47 | */ | ||
| 48 | status = dm355evm_msp_read(DM355EVM_MSP_RTC_0); | ||
| 49 | if (status < 0) | ||
| 50 | return status; | ||
| 51 | if (tries && time.bytes[0] == status) | ||
| 52 | break; | ||
| 53 | time.bytes[0] = status; | ||
| 54 | |||
| 55 | status = dm355evm_msp_read(DM355EVM_MSP_RTC_1); | ||
| 56 | if (status < 0) | ||
| 57 | return status; | ||
| 58 | if (tries && time.bytes[1] == status) | ||
| 59 | break; | ||
| 60 | time.bytes[1] = status; | ||
| 61 | |||
| 62 | status = dm355evm_msp_read(DM355EVM_MSP_RTC_2); | ||
| 63 | if (status < 0) | ||
| 64 | return status; | ||
| 65 | if (tries && time.bytes[2] == status) | ||
| 66 | break; | ||
| 67 | time.bytes[2] = status; | ||
| 68 | |||
| 69 | status = dm355evm_msp_read(DM355EVM_MSP_RTC_3); | ||
| 70 | if (status < 0) | ||
| 71 | return status; | ||
| 72 | if (tries && time.bytes[3] == status) | ||
| 73 | break; | ||
| 74 | time.bytes[3] = status; | ||
| 75 | |||
| 76 | } while (++tries < 5); | ||
| 77 | |||
| 78 | dev_dbg(dev, "read timestamp %08x\n", time.value); | ||
| 79 | |||
| 80 | rtc_time_to_tm(le32_to_cpu(time.value), tm); | ||
| 81 | return 0; | ||
| 82 | } | ||
| 83 | |||
| 84 | static int dm355evm_rtc_set_time(struct device *dev, struct rtc_time *tm) | ||
| 85 | { | ||
| 86 | union evm_time time; | ||
| 87 | unsigned long value; | ||
| 88 | int status; | ||
| 89 | |||
| 90 | rtc_tm_to_time(tm, &value); | ||
| 91 | time.value = cpu_to_le32(value); | ||
| 92 | |||
| 93 | dev_dbg(dev, "write timestamp %08x\n", time.value); | ||
| 94 | |||
| 95 | /* | ||
| 96 | * REVISIT handle non-atomic writes ... maybe just retry until | ||
| 97 | * byte[1] sticks (no rollover)? | ||
| 98 | */ | ||
| 99 | status = dm355evm_msp_write(time.bytes[0], DM355EVM_MSP_RTC_0); | ||
| 100 | if (status < 0) | ||
| 101 | return status; | ||
| 102 | |||
| 103 | status = dm355evm_msp_write(time.bytes[1], DM355EVM_MSP_RTC_1); | ||
| 104 | if (status < 0) | ||
| 105 | return status; | ||
| 106 | |||
| 107 | status = dm355evm_msp_write(time.bytes[2], DM355EVM_MSP_RTC_2); | ||
| 108 | if (status < 0) | ||
| 109 | return status; | ||
| 110 | |||
| 111 | status = dm355evm_msp_write(time.bytes[3], DM355EVM_MSP_RTC_3); | ||
| 112 | if (status < 0) | ||
| 113 | return status; | ||
| 114 | |||
| 115 | return 0; | ||
| 116 | } | ||
| 117 | |||
| 118 | static struct rtc_class_ops dm355evm_rtc_ops = { | ||
| 119 | .read_time = dm355evm_rtc_read_time, | ||
| 120 | .set_time = dm355evm_rtc_set_time, | ||
| 121 | }; | ||
| 122 | |||
| 123 | /*----------------------------------------------------------------------*/ | ||
| 124 | |||
| 125 | static int __devinit dm355evm_rtc_probe(struct platform_device *pdev) | ||
| 126 | { | ||
| 127 | struct rtc_device *rtc; | ||
| 128 | |||
| 129 | rtc = rtc_device_register(pdev->name, | ||
| 130 | &pdev->dev, &dm355evm_rtc_ops, THIS_MODULE); | ||
| 131 | if (IS_ERR(rtc)) { | ||
| 132 | dev_err(&pdev->dev, "can't register RTC device, err %ld\n", | ||
| 133 | PTR_ERR(rtc)); | ||
| 134 | return PTR_ERR(rtc); | ||
| 135 | } | ||
| 136 | platform_set_drvdata(pdev, rtc); | ||
| 137 | |||
| 138 | return 0; | ||
| 139 | } | ||
| 140 | |||
| 141 | static int __devexit dm355evm_rtc_remove(struct platform_device *pdev) | ||
| 142 | { | ||
| 143 | struct rtc_device *rtc = platform_get_drvdata(pdev); | ||
| 144 | |||
| 145 | rtc_device_unregister(rtc); | ||
| 146 | platform_set_drvdata(pdev, NULL); | ||
| 147 | return 0; | ||
| 148 | } | ||
| 149 | |||
| 150 | /* | ||
| 151 | * I2C is used to talk to the MSP430, but this platform device is | ||
| 152 | * exposed by an MFD driver that manages I2C communications. | ||
| 153 | */ | ||
| 154 | static struct platform_driver rtc_dm355evm_driver = { | ||
| 155 | .probe = dm355evm_rtc_probe, | ||
| 156 | .remove = __devexit_p(dm355evm_rtc_remove), | ||
| 157 | .driver = { | ||
| 158 | .owner = THIS_MODULE, | ||
| 159 | .name = "rtc-dm355evm", | ||
| 160 | }, | ||
| 161 | }; | ||
| 162 | |||
| 163 | static int __init dm355evm_rtc_init(void) | ||
| 164 | { | ||
| 165 | return platform_driver_register(&rtc_dm355evm_driver); | ||
| 166 | } | ||
| 167 | module_init(dm355evm_rtc_init); | ||
| 168 | |||
| 169 | static void __exit dm355evm_rtc_exit(void) | ||
| 170 | { | ||
| 171 | platform_driver_unregister(&rtc_dm355evm_driver); | ||
| 172 | } | ||
| 173 | module_exit(dm355evm_rtc_exit); | ||
| 174 | |||
| 175 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c index e54b5c619bdf..e01b955db077 100644 --- a/drivers/rtc/rtc-ds1390.c +++ b/drivers/rtc/rtc-ds1390.c | |||
| @@ -122,7 +122,6 @@ static const struct rtc_class_ops ds1390_rtc_ops = { | |||
| 122 | 122 | ||
| 123 | static int __devinit ds1390_probe(struct spi_device *spi) | 123 | static int __devinit ds1390_probe(struct spi_device *spi) |
| 124 | { | 124 | { |
| 125 | struct rtc_device *rtc; | ||
| 126 | unsigned char tmp; | 125 | unsigned char tmp; |
| 127 | struct ds1390 *chip; | 126 | struct ds1390 *chip; |
| 128 | int res; | 127 | int res; |
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index db16112cf197..fb2b0f5b23bd 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
| @@ -1475,7 +1475,7 @@ static int aty128fb_set_par(struct fb_info *info) | |||
| 1475 | aty128_set_pll(&par->pll, par); | 1475 | aty128_set_pll(&par->pll, par); |
| 1476 | aty128_set_fifo(&par->fifo_reg, par); | 1476 | aty128_set_fifo(&par->fifo_reg, par); |
| 1477 | 1477 | ||
| 1478 | config = aty_ld_le32(CONFIG_CNTL) & ~3; | 1478 | config = aty_ld_le32(CNFG_CNTL) & ~3; |
| 1479 | 1479 | ||
| 1480 | #if defined(__BIG_ENDIAN) | 1480 | #if defined(__BIG_ENDIAN) |
| 1481 | if (par->crtc.bpp == 32) | 1481 | if (par->crtc.bpp == 32) |
| @@ -1484,7 +1484,7 @@ static int aty128fb_set_par(struct fb_info *info) | |||
| 1484 | config |= 1; /* make aperture do 16 bit swapping */ | 1484 | config |= 1; /* make aperture do 16 bit swapping */ |
| 1485 | #endif | 1485 | #endif |
| 1486 | 1486 | ||
| 1487 | aty_st_le32(CONFIG_CNTL, config); | 1487 | aty_st_le32(CNFG_CNTL, config); |
| 1488 | aty_st_8(CRTC_EXT_CNTL + 1, 0); /* turn the video back on */ | 1488 | aty_st_8(CRTC_EXT_CNTL + 1, 0); /* turn the video back on */ |
| 1489 | 1489 | ||
| 1490 | info->fix.line_length = (par->crtc.vxres * par->crtc.bpp) >> 3; | 1490 | info->fix.line_length = (par->crtc.vxres * par->crtc.bpp) >> 3; |
| @@ -1875,7 +1875,7 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i | |||
| 1875 | u32 dac; | 1875 | u32 dac; |
| 1876 | 1876 | ||
| 1877 | /* Get the chip revision */ | 1877 | /* Get the chip revision */ |
| 1878 | chip_rev = (aty_ld_le32(CONFIG_CNTL) >> 16) & 0x1F; | 1878 | chip_rev = (aty_ld_le32(CNFG_CNTL) >> 16) & 0x1F; |
| 1879 | 1879 | ||
| 1880 | strcpy(video_card, "Rage128 XX "); | 1880 | strcpy(video_card, "Rage128 XX "); |
| 1881 | video_card[8] = ent->device >> 8; | 1881 | video_card[8] = ent->device >> 8; |
| @@ -2057,7 +2057,7 @@ static int __devinit aty128_probe(struct pci_dev *pdev, const struct pci_device_ | |||
| 2057 | 2057 | ||
| 2058 | /* Grab memory size from the card */ | 2058 | /* Grab memory size from the card */ |
| 2059 | // How does this relate to the resource length from the PCI hardware? | 2059 | // How does this relate to the resource length from the PCI hardware? |
| 2060 | par->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF; | 2060 | par->vram_size = aty_ld_le32(CNFG_MEMSIZE) & 0x03FFFFFF; |
| 2061 | 2061 | ||
| 2062 | /* Virtualize the framebuffer */ | 2062 | /* Virtualize the framebuffer */ |
| 2063 | info->screen_base = ioremap(fb_addr, par->vram_size); | 2063 | info->screen_base = ioremap(fb_addr, par->vram_size); |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index cc6b470073da..1d6e16d346a5 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
| @@ -135,7 +135,7 @@ | |||
| 135 | #if defined(CONFIG_PM) || defined(CONFIG_PMAC_BACKLIGHT) || \ | 135 | #if defined(CONFIG_PM) || defined(CONFIG_PMAC_BACKLIGHT) || \ |
| 136 | defined (CONFIG_FB_ATY_GENERIC_LCD) || defined(CONFIG_FB_ATY_BACKLIGHT) | 136 | defined (CONFIG_FB_ATY_GENERIC_LCD) || defined(CONFIG_FB_ATY_BACKLIGHT) |
| 137 | static const u32 lt_lcd_regs[] = { | 137 | static const u32 lt_lcd_regs[] = { |
| 138 | CONFIG_PANEL_LG, | 138 | CNFG_PANEL_LG, |
| 139 | LCD_GEN_CNTL_LG, | 139 | LCD_GEN_CNTL_LG, |
| 140 | DSTN_CONTROL_LG, | 140 | DSTN_CONTROL_LG, |
| 141 | HFB_PITCH_ADDR_LG, | 141 | HFB_PITCH_ADDR_LG, |
| @@ -446,7 +446,7 @@ static int __devinit correct_chipset(struct atyfb_par *par) | |||
| 446 | par->pll_limits.ecp_max = aty_chips[i].ecp_max; | 446 | par->pll_limits.ecp_max = aty_chips[i].ecp_max; |
| 447 | par->features = aty_chips[i].features; | 447 | par->features = aty_chips[i].features; |
| 448 | 448 | ||
| 449 | chip_id = aty_ld_le32(CONFIG_CHIP_ID, par); | 449 | chip_id = aty_ld_le32(CNFG_CHIP_ID, par); |
| 450 | type = chip_id & CFG_CHIP_TYPE; | 450 | type = chip_id & CFG_CHIP_TYPE; |
| 451 | rev = (chip_id & CFG_CHIP_REV) >> 24; | 451 | rev = (chip_id & CFG_CHIP_REV) >> 24; |
| 452 | 452 | ||
| @@ -629,7 +629,7 @@ static void aty_get_crtc(const struct atyfb_par *par, struct crtc *crtc) | |||
| 629 | crtc->lcd_index = aty_ld_le32(LCD_INDEX, par); | 629 | crtc->lcd_index = aty_ld_le32(LCD_INDEX, par); |
| 630 | aty_st_le32(LCD_INDEX, crtc->lcd_index, par); | 630 | aty_st_le32(LCD_INDEX, crtc->lcd_index, par); |
| 631 | } | 631 | } |
| 632 | crtc->lcd_config_panel = aty_ld_lcd(CONFIG_PANEL, par); | 632 | crtc->lcd_config_panel = aty_ld_lcd(CNFG_PANEL, par); |
| 633 | crtc->lcd_gen_cntl = aty_ld_lcd(LCD_GEN_CNTL, par); | 633 | crtc->lcd_gen_cntl = aty_ld_lcd(LCD_GEN_CNTL, par); |
| 634 | 634 | ||
| 635 | 635 | ||
| @@ -676,7 +676,7 @@ static void aty_set_crtc(const struct atyfb_par *par, const struct crtc *crtc) | |||
| 676 | aty_st_le32(CRTC_GEN_CNTL, crtc->gen_cntl & ~(CRTC_EXT_DISP_EN | CRTC_EN), par); | 676 | aty_st_le32(CRTC_GEN_CNTL, crtc->gen_cntl & ~(CRTC_EXT_DISP_EN | CRTC_EN), par); |
| 677 | 677 | ||
| 678 | /* update non-shadow registers first */ | 678 | /* update non-shadow registers first */ |
| 679 | aty_st_lcd(CONFIG_PANEL, crtc->lcd_config_panel, par); | 679 | aty_st_lcd(CNFG_PANEL, crtc->lcd_config_panel, par); |
| 680 | aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl & | 680 | aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl & |
| 681 | ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN), par); | 681 | ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN), par); |
| 682 | 682 | ||
| @@ -858,7 +858,7 @@ static int aty_var_to_crtc(const struct fb_info *info, | |||
| 858 | if (!M64_HAS(MOBIL_BUS)) | 858 | if (!M64_HAS(MOBIL_BUS)) |
| 859 | crtc->lcd_index |= CRTC2_DISPLAY_DIS; | 859 | crtc->lcd_index |= CRTC2_DISPLAY_DIS; |
| 860 | 860 | ||
| 861 | crtc->lcd_config_panel = aty_ld_lcd(CONFIG_PANEL, par) | 0x4000; | 861 | crtc->lcd_config_panel = aty_ld_lcd(CNFG_PANEL, par) | 0x4000; |
| 862 | crtc->lcd_gen_cntl = aty_ld_lcd(LCD_GEN_CNTL, par) & ~CRTC_RW_SELECT; | 862 | crtc->lcd_gen_cntl = aty_ld_lcd(LCD_GEN_CNTL, par) & ~CRTC_RW_SELECT; |
| 863 | 863 | ||
| 864 | crtc->lcd_gen_cntl &= | 864 | crtc->lcd_gen_cntl &= |
| @@ -2254,7 +2254,7 @@ static int __devinit aty_init(struct fb_info *info) | |||
| 2254 | if (!M64_HAS(INTEGRATED)) { | 2254 | if (!M64_HAS(INTEGRATED)) { |
| 2255 | u32 stat0; | 2255 | u32 stat0; |
| 2256 | u8 dac_type, dac_subtype, clk_type; | 2256 | u8 dac_type, dac_subtype, clk_type; |
| 2257 | stat0 = aty_ld_le32(CONFIG_STAT0, par); | 2257 | stat0 = aty_ld_le32(CNFG_STAT0, par); |
| 2258 | par->bus_type = (stat0 >> 0) & 0x07; | 2258 | par->bus_type = (stat0 >> 0) & 0x07; |
| 2259 | par->ram_type = (stat0 >> 3) & 0x07; | 2259 | par->ram_type = (stat0 >> 3) & 0x07; |
| 2260 | ramname = aty_gx_ram[par->ram_type]; | 2260 | ramname = aty_gx_ram[par->ram_type]; |
| @@ -2324,7 +2324,7 @@ static int __devinit aty_init(struct fb_info *info) | |||
| 2324 | par->dac_ops = &aty_dac_ct; | 2324 | par->dac_ops = &aty_dac_ct; |
| 2325 | par->pll_ops = &aty_pll_ct; | 2325 | par->pll_ops = &aty_pll_ct; |
| 2326 | par->bus_type = PCI; | 2326 | par->bus_type = PCI; |
| 2327 | par->ram_type = (aty_ld_le32(CONFIG_STAT0, par) & 0x07); | 2327 | par->ram_type = (aty_ld_le32(CNFG_STAT0, par) & 0x07); |
| 2328 | ramname = aty_ct_ram[par->ram_type]; | 2328 | ramname = aty_ct_ram[par->ram_type]; |
| 2329 | /* for many chips, the mclk is 67 MHz for SDRAM, 63 MHz otherwise */ | 2329 | /* for many chips, the mclk is 67 MHz for SDRAM, 63 MHz otherwise */ |
| 2330 | if (par->pll_limits.mclk == 67 && par->ram_type < SDRAM) | 2330 | if (par->pll_limits.mclk == 67 && par->ram_type < SDRAM) |
| @@ -2433,7 +2433,7 @@ static int __devinit aty_init(struct fb_info *info) | |||
| 2433 | } | 2433 | } |
| 2434 | 2434 | ||
| 2435 | if (M64_HAS(MAGIC_VRAM_SIZE)) { | 2435 | if (M64_HAS(MAGIC_VRAM_SIZE)) { |
| 2436 | if (aty_ld_le32(CONFIG_STAT1, par) & 0x40000000) | 2436 | if (aty_ld_le32(CNFG_STAT1, par) & 0x40000000) |
| 2437 | info->fix.smem_len += 0x400000; | 2437 | info->fix.smem_len += 0x400000; |
| 2438 | } | 2438 | } |
| 2439 | 2439 | ||
| @@ -2946,7 +2946,7 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev, | |||
| 2946 | * Fix PROMs idea of MEM_CNTL settings... | 2946 | * Fix PROMs idea of MEM_CNTL settings... |
| 2947 | */ | 2947 | */ |
| 2948 | mem = aty_ld_le32(MEM_CNTL, par); | 2948 | mem = aty_ld_le32(MEM_CNTL, par); |
| 2949 | chip_id = aty_ld_le32(CONFIG_CHIP_ID, par); | 2949 | chip_id = aty_ld_le32(CNFG_CHIP_ID, par); |
| 2950 | if (((chip_id & CFG_CHIP_TYPE) == VT_CHIP_ID) && !((chip_id >> 24) & 1)) { | 2950 | if (((chip_id & CFG_CHIP_TYPE) == VT_CHIP_ID) && !((chip_id >> 24) & 1)) { |
| 2951 | switch (mem & 0x0f) { | 2951 | switch (mem & 0x0f) { |
| 2952 | case 3: | 2952 | case 3: |
| @@ -2964,7 +2964,7 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev, | |||
| 2964 | default: | 2964 | default: |
| 2965 | break; | 2965 | break; |
| 2966 | } | 2966 | } |
| 2967 | if ((aty_ld_le32(CONFIG_STAT0, par) & 7) >= SDRAM) | 2967 | if ((aty_ld_le32(CNFG_STAT0, par) & 7) >= SDRAM) |
| 2968 | mem &= ~(0x00700000); | 2968 | mem &= ~(0x00700000); |
| 2969 | } | 2969 | } |
| 2970 | mem &= ~(0xcf80e000); /* Turn off all undocumented bits. */ | 2970 | mem &= ~(0xcf80e000); /* Turn off all undocumented bits. */ |
| @@ -3572,7 +3572,7 @@ static int __init atyfb_atari_probe(void) | |||
| 3572 | } | 3572 | } |
| 3573 | 3573 | ||
| 3574 | /* Fake pci_id for correct_chipset() */ | 3574 | /* Fake pci_id for correct_chipset() */ |
| 3575 | switch (aty_ld_le32(CONFIG_CHIP_ID, par) & CFG_CHIP_TYPE) { | 3575 | switch (aty_ld_le32(CNFG_CHIP_ID, par) & CFG_CHIP_TYPE) { |
| 3576 | case 0x00d7: | 3576 | case 0x00d7: |
| 3577 | par->pci_id = PCI_CHIP_MACH64GX; | 3577 | par->pci_id = PCI_CHIP_MACH64GX; |
| 3578 | break; | 3578 | break; |
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index d0f1a7fc2c9d..16bb7e3c0310 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
| @@ -1936,8 +1936,8 @@ static void fixup_memory_mappings(struct radeonfb_info *rinfo) | |||
| 1936 | OUTREG(CRTC_GEN_CNTL, save_crtc_gen_cntl | CRTC_DISP_REQ_EN_B); | 1936 | OUTREG(CRTC_GEN_CNTL, save_crtc_gen_cntl | CRTC_DISP_REQ_EN_B); |
| 1937 | mdelay(100); | 1937 | mdelay(100); |
| 1938 | 1938 | ||
| 1939 | aper_base = INREG(CONFIG_APER_0_BASE); | 1939 | aper_base = INREG(CNFG_APER_0_BASE); |
| 1940 | aper_size = INREG(CONFIG_APER_SIZE); | 1940 | aper_size = INREG(CNFG_APER_SIZE); |
| 1941 | 1941 | ||
| 1942 | #ifdef SET_MC_FB_FROM_APERTURE | 1942 | #ifdef SET_MC_FB_FROM_APERTURE |
| 1943 | /* Set framebuffer to be at the same address as set in PCI BAR */ | 1943 | /* Set framebuffer to be at the same address as set in PCI BAR */ |
| @@ -2024,11 +2024,11 @@ static void radeon_identify_vram(struct radeonfb_info *rinfo) | |||
| 2024 | ~CRTC_H_CUTOFF_ACTIVE_EN); | 2024 | ~CRTC_H_CUTOFF_ACTIVE_EN); |
| 2025 | } | 2025 | } |
| 2026 | } else { | 2026 | } else { |
| 2027 | tmp = INREG(CONFIG_MEMSIZE); | 2027 | tmp = INREG(CNFG_MEMSIZE); |
| 2028 | } | 2028 | } |
| 2029 | 2029 | ||
| 2030 | /* mem size is bits [28:0], mask off the rest */ | 2030 | /* mem size is bits [28:0], mask off the rest */ |
| 2031 | rinfo->video_ram = tmp & CONFIG_MEMSIZE_MASK; | 2031 | rinfo->video_ram = tmp & CNFG_MEMSIZE_MASK; |
| 2032 | 2032 | ||
| 2033 | /* | 2033 | /* |
| 2034 | * Hack to get around some busted production M6's | 2034 | * Hack to get around some busted production M6's |
| @@ -2228,7 +2228,7 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev, | |||
| 2228 | */ | 2228 | */ |
| 2229 | rinfo->errata = 0; | 2229 | rinfo->errata = 0; |
| 2230 | if (rinfo->family == CHIP_FAMILY_R300 && | 2230 | if (rinfo->family == CHIP_FAMILY_R300 && |
| 2231 | (INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) | 2231 | (INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) |
| 2232 | == CFG_ATI_REV_A11) | 2232 | == CFG_ATI_REV_A11) |
| 2233 | rinfo->errata |= CHIP_ERRATA_R300_CG; | 2233 | rinfo->errata |= CHIP_ERRATA_R300_CG; |
| 2234 | 2234 | ||
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c index 675abdafc2d8..c4ac2a032fcb 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/aty/radeon_pm.c | |||
| @@ -333,7 +333,7 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo) | |||
| 333 | if (!rinfo->has_CRTC2) { | 333 | if (!rinfo->has_CRTC2) { |
| 334 | tmp = INPLL(pllSCLK_CNTL); | 334 | tmp = INPLL(pllSCLK_CNTL); |
| 335 | 335 | ||
| 336 | if ((INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) > CFG_ATI_REV_A13) | 336 | if ((INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) > CFG_ATI_REV_A13) |
| 337 | tmp &= ~(SCLK_CNTL__FORCE_CP | SCLK_CNTL__FORCE_RB); | 337 | tmp &= ~(SCLK_CNTL__FORCE_CP | SCLK_CNTL__FORCE_RB); |
| 338 | tmp &= ~(SCLK_CNTL__FORCE_HDP | SCLK_CNTL__FORCE_DISP1 | | 338 | tmp &= ~(SCLK_CNTL__FORCE_HDP | SCLK_CNTL__FORCE_DISP1 | |
| 339 | SCLK_CNTL__FORCE_TOP | SCLK_CNTL__FORCE_SE | | 339 | SCLK_CNTL__FORCE_TOP | SCLK_CNTL__FORCE_SE | |
| @@ -468,9 +468,9 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo) | |||
| 468 | 468 | ||
| 469 | /*RAGE_6::A11 A12 A12N1 A13, RV250::A11 A12, R300*/ | 469 | /*RAGE_6::A11 A12 A12N1 A13, RV250::A11 A12, R300*/ |
| 470 | if ((rinfo->family == CHIP_FAMILY_RV250 && | 470 | if ((rinfo->family == CHIP_FAMILY_RV250 && |
| 471 | ((INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13)) || | 471 | ((INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13)) || |
| 472 | ((rinfo->family == CHIP_FAMILY_RV100) && | 472 | ((rinfo->family == CHIP_FAMILY_RV100) && |
| 473 | ((INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) <= CFG_ATI_REV_A13))) { | 473 | ((INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) <= CFG_ATI_REV_A13))) { |
| 474 | tmp |= SCLK_CNTL__FORCE_CP; | 474 | tmp |= SCLK_CNTL__FORCE_CP; |
| 475 | tmp |= SCLK_CNTL__FORCE_VIP; | 475 | tmp |= SCLK_CNTL__FORCE_VIP; |
| 476 | } | 476 | } |
| @@ -486,7 +486,7 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo) | |||
| 486 | /* RV200::A11 A12 RV250::A11 A12 */ | 486 | /* RV200::A11 A12 RV250::A11 A12 */ |
| 487 | if (((rinfo->family == CHIP_FAMILY_RV200) || | 487 | if (((rinfo->family == CHIP_FAMILY_RV200) || |
| 488 | (rinfo->family == CHIP_FAMILY_RV250)) && | 488 | (rinfo->family == CHIP_FAMILY_RV250)) && |
| 489 | ((INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13)) | 489 | ((INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13)) |
| 490 | tmp |= SCLK_MORE_CNTL__FORCEON; | 490 | tmp |= SCLK_MORE_CNTL__FORCEON; |
| 491 | 491 | ||
| 492 | OUTPLL(pllSCLK_MORE_CNTL, tmp); | 492 | OUTPLL(pllSCLK_MORE_CNTL, tmp); |
| @@ -497,7 +497,7 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo) | |||
| 497 | /* RV200::A11 A12, RV250::A11 A12 */ | 497 | /* RV200::A11 A12, RV250::A11 A12 */ |
| 498 | if (((rinfo->family == CHIP_FAMILY_RV200) || | 498 | if (((rinfo->family == CHIP_FAMILY_RV200) || |
| 499 | (rinfo->family == CHIP_FAMILY_RV250)) && | 499 | (rinfo->family == CHIP_FAMILY_RV250)) && |
| 500 | ((INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13)) { | 500 | ((INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13)) { |
| 501 | tmp = INPLL(pllPLL_PWRMGT_CNTL); | 501 | tmp = INPLL(pllPLL_PWRMGT_CNTL); |
| 502 | tmp |= PLL_PWRMGT_CNTL__TCL_BYPASS_DISABLE; | 502 | tmp |= PLL_PWRMGT_CNTL__TCL_BYPASS_DISABLE; |
| 503 | OUTPLL(pllPLL_PWRMGT_CNTL, tmp); | 503 | OUTPLL(pllPLL_PWRMGT_CNTL, tmp); |
| @@ -702,7 +702,7 @@ static void radeon_pm_restore_regs(struct radeonfb_info *rinfo) | |||
| 702 | OUTREG(DISPLAY_BASE_ADDR, rinfo->save_regs[31]); | 702 | OUTREG(DISPLAY_BASE_ADDR, rinfo->save_regs[31]); |
| 703 | OUTREG(MC_AGP_LOCATION, rinfo->save_regs[32]); | 703 | OUTREG(MC_AGP_LOCATION, rinfo->save_regs[32]); |
| 704 | OUTREG(CRTC2_DISPLAY_BASE_ADDR, rinfo->save_regs[33]); | 704 | OUTREG(CRTC2_DISPLAY_BASE_ADDR, rinfo->save_regs[33]); |
| 705 | OUTREG(CONFIG_MEMSIZE, rinfo->video_ram); | 705 | OUTREG(CNFG_MEMSIZE, rinfo->video_ram); |
| 706 | 706 | ||
| 707 | OUTREG(DISP_MISC_CNTL, rinfo->save_regs[9]); | 707 | OUTREG(DISP_MISC_CNTL, rinfo->save_regs[9]); |
| 708 | OUTREG(DISP_PWR_MAN, rinfo->save_regs[10]); | 708 | OUTREG(DISP_PWR_MAN, rinfo->save_regs[10]); |
| @@ -1723,7 +1723,7 @@ static void radeon_reinitialize_M10(struct radeonfb_info *rinfo) | |||
| 1723 | OUTREG(CRTC2_DISPLAY_BASE_ADDR, rinfo->save_regs[33]); | 1723 | OUTREG(CRTC2_DISPLAY_BASE_ADDR, rinfo->save_regs[33]); |
| 1724 | OUTREG(MC_FB_LOCATION, rinfo->save_regs[30]); | 1724 | OUTREG(MC_FB_LOCATION, rinfo->save_regs[30]); |
| 1725 | OUTREG(OV0_BASE_ADDR, rinfo->save_regs[80]); | 1725 | OUTREG(OV0_BASE_ADDR, rinfo->save_regs[80]); |
| 1726 | OUTREG(CONFIG_MEMSIZE, rinfo->video_ram); | 1726 | OUTREG(CNFG_MEMSIZE, rinfo->video_ram); |
| 1727 | OUTREG(BUS_CNTL, rinfo->save_regs[36]); | 1727 | OUTREG(BUS_CNTL, rinfo->save_regs[36]); |
| 1728 | OUTREG(BUS_CNTL1, rinfo->save_regs[14]); | 1728 | OUTREG(BUS_CNTL1, rinfo->save_regs[14]); |
| 1729 | OUTREG(MPP_TB_CONFIG, rinfo->save_regs[37]); | 1729 | OUTREG(MPP_TB_CONFIG, rinfo->save_regs[37]); |
| @@ -1961,7 +1961,7 @@ static void radeon_pm_m9p_reconfigure_mc(struct radeonfb_info *rinfo) | |||
| 1961 | OUTMC(rinfo, ixMC_CHP_IO_CNTL_B1, rinfo->save_regs[68] /*0x141555ff*/); | 1961 | OUTMC(rinfo, ixMC_CHP_IO_CNTL_B1, rinfo->save_regs[68] /*0x141555ff*/); |
| 1962 | OUTMC(rinfo, ixMC_IMP_CNTL_0, rinfo->save_regs[71] /*0x00009249*/); | 1962 | OUTMC(rinfo, ixMC_IMP_CNTL_0, rinfo->save_regs[71] /*0x00009249*/); |
| 1963 | OUTREG(MC_IND_INDEX, 0); | 1963 | OUTREG(MC_IND_INDEX, 0); |
| 1964 | OUTREG(CONFIG_MEMSIZE, rinfo->video_ram); | 1964 | OUTREG(CNFG_MEMSIZE, rinfo->video_ram); |
| 1965 | 1965 | ||
| 1966 | mdelay(20); | 1966 | mdelay(20); |
| 1967 | } | 1967 | } |
| @@ -2361,7 +2361,7 @@ static void radeon_reinitialize_QW(struct radeonfb_info *rinfo) | |||
| 2361 | OUTMC(rinfo, ixMC_IMP_CNTL_0, 0x00009249); | 2361 | OUTMC(rinfo, ixMC_IMP_CNTL_0, 0x00009249); |
| 2362 | OUTREG(MC_IND_INDEX, 0); | 2362 | OUTREG(MC_IND_INDEX, 0); |
| 2363 | 2363 | ||
| 2364 | OUTREG(CONFIG_MEMSIZE, rinfo->video_ram); | 2364 | OUTREG(CNFG_MEMSIZE, rinfo->video_ram); |
| 2365 | 2365 | ||
| 2366 | radeon_pm_full_reset_sdram(rinfo); | 2366 | radeon_pm_full_reset_sdram(rinfo); |
| 2367 | 2367 | ||
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index 363b3cb2f01b..63d759498165 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile | |||
| @@ -18,7 +18,7 @@ obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o | |||
| 18 | obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o | 18 | obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o |
| 19 | obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o | 19 | obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o |
| 20 | obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o | 20 | obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o |
| 21 | obj-$(CONFIG_BACKLIGHT_DA903X) += da903x.o | 21 | obj-$(CONFIG_BACKLIGHT_DA903X) += da903x_bl.o |
| 22 | obj-$(CONFIG_BACKLIGHT_MBP_NVIDIA) += mbp_nvidia_bl.o | 22 | obj-$(CONFIG_BACKLIGHT_MBP_NVIDIA) += mbp_nvidia_bl.o |
| 23 | obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o | 23 | obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o |
| 24 | obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o | 24 | obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o |
diff --git a/drivers/video/backlight/da903x.c b/drivers/video/backlight/da903x_bl.c index 93bb4340cc64..93bb4340cc64 100644 --- a/drivers/video/backlight/da903x.c +++ b/drivers/video/backlight/da903x_bl.c | |||
diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c index 91b78e691505..f53b9f1d6aba 100644 --- a/drivers/video/fbcmap.c +++ b/drivers/video/fbcmap.c | |||
| @@ -250,10 +250,6 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) | |||
| 250 | int rc, size = cmap->len * sizeof(u16); | 250 | int rc, size = cmap->len * sizeof(u16); |
| 251 | struct fb_cmap umap; | 251 | struct fb_cmap umap; |
| 252 | 252 | ||
| 253 | if (cmap->start < 0 || (!info->fbops->fb_setcolreg && | ||
| 254 | !info->fbops->fb_setcmap)) | ||
| 255 | return -EINVAL; | ||
| 256 | |||
| 257 | memset(&umap, 0, sizeof(struct fb_cmap)); | 253 | memset(&umap, 0, sizeof(struct fb_cmap)); |
| 258 | rc = fb_alloc_cmap(&umap, cmap->len, cmap->transp != NULL); | 254 | rc = fb_alloc_cmap(&umap, cmap->len, cmap->transp != NULL); |
| 259 | if (rc) | 255 | if (rc) |
| @@ -262,11 +258,23 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) | |||
| 262 | copy_from_user(umap.green, cmap->green, size) || | 258 | copy_from_user(umap.green, cmap->green, size) || |
| 263 | copy_from_user(umap.blue, cmap->blue, size) || | 259 | copy_from_user(umap.blue, cmap->blue, size) || |
| 264 | (cmap->transp && copy_from_user(umap.transp, cmap->transp, size))) { | 260 | (cmap->transp && copy_from_user(umap.transp, cmap->transp, size))) { |
| 265 | fb_dealloc_cmap(&umap); | 261 | rc = -EFAULT; |
| 266 | return -EFAULT; | 262 | goto out; |
| 267 | } | 263 | } |
| 268 | umap.start = cmap->start; | 264 | umap.start = cmap->start; |
| 265 | if (!lock_fb_info(info)) { | ||
| 266 | rc = -ENODEV; | ||
| 267 | goto out; | ||
| 268 | } | ||
| 269 | if (cmap->start < 0 || (!info->fbops->fb_setcolreg && | ||
| 270 | !info->fbops->fb_setcmap)) { | ||
| 271 | rc = -EINVAL; | ||
| 272 | goto out1; | ||
| 273 | } | ||
| 269 | rc = fb_set_cmap(&umap, info); | 274 | rc = fb_set_cmap(&umap, info); |
| 275 | out1: | ||
| 276 | unlock_fb_info(info); | ||
| 277 | out: | ||
| 270 | fb_dealloc_cmap(&umap); | 278 | fb_dealloc_cmap(&umap); |
| 271 | return rc; | 279 | return rc; |
| 272 | } | 280 | } |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 756efeb91abc..cfd9dce1ce0b 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
| @@ -1013,132 +1013,139 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
| 1013 | struct fb_var_screeninfo var; | 1013 | struct fb_var_screeninfo var; |
| 1014 | struct fb_fix_screeninfo fix; | 1014 | struct fb_fix_screeninfo fix; |
| 1015 | struct fb_con2fbmap con2fb; | 1015 | struct fb_con2fbmap con2fb; |
| 1016 | struct fb_cmap cmap_from; | ||
| 1016 | struct fb_cmap_user cmap; | 1017 | struct fb_cmap_user cmap; |
| 1017 | struct fb_event event; | 1018 | struct fb_event event; |
| 1018 | void __user *argp = (void __user *)arg; | 1019 | void __user *argp = (void __user *)arg; |
| 1019 | long ret = 0; | 1020 | long ret = 0; |
| 1020 | 1021 | ||
| 1021 | fb = info->fbops; | ||
| 1022 | if (!fb) | ||
| 1023 | return -ENODEV; | ||
| 1024 | |||
| 1025 | switch (cmd) { | 1022 | switch (cmd) { |
| 1026 | case FBIOGET_VSCREENINFO: | 1023 | case FBIOGET_VSCREENINFO: |
| 1027 | ret = copy_to_user(argp, &info->var, | 1024 | if (!lock_fb_info(info)) |
| 1028 | sizeof(var)) ? -EFAULT : 0; | 1025 | return -ENODEV; |
| 1026 | var = info->var; | ||
| 1027 | unlock_fb_info(info); | ||
| 1028 | |||
| 1029 | ret = copy_to_user(argp, &var, sizeof(var)) ? -EFAULT : 0; | ||
| 1029 | break; | 1030 | break; |
| 1030 | case FBIOPUT_VSCREENINFO: | 1031 | case FBIOPUT_VSCREENINFO: |
| 1031 | if (copy_from_user(&var, argp, sizeof(var))) { | 1032 | if (copy_from_user(&var, argp, sizeof(var))) |
| 1032 | ret = -EFAULT; | 1033 | return -EFAULT; |
| 1033 | break; | 1034 | if (!lock_fb_info(info)) |
| 1034 | } | 1035 | return -ENODEV; |
| 1035 | acquire_console_sem(); | 1036 | acquire_console_sem(); |
| 1036 | info->flags |= FBINFO_MISC_USEREVENT; | 1037 | info->flags |= FBINFO_MISC_USEREVENT; |
| 1037 | ret = fb_set_var(info, &var); | 1038 | ret = fb_set_var(info, &var); |
| 1038 | info->flags &= ~FBINFO_MISC_USEREVENT; | 1039 | info->flags &= ~FBINFO_MISC_USEREVENT; |
| 1039 | release_console_sem(); | 1040 | release_console_sem(); |
| 1040 | if (ret == 0 && copy_to_user(argp, &var, sizeof(var))) | 1041 | unlock_fb_info(info); |
| 1042 | if (!ret && copy_to_user(argp, &var, sizeof(var))) | ||
| 1041 | ret = -EFAULT; | 1043 | ret = -EFAULT; |
| 1042 | break; | 1044 | break; |
| 1043 | case FBIOGET_FSCREENINFO: | 1045 | case FBIOGET_FSCREENINFO: |
| 1044 | ret = copy_to_user(argp, &info->fix, | 1046 | if (!lock_fb_info(info)) |
| 1045 | sizeof(fix)) ? -EFAULT : 0; | 1047 | return -ENODEV; |
| 1048 | fix = info->fix; | ||
| 1049 | unlock_fb_info(info); | ||
| 1050 | |||
| 1051 | ret = copy_to_user(argp, &fix, sizeof(fix)) ? -EFAULT : 0; | ||
| 1046 | break; | 1052 | break; |
| 1047 | case FBIOPUTCMAP: | 1053 | case FBIOPUTCMAP: |
| 1048 | if (copy_from_user(&cmap, argp, sizeof(cmap))) | 1054 | if (copy_from_user(&cmap, argp, sizeof(cmap))) |
| 1049 | ret = -EFAULT; | 1055 | return -EFAULT; |
| 1050 | else | 1056 | ret = fb_set_user_cmap(&cmap, info); |
| 1051 | ret = fb_set_user_cmap(&cmap, info); | ||
| 1052 | break; | 1057 | break; |
| 1053 | case FBIOGETCMAP: | 1058 | case FBIOGETCMAP: |
| 1054 | if (copy_from_user(&cmap, argp, sizeof(cmap))) | 1059 | if (copy_from_user(&cmap, argp, sizeof(cmap))) |
| 1055 | ret = -EFAULT; | 1060 | return -EFAULT; |
| 1056 | else | 1061 | if (!lock_fb_info(info)) |
| 1057 | ret = fb_cmap_to_user(&info->cmap, &cmap); | 1062 | return -ENODEV; |
| 1063 | cmap_from = info->cmap; | ||
| 1064 | unlock_fb_info(info); | ||
| 1065 | ret = fb_cmap_to_user(&cmap_from, &cmap); | ||
| 1058 | break; | 1066 | break; |
| 1059 | case FBIOPAN_DISPLAY: | 1067 | case FBIOPAN_DISPLAY: |
| 1060 | if (copy_from_user(&var, argp, sizeof(var))) { | 1068 | if (copy_from_user(&var, argp, sizeof(var))) |
| 1061 | ret = -EFAULT; | 1069 | return -EFAULT; |
| 1062 | break; | 1070 | if (!lock_fb_info(info)) |
| 1063 | } | 1071 | return -ENODEV; |
| 1064 | acquire_console_sem(); | 1072 | acquire_console_sem(); |
| 1065 | ret = fb_pan_display(info, &var); | 1073 | ret = fb_pan_display(info, &var); |
| 1066 | release_console_sem(); | 1074 | release_console_sem(); |
| 1075 | unlock_fb_info(info); | ||
| 1067 | if (ret == 0 && copy_to_user(argp, &var, sizeof(var))) | 1076 | if (ret == 0 && copy_to_user(argp, &var, sizeof(var))) |
| 1068 | ret = -EFAULT; | 1077 | return -EFAULT; |
| 1069 | break; | 1078 | break; |
| 1070 | case FBIO_CURSOR: | 1079 | case FBIO_CURSOR: |
| 1071 | ret = -EINVAL; | 1080 | ret = -EINVAL; |
| 1072 | break; | 1081 | break; |
| 1073 | case FBIOGET_CON2FBMAP: | 1082 | case FBIOGET_CON2FBMAP: |
| 1074 | if (copy_from_user(&con2fb, argp, sizeof(con2fb))) | 1083 | if (copy_from_user(&con2fb, argp, sizeof(con2fb))) |
| 1075 | ret = -EFAULT; | 1084 | return -EFAULT; |
| 1076 | else if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) | 1085 | if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) |
| 1077 | ret = -EINVAL; | 1086 | return -EINVAL; |
| 1078 | else { | 1087 | con2fb.framebuffer = -1; |
| 1079 | con2fb.framebuffer = -1; | 1088 | event.data = &con2fb; |
| 1080 | event.info = info; | 1089 | |
| 1081 | event.data = &con2fb; | 1090 | if (!lock_fb_info(info)) |
| 1082 | fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, | 1091 | return -ENODEV; |
| 1083 | &event); | 1092 | event.info = info; |
| 1084 | ret = copy_to_user(argp, &con2fb, | 1093 | fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event); |
| 1085 | sizeof(con2fb)) ? -EFAULT : 0; | 1094 | unlock_fb_info(info); |
| 1086 | } | 1095 | |
| 1096 | ret = copy_to_user(argp, &con2fb, sizeof(con2fb)) ? -EFAULT : 0; | ||
| 1087 | break; | 1097 | break; |
| 1088 | case FBIOPUT_CON2FBMAP: | 1098 | case FBIOPUT_CON2FBMAP: |
| 1089 | if (copy_from_user(&con2fb, argp, sizeof(con2fb))) { | 1099 | if (copy_from_user(&con2fb, argp, sizeof(con2fb))) |
| 1090 | ret = -EFAULT; | 1100 | return -EFAULT; |
| 1091 | break; | 1101 | if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) |
| 1092 | } | 1102 | return -EINVAL; |
| 1093 | if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) { | 1103 | if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX) |
| 1094 | ret = -EINVAL; | 1104 | return -EINVAL; |
| 1095 | break; | ||
| 1096 | } | ||
| 1097 | if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX) { | ||
| 1098 | ret = -EINVAL; | ||
| 1099 | break; | ||
| 1100 | } | ||
| 1101 | if (!registered_fb[con2fb.framebuffer]) | 1105 | if (!registered_fb[con2fb.framebuffer]) |
| 1102 | request_module("fb%d", con2fb.framebuffer); | 1106 | request_module("fb%d", con2fb.framebuffer); |
| 1103 | if (!registered_fb[con2fb.framebuffer]) { | 1107 | if (!registered_fb[con2fb.framebuffer]) { |
| 1104 | ret = -EINVAL; | 1108 | ret = -EINVAL; |
| 1105 | break; | 1109 | break; |
| 1106 | } | 1110 | } |
| 1107 | event.info = info; | ||
| 1108 | event.data = &con2fb; | 1111 | event.data = &con2fb; |
| 1112 | if (!lock_fb_info(info)) | ||
| 1113 | return -ENODEV; | ||
| 1114 | event.info = info; | ||
| 1109 | ret = fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP, | 1115 | ret = fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP, |
| 1110 | &event); | 1116 | &event); |
| 1117 | unlock_fb_info(info); | ||
| 1111 | break; | 1118 | break; |
| 1112 | case FBIOBLANK: | 1119 | case FBIOBLANK: |
| 1120 | if (!lock_fb_info(info)) | ||
| 1121 | return -ENODEV; | ||
| 1113 | acquire_console_sem(); | 1122 | acquire_console_sem(); |
| 1114 | info->flags |= FBINFO_MISC_USEREVENT; | 1123 | info->flags |= FBINFO_MISC_USEREVENT; |
| 1115 | ret = fb_blank(info, arg); | 1124 | ret = fb_blank(info, arg); |
| 1116 | info->flags &= ~FBINFO_MISC_USEREVENT; | 1125 | info->flags &= ~FBINFO_MISC_USEREVENT; |
| 1117 | release_console_sem(); | 1126 | release_console_sem(); |
| 1118 | break;; | 1127 | unlock_fb_info(info); |
| 1128 | break; | ||
| 1119 | default: | 1129 | default: |
| 1120 | if (fb->fb_ioctl == NULL) | 1130 | if (!lock_fb_info(info)) |
| 1121 | ret = -ENOTTY; | 1131 | return -ENODEV; |
| 1122 | else | 1132 | fb = info->fbops; |
| 1133 | if (fb->fb_ioctl) | ||
| 1123 | ret = fb->fb_ioctl(info, cmd, arg); | 1134 | ret = fb->fb_ioctl(info, cmd, arg); |
| 1135 | else | ||
| 1136 | ret = -ENOTTY; | ||
| 1137 | unlock_fb_info(info); | ||
| 1124 | } | 1138 | } |
| 1125 | return ret; | 1139 | return ret; |
| 1126 | } | 1140 | } |
| 1127 | 1141 | ||
| 1128 | static long fb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 1142 | static long fb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
| 1129 | __acquires(&info->lock) | ||
| 1130 | __releases(&info->lock) | ||
| 1131 | { | 1143 | { |
| 1132 | struct inode *inode = file->f_path.dentry->d_inode; | 1144 | struct inode *inode = file->f_path.dentry->d_inode; |
| 1133 | int fbidx = iminor(inode); | 1145 | int fbidx = iminor(inode); |
| 1134 | struct fb_info *info; | 1146 | struct fb_info *info = registered_fb[fbidx]; |
| 1135 | long ret; | ||
| 1136 | 1147 | ||
| 1137 | info = registered_fb[fbidx]; | 1148 | return do_fb_ioctl(info, cmd, arg); |
| 1138 | mutex_lock(&info->lock); | ||
| 1139 | ret = do_fb_ioctl(info, cmd, arg); | ||
| 1140 | mutex_unlock(&info->lock); | ||
| 1141 | return ret; | ||
| 1142 | } | 1149 | } |
| 1143 | 1150 | ||
| 1144 | #ifdef CONFIG_COMPAT | 1151 | #ifdef CONFIG_COMPAT |
| @@ -1257,8 +1264,6 @@ static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd, | |||
| 1257 | 1264 | ||
| 1258 | static long fb_compat_ioctl(struct file *file, unsigned int cmd, | 1265 | static long fb_compat_ioctl(struct file *file, unsigned int cmd, |
| 1259 | unsigned long arg) | 1266 | unsigned long arg) |
| 1260 | __acquires(&info->lock) | ||
| 1261 | __releases(&info->lock) | ||
| 1262 | { | 1267 | { |
| 1263 | struct inode *inode = file->f_path.dentry->d_inode; | 1268 | struct inode *inode = file->f_path.dentry->d_inode; |
| 1264 | int fbidx = iminor(inode); | 1269 | int fbidx = iminor(inode); |
| @@ -1266,7 +1271,6 @@ __releases(&info->lock) | |||
| 1266 | struct fb_ops *fb = info->fbops; | 1271 | struct fb_ops *fb = info->fbops; |
| 1267 | long ret = -ENOIOCTLCMD; | 1272 | long ret = -ENOIOCTLCMD; |
| 1268 | 1273 | ||
| 1269 | mutex_lock(&info->lock); | ||
| 1270 | switch(cmd) { | 1274 | switch(cmd) { |
| 1271 | case FBIOGET_VSCREENINFO: | 1275 | case FBIOGET_VSCREENINFO: |
| 1272 | case FBIOPUT_VSCREENINFO: | 1276 | case FBIOPUT_VSCREENINFO: |
| @@ -1292,7 +1296,6 @@ __releases(&info->lock) | |||
| 1292 | ret = fb->fb_compat_ioctl(info, cmd, arg); | 1296 | ret = fb->fb_compat_ioctl(info, cmd, arg); |
| 1293 | break; | 1297 | break; |
| 1294 | } | 1298 | } |
| 1295 | mutex_unlock(&info->lock); | ||
| 1296 | return ret; | 1299 | return ret; |
| 1297 | } | 1300 | } |
| 1298 | #endif | 1301 | #endif |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index e3ff2b9e602f..33b7235f853b 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
| @@ -1208,9 +1208,11 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma, | |||
| 1208 | * check for an ELF header. If we find one, dump the first page to | 1208 | * check for an ELF header. If we find one, dump the first page to |
| 1209 | * aid in determining what was mapped here. | 1209 | * aid in determining what was mapped here. |
| 1210 | */ | 1210 | */ |
| 1211 | if (FILTER(ELF_HEADERS) && vma->vm_file != NULL && vma->vm_pgoff == 0) { | 1211 | if (FILTER(ELF_HEADERS) && |
| 1212 | vma->vm_pgoff == 0 && (vma->vm_flags & VM_READ)) { | ||
| 1212 | u32 __user *header = (u32 __user *) vma->vm_start; | 1213 | u32 __user *header = (u32 __user *) vma->vm_start; |
| 1213 | u32 word; | 1214 | u32 word; |
| 1215 | mm_segment_t fs = get_fs(); | ||
| 1214 | /* | 1216 | /* |
| 1215 | * Doing it this way gets the constant folded by GCC. | 1217 | * Doing it this way gets the constant folded by GCC. |
| 1216 | */ | 1218 | */ |
| @@ -1223,7 +1225,15 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma, | |||
| 1223 | magic.elfmag[EI_MAG1] = ELFMAG1; | 1225 | magic.elfmag[EI_MAG1] = ELFMAG1; |
| 1224 | magic.elfmag[EI_MAG2] = ELFMAG2; | 1226 | magic.elfmag[EI_MAG2] = ELFMAG2; |
| 1225 | magic.elfmag[EI_MAG3] = ELFMAG3; | 1227 | magic.elfmag[EI_MAG3] = ELFMAG3; |
| 1226 | if (get_user(word, header) == 0 && word == magic.cmp) | 1228 | /* |
| 1229 | * Switch to the user "segment" for get_user(), | ||
| 1230 | * then put back what elf_core_dump() had in place. | ||
| 1231 | */ | ||
| 1232 | set_fs(USER_DS); | ||
| 1233 | if (unlikely(get_user(word, header))) | ||
| 1234 | word = 0; | ||
| 1235 | set_fs(fs); | ||
| 1236 | if (word == magic.cmp) | ||
| 1227 | return PAGE_SIZE; | 1237 | return PAGE_SIZE; |
| 1228 | } | 1238 | } |
| 1229 | 1239 | ||
diff --git a/fs/btrfs/Kconfig b/fs/btrfs/Kconfig index f8fcf999ea1b..7bb3c020e570 100644 --- a/fs/btrfs/Kconfig +++ b/fs/btrfs/Kconfig | |||
| @@ -16,3 +16,16 @@ config BTRFS_FS | |||
| 16 | module will be called btrfs. | 16 | module will be called btrfs. |
| 17 | 17 | ||
| 18 | If unsure, say N. | 18 | If unsure, say N. |
| 19 | |||
| 20 | config BTRFS_FS_POSIX_ACL | ||
| 21 | bool "Btrfs POSIX Access Control Lists" | ||
| 22 | depends on BTRFS_FS | ||
| 23 | select FS_POSIX_ACL | ||
| 24 | help | ||
| 25 | POSIX Access Control Lists (ACLs) support permissions for users and | ||
| 26 | groups beyond the owner/group/world scheme. | ||
| 27 | |||
| 28 | To learn more about Access Control Lists, visit the POSIX ACLs for | ||
| 29 | Linux website <http://acl.bestbits.at/>. | ||
| 30 | |||
| 31 | If you don't know what Access Control Lists are, say N | ||
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index 8e2fec05dbe0..c84ca1f5259a 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c | |||
| @@ -16,11 +16,11 @@ | |||
| 16 | * Boston, MA 021110-1307, USA. | 16 | * Boston, MA 021110-1307, USA. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #include <linux/version.h> | ||
| 20 | #include <linux/kthread.h> | 19 | #include <linux/kthread.h> |
| 21 | #include <linux/list.h> | 20 | #include <linux/list.h> |
| 22 | #include <linux/spinlock.h> | 21 | #include <linux/spinlock.h> |
| 23 | # include <linux/freezer.h> | 22 | #include <linux/freezer.h> |
| 23 | #include <linux/ftrace.h> | ||
| 24 | #include "async-thread.h" | 24 | #include "async-thread.h" |
| 25 | 25 | ||
| 26 | #define WORK_QUEUED_BIT 0 | 26 | #define WORK_QUEUED_BIT 0 |
| @@ -143,6 +143,7 @@ static int worker_loop(void *arg) | |||
| 143 | struct btrfs_work *work; | 143 | struct btrfs_work *work; |
| 144 | do { | 144 | do { |
| 145 | spin_lock_irq(&worker->lock); | 145 | spin_lock_irq(&worker->lock); |
| 146 | again_locked: | ||
| 146 | while (!list_empty(&worker->pending)) { | 147 | while (!list_empty(&worker->pending)) { |
| 147 | cur = worker->pending.next; | 148 | cur = worker->pending.next; |
| 148 | work = list_entry(cur, struct btrfs_work, list); | 149 | work = list_entry(cur, struct btrfs_work, list); |
| @@ -165,14 +166,50 @@ static int worker_loop(void *arg) | |||
| 165 | check_idle_worker(worker); | 166 | check_idle_worker(worker); |
| 166 | 167 | ||
| 167 | } | 168 | } |
| 168 | worker->working = 0; | ||
| 169 | if (freezing(current)) { | 169 | if (freezing(current)) { |
| 170 | worker->working = 0; | ||
| 171 | spin_unlock_irq(&worker->lock); | ||
| 170 | refrigerator(); | 172 | refrigerator(); |
| 171 | } else { | 173 | } else { |
| 172 | set_current_state(TASK_INTERRUPTIBLE); | ||
| 173 | spin_unlock_irq(&worker->lock); | 174 | spin_unlock_irq(&worker->lock); |
| 174 | if (!kthread_should_stop()) | 175 | if (!kthread_should_stop()) { |
| 176 | cpu_relax(); | ||
| 177 | /* | ||
| 178 | * we've dropped the lock, did someone else | ||
| 179 | * jump_in? | ||
| 180 | */ | ||
| 181 | smp_mb(); | ||
| 182 | if (!list_empty(&worker->pending)) | ||
| 183 | continue; | ||
| 184 | |||
| 185 | /* | ||
| 186 | * this short schedule allows more work to | ||
| 187 | * come in without the queue functions | ||
| 188 | * needing to go through wake_up_process() | ||
| 189 | * | ||
| 190 | * worker->working is still 1, so nobody | ||
| 191 | * is going to try and wake us up | ||
| 192 | */ | ||
| 193 | schedule_timeout(1); | ||
| 194 | smp_mb(); | ||
| 195 | if (!list_empty(&worker->pending)) | ||
| 196 | continue; | ||
| 197 | |||
| 198 | /* still no more work?, sleep for real */ | ||
| 199 | spin_lock_irq(&worker->lock); | ||
| 200 | set_current_state(TASK_INTERRUPTIBLE); | ||
| 201 | if (!list_empty(&worker->pending)) | ||
| 202 | goto again_locked; | ||
| 203 | |||
| 204 | /* | ||
| 205 | * this makes sure we get a wakeup when someone | ||
| 206 | * adds something new to the queue | ||
| 207 | */ | ||
| 208 | worker->working = 0; | ||
| 209 | spin_unlock_irq(&worker->lock); | ||
| 210 | |||
| 175 | schedule(); | 211 | schedule(); |
| 212 | } | ||
| 176 | __set_current_state(TASK_RUNNING); | 213 | __set_current_state(TASK_RUNNING); |
| 177 | } | 214 | } |
| 178 | } while (!kthread_should_stop()); | 215 | } while (!kthread_should_stop()); |
| @@ -350,13 +387,14 @@ int btrfs_requeue_work(struct btrfs_work *work) | |||
| 350 | { | 387 | { |
| 351 | struct btrfs_worker_thread *worker = work->worker; | 388 | struct btrfs_worker_thread *worker = work->worker; |
| 352 | unsigned long flags; | 389 | unsigned long flags; |
| 390 | int wake = 0; | ||
| 353 | 391 | ||
| 354 | if (test_and_set_bit(WORK_QUEUED_BIT, &work->flags)) | 392 | if (test_and_set_bit(WORK_QUEUED_BIT, &work->flags)) |
| 355 | goto out; | 393 | goto out; |
| 356 | 394 | ||
| 357 | spin_lock_irqsave(&worker->lock, flags); | 395 | spin_lock_irqsave(&worker->lock, flags); |
| 358 | atomic_inc(&worker->num_pending); | ||
| 359 | list_add_tail(&work->list, &worker->pending); | 396 | list_add_tail(&work->list, &worker->pending); |
| 397 | atomic_inc(&worker->num_pending); | ||
| 360 | 398 | ||
| 361 | /* by definition we're busy, take ourselves off the idle | 399 | /* by definition we're busy, take ourselves off the idle |
| 362 | * list | 400 | * list |
| @@ -368,10 +406,16 @@ int btrfs_requeue_work(struct btrfs_work *work) | |||
| 368 | &worker->workers->worker_list); | 406 | &worker->workers->worker_list); |
| 369 | spin_unlock_irqrestore(&worker->workers->lock, flags); | 407 | spin_unlock_irqrestore(&worker->workers->lock, flags); |
| 370 | } | 408 | } |
| 409 | if (!worker->working) { | ||
| 410 | wake = 1; | ||
| 411 | worker->working = 1; | ||
| 412 | } | ||
| 371 | 413 | ||
| 372 | spin_unlock_irqrestore(&worker->lock, flags); | 414 | spin_unlock_irqrestore(&worker->lock, flags); |
| 373 | 415 | if (wake) | |
| 416 | wake_up_process(worker->task); | ||
| 374 | out: | 417 | out: |
| 418 | |||
| 375 | return 0; | 419 | return 0; |
| 376 | } | 420 | } |
| 377 | 421 | ||
| @@ -398,9 +442,10 @@ int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work) | |||
| 398 | } | 442 | } |
| 399 | 443 | ||
| 400 | spin_lock_irqsave(&worker->lock, flags); | 444 | spin_lock_irqsave(&worker->lock, flags); |
| 445 | |||
| 446 | list_add_tail(&work->list, &worker->pending); | ||
| 401 | atomic_inc(&worker->num_pending); | 447 | atomic_inc(&worker->num_pending); |
| 402 | check_busy_worker(worker); | 448 | check_busy_worker(worker); |
| 403 | list_add_tail(&work->list, &worker->pending); | ||
| 404 | 449 | ||
| 405 | /* | 450 | /* |
| 406 | * avoid calling into wake_up_process if this thread has already | 451 | * avoid calling into wake_up_process if this thread has already |
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index ee848d8585d9..ab07627084f1 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
| @@ -32,7 +32,6 @@ | |||
| 32 | #include <linux/swap.h> | 32 | #include <linux/swap.h> |
| 33 | #include <linux/writeback.h> | 33 | #include <linux/writeback.h> |
| 34 | #include <linux/bit_spinlock.h> | 34 | #include <linux/bit_spinlock.h> |
| 35 | #include <linux/version.h> | ||
| 36 | #include <linux/pagevec.h> | 35 | #include <linux/pagevec.h> |
| 37 | #include "compat.h" | 36 | #include "compat.h" |
| 38 | #include "ctree.h" | 37 | #include "ctree.h" |
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 9e46c0776816..551177c0011a 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
| @@ -54,6 +54,31 @@ struct btrfs_path *btrfs_alloc_path(void) | |||
| 54 | return path; | 54 | return path; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | /* | ||
| 58 | * set all locked nodes in the path to blocking locks. This should | ||
| 59 | * be done before scheduling | ||
| 60 | */ | ||
| 61 | noinline void btrfs_set_path_blocking(struct btrfs_path *p) | ||
| 62 | { | ||
| 63 | int i; | ||
| 64 | for (i = 0; i < BTRFS_MAX_LEVEL; i++) { | ||
| 65 | if (p->nodes[i] && p->locks[i]) | ||
| 66 | btrfs_set_lock_blocking(p->nodes[i]); | ||
| 67 | } | ||
| 68 | } | ||
| 69 | |||
| 70 | /* | ||
| 71 | * reset all the locked nodes in the patch to spinning locks. | ||
| 72 | */ | ||
| 73 | noinline void btrfs_clear_path_blocking(struct btrfs_path *p) | ||
| 74 | { | ||
| 75 | int i; | ||
| 76 | for (i = 0; i < BTRFS_MAX_LEVEL; i++) { | ||
| 77 | if (p->nodes[i] && p->locks[i]) | ||
| 78 | btrfs_clear_lock_blocking(p->nodes[i]); | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 57 | /* this also releases the path */ | 82 | /* this also releases the path */ |
| 58 | void btrfs_free_path(struct btrfs_path *p) | 83 | void btrfs_free_path(struct btrfs_path *p) |
| 59 | { | 84 | { |
| @@ -272,6 +297,8 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, | |||
| 272 | if (IS_ERR(cow)) | 297 | if (IS_ERR(cow)) |
| 273 | return PTR_ERR(cow); | 298 | return PTR_ERR(cow); |
| 274 | 299 | ||
| 300 | /* cow is set to blocking by btrfs_init_new_buffer */ | ||
| 301 | |||
| 275 | copy_extent_buffer(cow, buf, 0, 0, cow->len); | 302 | copy_extent_buffer(cow, buf, 0, 0, cow->len); |
| 276 | btrfs_set_header_bytenr(cow, cow->start); | 303 | btrfs_set_header_bytenr(cow, cow->start); |
| 277 | btrfs_set_header_generation(cow, trans->transid); | 304 | btrfs_set_header_generation(cow, trans->transid); |
| @@ -388,17 +415,20 @@ noinline int btrfs_cow_block(struct btrfs_trans_handle *trans, | |||
| 388 | WARN_ON(1); | 415 | WARN_ON(1); |
| 389 | } | 416 | } |
| 390 | 417 | ||
| 391 | spin_lock(&root->fs_info->hash_lock); | ||
| 392 | if (btrfs_header_generation(buf) == trans->transid && | 418 | if (btrfs_header_generation(buf) == trans->transid && |
| 393 | btrfs_header_owner(buf) == root->root_key.objectid && | 419 | btrfs_header_owner(buf) == root->root_key.objectid && |
| 394 | !btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN)) { | 420 | !btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN)) { |
| 395 | *cow_ret = buf; | 421 | *cow_ret = buf; |
| 396 | spin_unlock(&root->fs_info->hash_lock); | ||
| 397 | WARN_ON(prealloc_dest); | 422 | WARN_ON(prealloc_dest); |
| 398 | return 0; | 423 | return 0; |
| 399 | } | 424 | } |
| 400 | spin_unlock(&root->fs_info->hash_lock); | 425 | |
| 401 | search_start = buf->start & ~((u64)(1024 * 1024 * 1024) - 1); | 426 | search_start = buf->start & ~((u64)(1024 * 1024 * 1024) - 1); |
| 427 | |||
| 428 | if (parent) | ||
| 429 | btrfs_set_lock_blocking(parent); | ||
| 430 | btrfs_set_lock_blocking(buf); | ||
| 431 | |||
| 402 | ret = __btrfs_cow_block(trans, root, buf, parent, | 432 | ret = __btrfs_cow_block(trans, root, buf, parent, |
| 403 | parent_slot, cow_ret, search_start, 0, | 433 | parent_slot, cow_ret, search_start, 0, |
| 404 | prealloc_dest); | 434 | prealloc_dest); |
| @@ -504,6 +534,8 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, | |||
| 504 | if (parent_nritems == 1) | 534 | if (parent_nritems == 1) |
| 505 | return 0; | 535 | return 0; |
| 506 | 536 | ||
| 537 | btrfs_set_lock_blocking(parent); | ||
| 538 | |||
| 507 | for (i = start_slot; i < end_slot; i++) { | 539 | for (i = start_slot; i < end_slot; i++) { |
| 508 | int close = 1; | 540 | int close = 1; |
| 509 | 541 | ||
| @@ -564,6 +596,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, | |||
| 564 | search_start = last_block; | 596 | search_start = last_block; |
| 565 | 597 | ||
| 566 | btrfs_tree_lock(cur); | 598 | btrfs_tree_lock(cur); |
| 599 | btrfs_set_lock_blocking(cur); | ||
| 567 | err = __btrfs_cow_block(trans, root, cur, parent, i, | 600 | err = __btrfs_cow_block(trans, root, cur, parent, i, |
| 568 | &cur, search_start, | 601 | &cur, search_start, |
| 569 | min(16 * blocksize, | 602 | min(16 * blocksize, |
| @@ -862,6 +895,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, | |||
| 862 | return 0; | 895 | return 0; |
| 863 | 896 | ||
| 864 | mid = path->nodes[level]; | 897 | mid = path->nodes[level]; |
| 898 | |||
| 865 | WARN_ON(!path->locks[level]); | 899 | WARN_ON(!path->locks[level]); |
| 866 | WARN_ON(btrfs_header_generation(mid) != trans->transid); | 900 | WARN_ON(btrfs_header_generation(mid) != trans->transid); |
| 867 | 901 | ||
| @@ -884,6 +918,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, | |||
| 884 | /* promote the child to a root */ | 918 | /* promote the child to a root */ |
| 885 | child = read_node_slot(root, mid, 0); | 919 | child = read_node_slot(root, mid, 0); |
| 886 | btrfs_tree_lock(child); | 920 | btrfs_tree_lock(child); |
| 921 | btrfs_set_lock_blocking(child); | ||
| 887 | BUG_ON(!child); | 922 | BUG_ON(!child); |
| 888 | ret = btrfs_cow_block(trans, root, child, mid, 0, &child, 0); | 923 | ret = btrfs_cow_block(trans, root, child, mid, 0, &child, 0); |
| 889 | BUG_ON(ret); | 924 | BUG_ON(ret); |
| @@ -900,6 +935,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, | |||
| 900 | 935 | ||
| 901 | add_root_to_dirty_list(root); | 936 | add_root_to_dirty_list(root); |
| 902 | btrfs_tree_unlock(child); | 937 | btrfs_tree_unlock(child); |
| 938 | |||
| 903 | path->locks[level] = 0; | 939 | path->locks[level] = 0; |
| 904 | path->nodes[level] = NULL; | 940 | path->nodes[level] = NULL; |
| 905 | clean_tree_block(trans, root, mid); | 941 | clean_tree_block(trans, root, mid); |
| @@ -924,6 +960,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, | |||
| 924 | left = read_node_slot(root, parent, pslot - 1); | 960 | left = read_node_slot(root, parent, pslot - 1); |
| 925 | if (left) { | 961 | if (left) { |
| 926 | btrfs_tree_lock(left); | 962 | btrfs_tree_lock(left); |
| 963 | btrfs_set_lock_blocking(left); | ||
| 927 | wret = btrfs_cow_block(trans, root, left, | 964 | wret = btrfs_cow_block(trans, root, left, |
| 928 | parent, pslot - 1, &left, 0); | 965 | parent, pslot - 1, &left, 0); |
| 929 | if (wret) { | 966 | if (wret) { |
| @@ -934,6 +971,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, | |||
| 934 | right = read_node_slot(root, parent, pslot + 1); | 971 | right = read_node_slot(root, parent, pslot + 1); |
| 935 | if (right) { | 972 | if (right) { |
| 936 | btrfs_tree_lock(right); | 973 | btrfs_tree_lock(right); |
| 974 | btrfs_set_lock_blocking(right); | ||
| 937 | wret = btrfs_cow_block(trans, root, right, | 975 | wret = btrfs_cow_block(trans, root, right, |
| 938 | parent, pslot + 1, &right, 0); | 976 | parent, pslot + 1, &right, 0); |
| 939 | if (wret) { | 977 | if (wret) { |
| @@ -1109,6 +1147,8 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans, | |||
| 1109 | u32 left_nr; | 1147 | u32 left_nr; |
| 1110 | 1148 | ||
| 1111 | btrfs_tree_lock(left); | 1149 | btrfs_tree_lock(left); |
| 1150 | btrfs_set_lock_blocking(left); | ||
| 1151 | |||
| 1112 | left_nr = btrfs_header_nritems(left); | 1152 | left_nr = btrfs_header_nritems(left); |
| 1113 | if (left_nr >= BTRFS_NODEPTRS_PER_BLOCK(root) - 1) { | 1153 | if (left_nr >= BTRFS_NODEPTRS_PER_BLOCK(root) - 1) { |
| 1114 | wret = 1; | 1154 | wret = 1; |
| @@ -1155,7 +1195,10 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans, | |||
| 1155 | */ | 1195 | */ |
| 1156 | if (right) { | 1196 | if (right) { |
| 1157 | u32 right_nr; | 1197 | u32 right_nr; |
| 1198 | |||
| 1158 | btrfs_tree_lock(right); | 1199 | btrfs_tree_lock(right); |
| 1200 | btrfs_set_lock_blocking(right); | ||
| 1201 | |||
| 1159 | right_nr = btrfs_header_nritems(right); | 1202 | right_nr = btrfs_header_nritems(right); |
| 1160 | if (right_nr >= BTRFS_NODEPTRS_PER_BLOCK(root) - 1) { | 1203 | if (right_nr >= BTRFS_NODEPTRS_PER_BLOCK(root) - 1) { |
| 1161 | wret = 1; | 1204 | wret = 1; |
| @@ -1210,8 +1253,7 @@ static noinline void reada_for_search(struct btrfs_root *root, | |||
| 1210 | struct btrfs_disk_key disk_key; | 1253 | struct btrfs_disk_key disk_key; |
| 1211 | u32 nritems; | 1254 | u32 nritems; |
| 1212 | u64 search; | 1255 | u64 search; |
| 1213 | u64 lowest_read; | 1256 | u64 target; |
| 1214 | u64 highest_read; | ||
| 1215 | u64 nread = 0; | 1257 | u64 nread = 0; |
| 1216 | int direction = path->reada; | 1258 | int direction = path->reada; |
| 1217 | struct extent_buffer *eb; | 1259 | struct extent_buffer *eb; |
| @@ -1235,8 +1277,7 @@ static noinline void reada_for_search(struct btrfs_root *root, | |||
| 1235 | return; | 1277 | return; |
| 1236 | } | 1278 | } |
| 1237 | 1279 | ||
| 1238 | highest_read = search; | 1280 | target = search; |
| 1239 | lowest_read = search; | ||
| 1240 | 1281 | ||
| 1241 | nritems = btrfs_header_nritems(node); | 1282 | nritems = btrfs_header_nritems(node); |
| 1242 | nr = slot; | 1283 | nr = slot; |
| @@ -1256,27 +1297,80 @@ static noinline void reada_for_search(struct btrfs_root *root, | |||
| 1256 | break; | 1297 | break; |
| 1257 | } | 1298 | } |
| 1258 | search = btrfs_node_blockptr(node, nr); | 1299 | search = btrfs_node_blockptr(node, nr); |
| 1259 | if ((search >= lowest_read && search <= highest_read) || | 1300 | if ((search <= target && target - search <= 65536) || |
| 1260 | (search < lowest_read && lowest_read - search <= 16384) || | 1301 | (search > target && search - target <= 65536)) { |
| 1261 | (search > highest_read && search - highest_read <= 16384)) { | ||
| 1262 | readahead_tree_block(root, search, blocksize, | 1302 | readahead_tree_block(root, search, blocksize, |
| 1263 | btrfs_node_ptr_generation(node, nr)); | 1303 | btrfs_node_ptr_generation(node, nr)); |
| 1264 | nread += blocksize; | 1304 | nread += blocksize; |
| 1265 | } | 1305 | } |
| 1266 | nscan++; | 1306 | nscan++; |
| 1267 | if (path->reada < 2 && (nread > (64 * 1024) || nscan > 32)) | 1307 | if ((nread > 65536 || nscan > 32)) |
| 1268 | break; | 1308 | break; |
| 1309 | } | ||
| 1310 | } | ||
| 1269 | 1311 | ||
| 1270 | if (nread > (256 * 1024) || nscan > 128) | 1312 | /* |
| 1271 | break; | 1313 | * returns -EAGAIN if it had to drop the path, or zero if everything was in |
| 1314 | * cache | ||
| 1315 | */ | ||
| 1316 | static noinline int reada_for_balance(struct btrfs_root *root, | ||
| 1317 | struct btrfs_path *path, int level) | ||
| 1318 | { | ||
| 1319 | int slot; | ||
| 1320 | int nritems; | ||
| 1321 | struct extent_buffer *parent; | ||
| 1322 | struct extent_buffer *eb; | ||
| 1323 | u64 gen; | ||
| 1324 | u64 block1 = 0; | ||
| 1325 | u64 block2 = 0; | ||
| 1326 | int ret = 0; | ||
| 1327 | int blocksize; | ||
| 1272 | 1328 | ||
| 1273 | if (search < lowest_read) | 1329 | parent = path->nodes[level - 1]; |
| 1274 | lowest_read = search; | 1330 | if (!parent) |
| 1275 | if (search > highest_read) | 1331 | return 0; |
| 1276 | highest_read = search; | 1332 | |
| 1333 | nritems = btrfs_header_nritems(parent); | ||
| 1334 | slot = path->slots[level]; | ||
| 1335 | blocksize = btrfs_level_size(root, level); | ||
| 1336 | |||
| 1337 | if (slot > 0) { | ||
| 1338 | block1 = btrfs_node_blockptr(parent, slot - 1); | ||
| 1339 | gen = btrfs_node_ptr_generation(parent, slot - 1); | ||
| 1340 | eb = btrfs_find_tree_block(root, block1, blocksize); | ||
| 1341 | if (eb && btrfs_buffer_uptodate(eb, gen)) | ||
| 1342 | block1 = 0; | ||
| 1343 | free_extent_buffer(eb); | ||
| 1344 | } | ||
| 1345 | if (slot < nritems) { | ||
| 1346 | block2 = btrfs_node_blockptr(parent, slot + 1); | ||
| 1347 | gen = btrfs_node_ptr_generation(parent, slot + 1); | ||
| 1348 | eb = btrfs_find_tree_block(root, block2, blocksize); | ||
| 1349 | if (eb && btrfs_buffer_uptodate(eb, gen)) | ||
| 1350 | block2 = 0; | ||
| 1351 | free_extent_buffer(eb); | ||
| 1352 | } | ||
| 1353 | if (block1 || block2) { | ||
| 1354 | ret = -EAGAIN; | ||
| 1355 | btrfs_release_path(root, path); | ||
| 1356 | if (block1) | ||
| 1357 | readahead_tree_block(root, block1, blocksize, 0); | ||
| 1358 | if (block2) | ||
| 1359 | readahead_tree_block(root, block2, blocksize, 0); | ||
| 1360 | |||
| 1361 | if (block1) { | ||
| 1362 | eb = read_tree_block(root, block1, blocksize, 0); | ||
| 1363 | free_extent_buffer(eb); | ||
| 1364 | } | ||
| 1365 | if (block1) { | ||
| 1366 | eb = read_tree_block(root, block2, blocksize, 0); | ||
| 1367 | free_extent_buffer(eb); | ||
| 1368 | } | ||
| 1277 | } | 1369 | } |
| 1370 | return ret; | ||
| 1278 | } | 1371 | } |
| 1279 | 1372 | ||
| 1373 | |||
| 1280 | /* | 1374 | /* |
| 1281 | * when we walk down the tree, it is usually safe to unlock the higher layers | 1375 | * when we walk down the tree, it is usually safe to unlock the higher layers |
| 1282 | * in the tree. The exceptions are when our path goes through slot 0, because | 1376 | * in the tree. The exceptions are when our path goes through slot 0, because |
| @@ -1328,6 +1422,32 @@ static noinline void unlock_up(struct btrfs_path *path, int level, | |||
| 1328 | } | 1422 | } |
| 1329 | 1423 | ||
| 1330 | /* | 1424 | /* |
| 1425 | * This releases any locks held in the path starting at level and | ||
| 1426 | * going all the way up to the root. | ||
| 1427 | * | ||
| 1428 | * btrfs_search_slot will keep the lock held on higher nodes in a few | ||
| 1429 | * corner cases, such as COW of the block at slot zero in the node. This | ||
| 1430 | * ignores those rules, and it should only be called when there are no | ||
| 1431 | * more updates to be done higher up in the tree. | ||
| 1432 | */ | ||
| 1433 | noinline void btrfs_unlock_up_safe(struct btrfs_path *path, int level) | ||
| 1434 | { | ||
| 1435 | int i; | ||
| 1436 | |||
| 1437 | if (path->keep_locks || path->lowest_level) | ||
| 1438 | return; | ||
| 1439 | |||
| 1440 | for (i = level; i < BTRFS_MAX_LEVEL; i++) { | ||
| 1441 | if (!path->nodes[i]) | ||
| 1442 | continue; | ||
| 1443 | if (!path->locks[i]) | ||
| 1444 | continue; | ||
| 1445 | btrfs_tree_unlock(path->nodes[i]); | ||
| 1446 | path->locks[i] = 0; | ||
| 1447 | } | ||
| 1448 | } | ||
| 1449 | |||
| 1450 | /* | ||
| 1331 | * look for key in the tree. path is filled in with nodes along the way | 1451 | * look for key in the tree. path is filled in with nodes along the way |
| 1332 | * if key is found, we return zero and you can find the item in the leaf | 1452 | * if key is found, we return zero and you can find the item in the leaf |
| 1333 | * level of the path (level 0) | 1453 | * level of the path (level 0) |
| @@ -1387,31 +1507,30 @@ again: | |||
| 1387 | int wret; | 1507 | int wret; |
| 1388 | 1508 | ||
| 1389 | /* is a cow on this block not required */ | 1509 | /* is a cow on this block not required */ |
| 1390 | spin_lock(&root->fs_info->hash_lock); | ||
| 1391 | if (btrfs_header_generation(b) == trans->transid && | 1510 | if (btrfs_header_generation(b) == trans->transid && |
| 1392 | btrfs_header_owner(b) == root->root_key.objectid && | 1511 | btrfs_header_owner(b) == root->root_key.objectid && |
| 1393 | !btrfs_header_flag(b, BTRFS_HEADER_FLAG_WRITTEN)) { | 1512 | !btrfs_header_flag(b, BTRFS_HEADER_FLAG_WRITTEN)) { |
| 1394 | spin_unlock(&root->fs_info->hash_lock); | ||
| 1395 | goto cow_done; | 1513 | goto cow_done; |
| 1396 | } | 1514 | } |
| 1397 | spin_unlock(&root->fs_info->hash_lock); | ||
| 1398 | 1515 | ||
| 1399 | /* ok, we have to cow, is our old prealloc the right | 1516 | /* ok, we have to cow, is our old prealloc the right |
| 1400 | * size? | 1517 | * size? |
| 1401 | */ | 1518 | */ |
| 1402 | if (prealloc_block.objectid && | 1519 | if (prealloc_block.objectid && |
| 1403 | prealloc_block.offset != b->len) { | 1520 | prealloc_block.offset != b->len) { |
| 1521 | btrfs_release_path(root, p); | ||
| 1404 | btrfs_free_reserved_extent(root, | 1522 | btrfs_free_reserved_extent(root, |
| 1405 | prealloc_block.objectid, | 1523 | prealloc_block.objectid, |
| 1406 | prealloc_block.offset); | 1524 | prealloc_block.offset); |
| 1407 | prealloc_block.objectid = 0; | 1525 | prealloc_block.objectid = 0; |
| 1526 | goto again; | ||
| 1408 | } | 1527 | } |
| 1409 | 1528 | ||
| 1410 | /* | 1529 | /* |
| 1411 | * for higher level blocks, try not to allocate blocks | 1530 | * for higher level blocks, try not to allocate blocks |
| 1412 | * with the block and the parent locks held. | 1531 | * with the block and the parent locks held. |
| 1413 | */ | 1532 | */ |
| 1414 | if (level > 1 && !prealloc_block.objectid && | 1533 | if (level > 0 && !prealloc_block.objectid && |
| 1415 | btrfs_path_lock_waiting(p, level)) { | 1534 | btrfs_path_lock_waiting(p, level)) { |
| 1416 | u32 size = b->len; | 1535 | u32 size = b->len; |
| 1417 | u64 hint = b->start; | 1536 | u64 hint = b->start; |
| @@ -1425,6 +1544,8 @@ again: | |||
| 1425 | goto again; | 1544 | goto again; |
| 1426 | } | 1545 | } |
| 1427 | 1546 | ||
| 1547 | btrfs_set_path_blocking(p); | ||
| 1548 | |||
| 1428 | wret = btrfs_cow_block(trans, root, b, | 1549 | wret = btrfs_cow_block(trans, root, b, |
| 1429 | p->nodes[level + 1], | 1550 | p->nodes[level + 1], |
| 1430 | p->slots[level + 1], | 1551 | p->slots[level + 1], |
| @@ -1446,6 +1567,22 @@ cow_done: | |||
| 1446 | if (!p->skip_locking) | 1567 | if (!p->skip_locking) |
| 1447 | p->locks[level] = 1; | 1568 | p->locks[level] = 1; |
| 1448 | 1569 | ||
| 1570 | btrfs_clear_path_blocking(p); | ||
| 1571 | |||
| 1572 | /* | ||
| 1573 | * we have a lock on b and as long as we aren't changing | ||
| 1574 | * the tree, there is no way to for the items in b to change. | ||
| 1575 | * It is safe to drop the lock on our parent before we | ||
| 1576 | * go through the expensive btree search on b. | ||
| 1577 | * | ||
| 1578 | * If cow is true, then we might be changing slot zero, | ||
| 1579 | * which may require changing the parent. So, we can't | ||
| 1580 | * drop the lock until after we know which slot we're | ||
| 1581 | * operating on. | ||
| 1582 | */ | ||
| 1583 | if (!cow) | ||
| 1584 | btrfs_unlock_up_safe(p, level + 1); | ||
| 1585 | |||
| 1449 | ret = check_block(root, p, level); | 1586 | ret = check_block(root, p, level); |
| 1450 | if (ret) { | 1587 | if (ret) { |
| 1451 | ret = -1; | 1588 | ret = -1; |
| @@ -1453,6 +1590,7 @@ cow_done: | |||
| 1453 | } | 1590 | } |
| 1454 | 1591 | ||
| 1455 | ret = bin_search(b, key, level, &slot); | 1592 | ret = bin_search(b, key, level, &slot); |
| 1593 | |||
| 1456 | if (level != 0) { | 1594 | if (level != 0) { |
| 1457 | if (ret && slot > 0) | 1595 | if (ret && slot > 0) |
| 1458 | slot -= 1; | 1596 | slot -= 1; |
| @@ -1460,7 +1598,16 @@ cow_done: | |||
| 1460 | if ((p->search_for_split || ins_len > 0) && | 1598 | if ((p->search_for_split || ins_len > 0) && |
| 1461 | btrfs_header_nritems(b) >= | 1599 | btrfs_header_nritems(b) >= |
| 1462 | BTRFS_NODEPTRS_PER_BLOCK(root) - 3) { | 1600 | BTRFS_NODEPTRS_PER_BLOCK(root) - 3) { |
| 1463 | int sret = split_node(trans, root, p, level); | 1601 | int sret; |
| 1602 | |||
| 1603 | sret = reada_for_balance(root, p, level); | ||
| 1604 | if (sret) | ||
| 1605 | goto again; | ||
| 1606 | |||
| 1607 | btrfs_set_path_blocking(p); | ||
| 1608 | sret = split_node(trans, root, p, level); | ||
| 1609 | btrfs_clear_path_blocking(p); | ||
| 1610 | |||
| 1464 | BUG_ON(sret > 0); | 1611 | BUG_ON(sret > 0); |
| 1465 | if (sret) { | 1612 | if (sret) { |
| 1466 | ret = sret; | 1613 | ret = sret; |
| @@ -1468,9 +1615,19 @@ cow_done: | |||
| 1468 | } | 1615 | } |
| 1469 | b = p->nodes[level]; | 1616 | b = p->nodes[level]; |
| 1470 | slot = p->slots[level]; | 1617 | slot = p->slots[level]; |
| 1471 | } else if (ins_len < 0) { | 1618 | } else if (ins_len < 0 && |
| 1472 | int sret = balance_level(trans, root, p, | 1619 | btrfs_header_nritems(b) < |
| 1473 | level); | 1620 | BTRFS_NODEPTRS_PER_BLOCK(root) / 4) { |
| 1621 | int sret; | ||
| 1622 | |||
| 1623 | sret = reada_for_balance(root, p, level); | ||
| 1624 | if (sret) | ||
| 1625 | goto again; | ||
| 1626 | |||
| 1627 | btrfs_set_path_blocking(p); | ||
| 1628 | sret = balance_level(trans, root, p, level); | ||
| 1629 | btrfs_clear_path_blocking(p); | ||
| 1630 | |||
| 1474 | if (sret) { | 1631 | if (sret) { |
| 1475 | ret = sret; | 1632 | ret = sret; |
| 1476 | goto done; | 1633 | goto done; |
| @@ -1504,7 +1661,7 @@ cow_done: | |||
| 1504 | * of the btree by dropping locks before | 1661 | * of the btree by dropping locks before |
| 1505 | * we read. | 1662 | * we read. |
| 1506 | */ | 1663 | */ |
| 1507 | if (level > 1) { | 1664 | if (level > 0) { |
| 1508 | btrfs_release_path(NULL, p); | 1665 | btrfs_release_path(NULL, p); |
| 1509 | if (tmp) | 1666 | if (tmp) |
| 1510 | free_extent_buffer(tmp); | 1667 | free_extent_buffer(tmp); |
| @@ -1519,6 +1676,7 @@ cow_done: | |||
| 1519 | free_extent_buffer(tmp); | 1676 | free_extent_buffer(tmp); |
| 1520 | goto again; | 1677 | goto again; |
| 1521 | } else { | 1678 | } else { |
| 1679 | btrfs_set_path_blocking(p); | ||
| 1522 | if (tmp) | 1680 | if (tmp) |
| 1523 | free_extent_buffer(tmp); | 1681 | free_extent_buffer(tmp); |
| 1524 | if (should_reada) | 1682 | if (should_reada) |
| @@ -1528,14 +1686,29 @@ cow_done: | |||
| 1528 | b = read_node_slot(root, b, slot); | 1686 | b = read_node_slot(root, b, slot); |
| 1529 | } | 1687 | } |
| 1530 | } | 1688 | } |
| 1531 | if (!p->skip_locking) | 1689 | if (!p->skip_locking) { |
| 1532 | btrfs_tree_lock(b); | 1690 | int lret; |
| 1691 | |||
| 1692 | btrfs_clear_path_blocking(p); | ||
| 1693 | lret = btrfs_try_spin_lock(b); | ||
| 1694 | |||
| 1695 | if (!lret) { | ||
| 1696 | btrfs_set_path_blocking(p); | ||
| 1697 | btrfs_tree_lock(b); | ||
| 1698 | btrfs_clear_path_blocking(p); | ||
| 1699 | } | ||
| 1700 | } | ||
| 1533 | } else { | 1701 | } else { |
| 1534 | p->slots[level] = slot; | 1702 | p->slots[level] = slot; |
| 1535 | if (ins_len > 0 && | 1703 | if (ins_len > 0 && |
| 1536 | btrfs_leaf_free_space(root, b) < ins_len) { | 1704 | btrfs_leaf_free_space(root, b) < ins_len) { |
| 1537 | int sret = split_leaf(trans, root, key, | 1705 | int sret; |
| 1706 | |||
| 1707 | btrfs_set_path_blocking(p); | ||
| 1708 | sret = split_leaf(trans, root, key, | ||
| 1538 | p, ins_len, ret == 0); | 1709 | p, ins_len, ret == 0); |
| 1710 | btrfs_clear_path_blocking(p); | ||
| 1711 | |||
| 1539 | BUG_ON(sret > 0); | 1712 | BUG_ON(sret > 0); |
| 1540 | if (sret) { | 1713 | if (sret) { |
| 1541 | ret = sret; | 1714 | ret = sret; |
| @@ -1549,12 +1722,16 @@ cow_done: | |||
| 1549 | } | 1722 | } |
| 1550 | ret = 1; | 1723 | ret = 1; |
| 1551 | done: | 1724 | done: |
| 1725 | /* | ||
| 1726 | * we don't really know what they plan on doing with the path | ||
| 1727 | * from here on, so for now just mark it as blocking | ||
| 1728 | */ | ||
| 1729 | btrfs_set_path_blocking(p); | ||
| 1552 | if (prealloc_block.objectid) { | 1730 | if (prealloc_block.objectid) { |
| 1553 | btrfs_free_reserved_extent(root, | 1731 | btrfs_free_reserved_extent(root, |
| 1554 | prealloc_block.objectid, | 1732 | prealloc_block.objectid, |
| 1555 | prealloc_block.offset); | 1733 | prealloc_block.offset); |
| 1556 | } | 1734 | } |
| 1557 | |||
| 1558 | return ret; | 1735 | return ret; |
| 1559 | } | 1736 | } |
| 1560 | 1737 | ||
| @@ -1578,6 +1755,8 @@ int btrfs_merge_path(struct btrfs_trans_handle *trans, | |||
| 1578 | ret = btrfs_cow_block(trans, root, eb, NULL, 0, &eb, 0); | 1755 | ret = btrfs_cow_block(trans, root, eb, NULL, 0, &eb, 0); |
| 1579 | BUG_ON(ret); | 1756 | BUG_ON(ret); |
| 1580 | 1757 | ||
| 1758 | btrfs_set_lock_blocking(eb); | ||
| 1759 | |||
| 1581 | parent = eb; | 1760 | parent = eb; |
| 1582 | while (1) { | 1761 | while (1) { |
| 1583 | level = btrfs_header_level(parent); | 1762 | level = btrfs_header_level(parent); |
| @@ -1602,6 +1781,7 @@ int btrfs_merge_path(struct btrfs_trans_handle *trans, | |||
| 1602 | eb = read_tree_block(root, bytenr, blocksize, | 1781 | eb = read_tree_block(root, bytenr, blocksize, |
| 1603 | generation); | 1782 | generation); |
| 1604 | btrfs_tree_lock(eb); | 1783 | btrfs_tree_lock(eb); |
| 1784 | btrfs_set_lock_blocking(eb); | ||
| 1605 | } | 1785 | } |
| 1606 | 1786 | ||
| 1607 | /* | 1787 | /* |
| @@ -1626,6 +1806,7 @@ int btrfs_merge_path(struct btrfs_trans_handle *trans, | |||
| 1626 | eb = read_tree_block(root, bytenr, blocksize, | 1806 | eb = read_tree_block(root, bytenr, blocksize, |
| 1627 | generation); | 1807 | generation); |
| 1628 | btrfs_tree_lock(eb); | 1808 | btrfs_tree_lock(eb); |
| 1809 | btrfs_set_lock_blocking(eb); | ||
| 1629 | } | 1810 | } |
| 1630 | 1811 | ||
| 1631 | ret = btrfs_cow_block(trans, root, eb, parent, slot, | 1812 | ret = btrfs_cow_block(trans, root, eb, parent, slot, |
| @@ -2172,6 +2353,8 @@ static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root | |||
| 2172 | 2353 | ||
| 2173 | right = read_node_slot(root, upper, slot + 1); | 2354 | right = read_node_slot(root, upper, slot + 1); |
| 2174 | btrfs_tree_lock(right); | 2355 | btrfs_tree_lock(right); |
| 2356 | btrfs_set_lock_blocking(right); | ||
| 2357 | |||
| 2175 | free_space = btrfs_leaf_free_space(root, right); | 2358 | free_space = btrfs_leaf_free_space(root, right); |
| 2176 | if (free_space < data_size) | 2359 | if (free_space < data_size) |
| 2177 | goto out_unlock; | 2360 | goto out_unlock; |
| @@ -2367,6 +2550,8 @@ static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root | |||
| 2367 | 2550 | ||
| 2368 | left = read_node_slot(root, path->nodes[1], slot - 1); | 2551 | left = read_node_slot(root, path->nodes[1], slot - 1); |
| 2369 | btrfs_tree_lock(left); | 2552 | btrfs_tree_lock(left); |
| 2553 | btrfs_set_lock_blocking(left); | ||
| 2554 | |||
| 2370 | free_space = btrfs_leaf_free_space(root, left); | 2555 | free_space = btrfs_leaf_free_space(root, left); |
| 2371 | if (free_space < data_size) { | 2556 | if (free_space < data_size) { |
| 2372 | ret = 1; | 2557 | ret = 1; |
| @@ -2825,6 +3010,12 @@ int btrfs_split_item(struct btrfs_trans_handle *trans, | |||
| 2825 | path->keep_locks = 0; | 3010 | path->keep_locks = 0; |
| 2826 | BUG_ON(ret); | 3011 | BUG_ON(ret); |
| 2827 | 3012 | ||
| 3013 | /* | ||
| 3014 | * make sure any changes to the path from split_leaf leave it | ||
| 3015 | * in a blocking state | ||
| 3016 | */ | ||
| 3017 | btrfs_set_path_blocking(path); | ||
| 3018 | |||
| 2828 | leaf = path->nodes[0]; | 3019 | leaf = path->nodes[0]; |
| 2829 | BUG_ON(btrfs_leaf_free_space(root, leaf) < sizeof(struct btrfs_item)); | 3020 | BUG_ON(btrfs_leaf_free_space(root, leaf) < sizeof(struct btrfs_item)); |
| 2830 | 3021 | ||
| @@ -3354,6 +3545,7 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans, | |||
| 3354 | BUG(); | 3545 | BUG(); |
| 3355 | } | 3546 | } |
| 3356 | out: | 3547 | out: |
| 3548 | btrfs_unlock_up_safe(path, 1); | ||
| 3357 | return ret; | 3549 | return ret; |
| 3358 | } | 3550 | } |
| 3359 | 3551 | ||
| @@ -3441,15 +3633,22 @@ noinline int btrfs_del_leaf(struct btrfs_trans_handle *trans, | |||
| 3441 | { | 3633 | { |
| 3442 | int ret; | 3634 | int ret; |
| 3443 | u64 root_gen = btrfs_header_generation(path->nodes[1]); | 3635 | u64 root_gen = btrfs_header_generation(path->nodes[1]); |
| 3636 | u64 parent_start = path->nodes[1]->start; | ||
| 3637 | u64 parent_owner = btrfs_header_owner(path->nodes[1]); | ||
| 3444 | 3638 | ||
| 3445 | ret = del_ptr(trans, root, path, 1, path->slots[1]); | 3639 | ret = del_ptr(trans, root, path, 1, path->slots[1]); |
| 3446 | if (ret) | 3640 | if (ret) |
| 3447 | return ret; | 3641 | return ret; |
| 3448 | 3642 | ||
| 3643 | /* | ||
| 3644 | * btrfs_free_extent is expensive, we want to make sure we | ||
| 3645 | * aren't holding any locks when we call it | ||
| 3646 | */ | ||
| 3647 | btrfs_unlock_up_safe(path, 0); | ||
| 3648 | |||
| 3449 | ret = btrfs_free_extent(trans, root, bytenr, | 3649 | ret = btrfs_free_extent(trans, root, bytenr, |
| 3450 | btrfs_level_size(root, 0), | 3650 | btrfs_level_size(root, 0), |
| 3451 | path->nodes[1]->start, | 3651 | parent_start, parent_owner, |
| 3452 | btrfs_header_owner(path->nodes[1]), | ||
| 3453 | root_gen, 0, 1); | 3652 | root_gen, 0, 1); |
| 3454 | return ret; | 3653 | return ret; |
| 3455 | } | 3654 | } |
| @@ -3721,12 +3920,14 @@ find_next_key: | |||
| 3721 | */ | 3920 | */ |
| 3722 | if (slot >= nritems) { | 3921 | if (slot >= nritems) { |
| 3723 | path->slots[level] = slot; | 3922 | path->slots[level] = slot; |
| 3923 | btrfs_set_path_blocking(path); | ||
| 3724 | sret = btrfs_find_next_key(root, path, min_key, level, | 3924 | sret = btrfs_find_next_key(root, path, min_key, level, |
| 3725 | cache_only, min_trans); | 3925 | cache_only, min_trans); |
| 3726 | if (sret == 0) { | 3926 | if (sret == 0) { |
| 3727 | btrfs_release_path(root, path); | 3927 | btrfs_release_path(root, path); |
| 3728 | goto again; | 3928 | goto again; |
| 3729 | } else { | 3929 | } else { |
| 3930 | btrfs_clear_path_blocking(path); | ||
| 3730 | goto out; | 3931 | goto out; |
| 3731 | } | 3932 | } |
| 3732 | } | 3933 | } |
| @@ -3738,16 +3939,20 @@ find_next_key: | |||
| 3738 | unlock_up(path, level, 1); | 3939 | unlock_up(path, level, 1); |
| 3739 | goto out; | 3940 | goto out; |
| 3740 | } | 3941 | } |
| 3942 | btrfs_set_path_blocking(path); | ||
| 3741 | cur = read_node_slot(root, cur, slot); | 3943 | cur = read_node_slot(root, cur, slot); |
| 3742 | 3944 | ||
| 3743 | btrfs_tree_lock(cur); | 3945 | btrfs_tree_lock(cur); |
| 3946 | |||
| 3744 | path->locks[level - 1] = 1; | 3947 | path->locks[level - 1] = 1; |
| 3745 | path->nodes[level - 1] = cur; | 3948 | path->nodes[level - 1] = cur; |
| 3746 | unlock_up(path, level, 1); | 3949 | unlock_up(path, level, 1); |
| 3950 | btrfs_clear_path_blocking(path); | ||
| 3747 | } | 3951 | } |
| 3748 | out: | 3952 | out: |
| 3749 | if (ret == 0) | 3953 | if (ret == 0) |
| 3750 | memcpy(min_key, &found_key, sizeof(found_key)); | 3954 | memcpy(min_key, &found_key, sizeof(found_key)); |
| 3955 | btrfs_set_path_blocking(path); | ||
| 3751 | return ret; | 3956 | return ret; |
| 3752 | } | 3957 | } |
| 3753 | 3958 | ||
| @@ -3843,6 +4048,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path) | |||
| 3843 | if (ret < 0) | 4048 | if (ret < 0) |
| 3844 | return ret; | 4049 | return ret; |
| 3845 | 4050 | ||
| 4051 | btrfs_set_path_blocking(path); | ||
| 3846 | nritems = btrfs_header_nritems(path->nodes[0]); | 4052 | nritems = btrfs_header_nritems(path->nodes[0]); |
| 3847 | /* | 4053 | /* |
| 3848 | * by releasing the path above we dropped all our locks. A balance | 4054 | * by releasing the path above we dropped all our locks. A balance |
| @@ -3873,6 +4079,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path) | |||
| 3873 | free_extent_buffer(next); | 4079 | free_extent_buffer(next); |
| 3874 | } | 4080 | } |
| 3875 | 4081 | ||
| 4082 | /* the path was set to blocking above */ | ||
| 3876 | if (level == 1 && (path->locks[1] || path->skip_locking) && | 4083 | if (level == 1 && (path->locks[1] || path->skip_locking) && |
| 3877 | path->reada) | 4084 | path->reada) |
| 3878 | reada_for_search(root, path, level, slot, 0); | 4085 | reada_for_search(root, path, level, slot, 0); |
| @@ -3881,6 +4088,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path) | |||
| 3881 | if (!path->skip_locking) { | 4088 | if (!path->skip_locking) { |
| 3882 | WARN_ON(!btrfs_tree_locked(c)); | 4089 | WARN_ON(!btrfs_tree_locked(c)); |
| 3883 | btrfs_tree_lock(next); | 4090 | btrfs_tree_lock(next); |
| 4091 | btrfs_set_lock_blocking(next); | ||
| 3884 | } | 4092 | } |
| 3885 | break; | 4093 | break; |
| 3886 | } | 4094 | } |
| @@ -3897,12 +4105,15 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path) | |||
| 3897 | path->locks[level] = 1; | 4105 | path->locks[level] = 1; |
| 3898 | if (!level) | 4106 | if (!level) |
| 3899 | break; | 4107 | break; |
| 4108 | |||
| 4109 | btrfs_set_path_blocking(path); | ||
| 3900 | if (level == 1 && path->locks[1] && path->reada) | 4110 | if (level == 1 && path->locks[1] && path->reada) |
| 3901 | reada_for_search(root, path, level, slot, 0); | 4111 | reada_for_search(root, path, level, slot, 0); |
| 3902 | next = read_node_slot(root, next, 0); | 4112 | next = read_node_slot(root, next, 0); |
| 3903 | if (!path->skip_locking) { | 4113 | if (!path->skip_locking) { |
| 3904 | WARN_ON(!btrfs_tree_locked(path->nodes[level])); | 4114 | WARN_ON(!btrfs_tree_locked(path->nodes[level])); |
| 3905 | btrfs_tree_lock(next); | 4115 | btrfs_tree_lock(next); |
| 4116 | btrfs_set_lock_blocking(next); | ||
| 3906 | } | 4117 | } |
| 3907 | } | 4118 | } |
| 3908 | done: | 4119 | done: |
| @@ -3927,6 +4138,7 @@ int btrfs_previous_item(struct btrfs_root *root, | |||
| 3927 | 4138 | ||
| 3928 | while (1) { | 4139 | while (1) { |
| 3929 | if (path->slots[0] == 0) { | 4140 | if (path->slots[0] == 0) { |
| 4141 | btrfs_set_path_blocking(path); | ||
| 3930 | ret = btrfs_prev_leaf(root, path); | 4142 | ret = btrfs_prev_leaf(root, path); |
| 3931 | if (ret != 0) | 4143 | if (ret != 0) |
| 3932 | return ret; | 4144 | return ret; |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index eee060f88113..531db112c8bd 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
| @@ -454,17 +454,11 @@ struct btrfs_timespec { | |||
| 454 | __le32 nsec; | 454 | __le32 nsec; |
| 455 | } __attribute__ ((__packed__)); | 455 | } __attribute__ ((__packed__)); |
| 456 | 456 | ||
| 457 | typedef enum { | 457 | enum btrfs_compression_type { |
| 458 | BTRFS_COMPRESS_NONE = 0, | 458 | BTRFS_COMPRESS_NONE = 0, |
| 459 | BTRFS_COMPRESS_ZLIB = 1, | 459 | BTRFS_COMPRESS_ZLIB = 1, |
| 460 | BTRFS_COMPRESS_LAST = 2, | 460 | BTRFS_COMPRESS_LAST = 2, |
| 461 | } btrfs_compression_type; | 461 | }; |
| 462 | |||
| 463 | /* we don't understand any encryption methods right now */ | ||
| 464 | typedef enum { | ||
| 465 | BTRFS_ENCRYPTION_NONE = 0, | ||
| 466 | BTRFS_ENCRYPTION_LAST = 1, | ||
| 467 | } btrfs_encryption_type; | ||
| 468 | 462 | ||
| 469 | struct btrfs_inode_item { | 463 | struct btrfs_inode_item { |
| 470 | /* nfs style generation number */ | 464 | /* nfs style generation number */ |
| @@ -701,9 +695,7 @@ struct btrfs_fs_info { | |||
| 701 | struct btrfs_transaction *running_transaction; | 695 | struct btrfs_transaction *running_transaction; |
| 702 | wait_queue_head_t transaction_throttle; | 696 | wait_queue_head_t transaction_throttle; |
| 703 | wait_queue_head_t transaction_wait; | 697 | wait_queue_head_t transaction_wait; |
| 704 | |||
| 705 | wait_queue_head_t async_submit_wait; | 698 | wait_queue_head_t async_submit_wait; |
| 706 | wait_queue_head_t tree_log_wait; | ||
| 707 | 699 | ||
| 708 | struct btrfs_super_block super_copy; | 700 | struct btrfs_super_block super_copy; |
| 709 | struct btrfs_super_block super_for_commit; | 701 | struct btrfs_super_block super_for_commit; |
| @@ -711,7 +703,6 @@ struct btrfs_fs_info { | |||
| 711 | struct super_block *sb; | 703 | struct super_block *sb; |
| 712 | struct inode *btree_inode; | 704 | struct inode *btree_inode; |
| 713 | struct backing_dev_info bdi; | 705 | struct backing_dev_info bdi; |
| 714 | spinlock_t hash_lock; | ||
| 715 | struct mutex trans_mutex; | 706 | struct mutex trans_mutex; |
| 716 | struct mutex tree_log_mutex; | 707 | struct mutex tree_log_mutex; |
| 717 | struct mutex transaction_kthread_mutex; | 708 | struct mutex transaction_kthread_mutex; |
| @@ -730,10 +721,6 @@ struct btrfs_fs_info { | |||
| 730 | atomic_t async_submit_draining; | 721 | atomic_t async_submit_draining; |
| 731 | atomic_t nr_async_bios; | 722 | atomic_t nr_async_bios; |
| 732 | atomic_t async_delalloc_pages; | 723 | atomic_t async_delalloc_pages; |
| 733 | atomic_t tree_log_writers; | ||
| 734 | atomic_t tree_log_commit; | ||
| 735 | unsigned long tree_log_batch; | ||
| 736 | u64 tree_log_transid; | ||
| 737 | 724 | ||
| 738 | /* | 725 | /* |
| 739 | * this is used by the balancing code to wait for all the pending | 726 | * this is used by the balancing code to wait for all the pending |
| @@ -833,7 +820,14 @@ struct btrfs_root { | |||
| 833 | struct kobject root_kobj; | 820 | struct kobject root_kobj; |
| 834 | struct completion kobj_unregister; | 821 | struct completion kobj_unregister; |
| 835 | struct mutex objectid_mutex; | 822 | struct mutex objectid_mutex; |
| 823 | |||
| 836 | struct mutex log_mutex; | 824 | struct mutex log_mutex; |
| 825 | wait_queue_head_t log_writer_wait; | ||
| 826 | wait_queue_head_t log_commit_wait[2]; | ||
| 827 | atomic_t log_writers; | ||
| 828 | atomic_t log_commit[2]; | ||
| 829 | unsigned long log_transid; | ||
| 830 | unsigned long log_batch; | ||
| 837 | 831 | ||
| 838 | u64 objectid; | 832 | u64 objectid; |
| 839 | u64 last_trans; | 833 | u64 last_trans; |
| @@ -1841,6 +1835,10 @@ void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p); | |||
| 1841 | struct btrfs_path *btrfs_alloc_path(void); | 1835 | struct btrfs_path *btrfs_alloc_path(void); |
| 1842 | void btrfs_free_path(struct btrfs_path *p); | 1836 | void btrfs_free_path(struct btrfs_path *p); |
| 1843 | void btrfs_init_path(struct btrfs_path *p); | 1837 | void btrfs_init_path(struct btrfs_path *p); |
| 1838 | void btrfs_set_path_blocking(struct btrfs_path *p); | ||
| 1839 | void btrfs_clear_path_blocking(struct btrfs_path *p); | ||
| 1840 | void btrfs_unlock_up_safe(struct btrfs_path *p, int level); | ||
| 1841 | |||
| 1844 | int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 1842 | int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
| 1845 | struct btrfs_path *path, int slot, int nr); | 1843 | struct btrfs_path *path, int slot, int nr); |
| 1846 | int btrfs_del_leaf(struct btrfs_trans_handle *trans, | 1844 | int btrfs_del_leaf(struct btrfs_trans_handle *trans, |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 81a313874ae5..5aebddd71193 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | * Boston, MA 021110-1307, USA. | 16 | * Boston, MA 021110-1307, USA. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #include <linux/version.h> | ||
| 20 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
| 21 | #include <linux/blkdev.h> | 20 | #include <linux/blkdev.h> |
| 22 | #include <linux/scatterlist.h> | 21 | #include <linux/scatterlist.h> |
| @@ -800,7 +799,7 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr, | |||
| 800 | ret = btree_read_extent_buffer_pages(root, buf, 0, parent_transid); | 799 | ret = btree_read_extent_buffer_pages(root, buf, 0, parent_transid); |
| 801 | 800 | ||
| 802 | if (ret == 0) | 801 | if (ret == 0) |
| 803 | buf->flags |= EXTENT_UPTODATE; | 802 | set_bit(EXTENT_BUFFER_UPTODATE, &buf->bflags); |
| 804 | else | 803 | else |
| 805 | WARN_ON(1); | 804 | WARN_ON(1); |
| 806 | return buf; | 805 | return buf; |
| @@ -814,6 +813,10 @@ int clean_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root, | |||
| 814 | if (btrfs_header_generation(buf) == | 813 | if (btrfs_header_generation(buf) == |
| 815 | root->fs_info->running_transaction->transid) { | 814 | root->fs_info->running_transaction->transid) { |
| 816 | WARN_ON(!btrfs_tree_locked(buf)); | 815 | WARN_ON(!btrfs_tree_locked(buf)); |
| 816 | |||
| 817 | /* ugh, clear_extent_buffer_dirty can be expensive */ | ||
| 818 | btrfs_set_lock_blocking(buf); | ||
| 819 | |||
| 817 | clear_extent_buffer_dirty(&BTRFS_I(btree_inode)->io_tree, | 820 | clear_extent_buffer_dirty(&BTRFS_I(btree_inode)->io_tree, |
| 818 | buf); | 821 | buf); |
| 819 | } | 822 | } |
| @@ -850,6 +853,14 @@ static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize, | |||
| 850 | spin_lock_init(&root->list_lock); | 853 | spin_lock_init(&root->list_lock); |
| 851 | mutex_init(&root->objectid_mutex); | 854 | mutex_init(&root->objectid_mutex); |
| 852 | mutex_init(&root->log_mutex); | 855 | mutex_init(&root->log_mutex); |
| 856 | init_waitqueue_head(&root->log_writer_wait); | ||
| 857 | init_waitqueue_head(&root->log_commit_wait[0]); | ||
| 858 | init_waitqueue_head(&root->log_commit_wait[1]); | ||
| 859 | atomic_set(&root->log_commit[0], 0); | ||
| 860 | atomic_set(&root->log_commit[1], 0); | ||
| 861 | atomic_set(&root->log_writers, 0); | ||
| 862 | root->log_batch = 0; | ||
| 863 | root->log_transid = 0; | ||
| 853 | extent_io_tree_init(&root->dirty_log_pages, | 864 | extent_io_tree_init(&root->dirty_log_pages, |
| 854 | fs_info->btree_inode->i_mapping, GFP_NOFS); | 865 | fs_info->btree_inode->i_mapping, GFP_NOFS); |
| 855 | 866 | ||
| @@ -934,15 +945,16 @@ int btrfs_free_log_root_tree(struct btrfs_trans_handle *trans, | |||
| 934 | return 0; | 945 | return 0; |
| 935 | } | 946 | } |
| 936 | 947 | ||
| 937 | int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans, | 948 | static struct btrfs_root *alloc_log_tree(struct btrfs_trans_handle *trans, |
| 938 | struct btrfs_fs_info *fs_info) | 949 | struct btrfs_fs_info *fs_info) |
| 939 | { | 950 | { |
| 940 | struct btrfs_root *root; | 951 | struct btrfs_root *root; |
| 941 | struct btrfs_root *tree_root = fs_info->tree_root; | 952 | struct btrfs_root *tree_root = fs_info->tree_root; |
| 953 | struct extent_buffer *leaf; | ||
| 942 | 954 | ||
| 943 | root = kzalloc(sizeof(*root), GFP_NOFS); | 955 | root = kzalloc(sizeof(*root), GFP_NOFS); |
| 944 | if (!root) | 956 | if (!root) |
| 945 | return -ENOMEM; | 957 | return ERR_PTR(-ENOMEM); |
| 946 | 958 | ||
| 947 | __setup_root(tree_root->nodesize, tree_root->leafsize, | 959 | __setup_root(tree_root->nodesize, tree_root->leafsize, |
| 948 | tree_root->sectorsize, tree_root->stripesize, | 960 | tree_root->sectorsize, tree_root->stripesize, |
| @@ -951,12 +963,23 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans, | |||
| 951 | root->root_key.objectid = BTRFS_TREE_LOG_OBJECTID; | 963 | root->root_key.objectid = BTRFS_TREE_LOG_OBJECTID; |
| 952 | root->root_key.type = BTRFS_ROOT_ITEM_KEY; | 964 | root->root_key.type = BTRFS_ROOT_ITEM_KEY; |
| 953 | root->root_key.offset = BTRFS_TREE_LOG_OBJECTID; | 965 | root->root_key.offset = BTRFS_TREE_LOG_OBJECTID; |
| 966 | /* | ||
| 967 | * log trees do not get reference counted because they go away | ||
| 968 | * before a real commit is actually done. They do store pointers | ||
| 969 | * to file data extents, and those reference counts still get | ||
| 970 | * updated (along with back refs to the log tree). | ||
| 971 | */ | ||
| 954 | root->ref_cows = 0; | 972 | root->ref_cows = 0; |
| 955 | 973 | ||
| 956 | root->node = btrfs_alloc_free_block(trans, root, root->leafsize, | 974 | leaf = btrfs_alloc_free_block(trans, root, root->leafsize, |
| 957 | 0, BTRFS_TREE_LOG_OBJECTID, | 975 | 0, BTRFS_TREE_LOG_OBJECTID, |
| 958 | trans->transid, 0, 0, 0); | 976 | trans->transid, 0, 0, 0); |
| 977 | if (IS_ERR(leaf)) { | ||
| 978 | kfree(root); | ||
| 979 | return ERR_CAST(leaf); | ||
| 980 | } | ||
| 959 | 981 | ||
| 982 | root->node = leaf; | ||
| 960 | btrfs_set_header_nritems(root->node, 0); | 983 | btrfs_set_header_nritems(root->node, 0); |
| 961 | btrfs_set_header_level(root->node, 0); | 984 | btrfs_set_header_level(root->node, 0); |
| 962 | btrfs_set_header_bytenr(root->node, root->node->start); | 985 | btrfs_set_header_bytenr(root->node, root->node->start); |
| @@ -968,7 +991,48 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans, | |||
| 968 | BTRFS_FSID_SIZE); | 991 | BTRFS_FSID_SIZE); |
| 969 | btrfs_mark_buffer_dirty(root->node); | 992 | btrfs_mark_buffer_dirty(root->node); |
| 970 | btrfs_tree_unlock(root->node); | 993 | btrfs_tree_unlock(root->node); |
| 971 | fs_info->log_root_tree = root; | 994 | return root; |
| 995 | } | ||
| 996 | |||
| 997 | int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans, | ||
| 998 | struct btrfs_fs_info *fs_info) | ||
| 999 | { | ||
| 1000 | struct btrfs_root *log_root; | ||
| 1001 | |||
| 1002 | log_root = alloc_log_tree(trans, fs_info); | ||
| 1003 | if (IS_ERR(log_root)) | ||
| 1004 | return PTR_ERR(log_root); | ||
| 1005 | WARN_ON(fs_info->log_root_tree); | ||
| 1006 | fs_info->log_root_tree = log_root; | ||
| 1007 | return 0; | ||
| 1008 | } | ||
| 1009 | |||
| 1010 | int btrfs_add_log_tree(struct btrfs_trans_handle *trans, | ||
| 1011 | struct btrfs_root *root) | ||
| 1012 | { | ||
| 1013 | struct btrfs_root *log_root; | ||
| 1014 | struct btrfs_inode_item *inode_item; | ||
| 1015 | |||
| 1016 | log_root = alloc_log_tree(trans, root->fs_info); | ||
| 1017 | if (IS_ERR(log_root)) | ||
| 1018 | return PTR_ERR(log_root); | ||
| 1019 | |||
| 1020 | log_root->last_trans = trans->transid; | ||
| 1021 | log_root->root_key.offset = root->root_key.objectid; | ||
| 1022 | |||
| 1023 | inode_item = &log_root->root_item.inode; | ||
| 1024 | inode_item->generation = cpu_to_le64(1); | ||
| 1025 | inode_item->size = cpu_to_le64(3); | ||
| 1026 | inode_item->nlink = cpu_to_le32(1); | ||
| 1027 | inode_item->nbytes = cpu_to_le64(root->leafsize); | ||
| 1028 | inode_item->mode = cpu_to_le32(S_IFDIR | 0755); | ||
| 1029 | |||
| 1030 | btrfs_set_root_bytenr(&log_root->root_item, log_root->node->start); | ||
| 1031 | btrfs_set_root_generation(&log_root->root_item, trans->transid); | ||
| 1032 | |||
| 1033 | WARN_ON(root->log_root); | ||
| 1034 | root->log_root = log_root; | ||
| 1035 | root->log_transid = 0; | ||
| 972 | return 0; | 1036 | return 0; |
| 973 | } | 1037 | } |
| 974 | 1038 | ||
| @@ -1136,7 +1200,6 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits) | |||
| 1136 | { | 1200 | { |
| 1137 | struct btrfs_fs_info *info = (struct btrfs_fs_info *)congested_data; | 1201 | struct btrfs_fs_info *info = (struct btrfs_fs_info *)congested_data; |
| 1138 | int ret = 0; | 1202 | int ret = 0; |
| 1139 | struct list_head *cur; | ||
| 1140 | struct btrfs_device *device; | 1203 | struct btrfs_device *device; |
| 1141 | struct backing_dev_info *bdi; | 1204 | struct backing_dev_info *bdi; |
| 1142 | #if 0 | 1205 | #if 0 |
| @@ -1144,8 +1207,7 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits) | |||
| 1144 | btrfs_congested_async(info, 0)) | 1207 | btrfs_congested_async(info, 0)) |
| 1145 | return 1; | 1208 | return 1; |
| 1146 | #endif | 1209 | #endif |
| 1147 | list_for_each(cur, &info->fs_devices->devices) { | 1210 | list_for_each_entry(device, &info->fs_devices->devices, dev_list) { |
| 1148 | device = list_entry(cur, struct btrfs_device, dev_list); | ||
| 1149 | if (!device->bdev) | 1211 | if (!device->bdev) |
| 1150 | continue; | 1212 | continue; |
| 1151 | bdi = blk_get_backing_dev_info(device->bdev); | 1213 | bdi = blk_get_backing_dev_info(device->bdev); |
| @@ -1163,13 +1225,11 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits) | |||
| 1163 | */ | 1225 | */ |
| 1164 | static void __unplug_io_fn(struct backing_dev_info *bdi, struct page *page) | 1226 | static void __unplug_io_fn(struct backing_dev_info *bdi, struct page *page) |
| 1165 | { | 1227 | { |
| 1166 | struct list_head *cur; | ||
| 1167 | struct btrfs_device *device; | 1228 | struct btrfs_device *device; |
| 1168 | struct btrfs_fs_info *info; | 1229 | struct btrfs_fs_info *info; |
| 1169 | 1230 | ||
| 1170 | info = (struct btrfs_fs_info *)bdi->unplug_io_data; | 1231 | info = (struct btrfs_fs_info *)bdi->unplug_io_data; |
| 1171 | list_for_each(cur, &info->fs_devices->devices) { | 1232 | list_for_each_entry(device, &info->fs_devices->devices, dev_list) { |
| 1172 | device = list_entry(cur, struct btrfs_device, dev_list); | ||
| 1173 | if (!device->bdev) | 1233 | if (!device->bdev) |
| 1174 | continue; | 1234 | continue; |
| 1175 | 1235 | ||
| @@ -1447,7 +1507,6 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
| 1447 | INIT_LIST_HEAD(&fs_info->dead_roots); | 1507 | INIT_LIST_HEAD(&fs_info->dead_roots); |
| 1448 | INIT_LIST_HEAD(&fs_info->hashers); | 1508 | INIT_LIST_HEAD(&fs_info->hashers); |
| 1449 | INIT_LIST_HEAD(&fs_info->delalloc_inodes); | 1509 | INIT_LIST_HEAD(&fs_info->delalloc_inodes); |
| 1450 | spin_lock_init(&fs_info->hash_lock); | ||
| 1451 | spin_lock_init(&fs_info->delalloc_lock); | 1510 | spin_lock_init(&fs_info->delalloc_lock); |
| 1452 | spin_lock_init(&fs_info->new_trans_lock); | 1511 | spin_lock_init(&fs_info->new_trans_lock); |
| 1453 | spin_lock_init(&fs_info->ref_cache_lock); | 1512 | spin_lock_init(&fs_info->ref_cache_lock); |
| @@ -1535,10 +1594,6 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
| 1535 | init_waitqueue_head(&fs_info->transaction_throttle); | 1594 | init_waitqueue_head(&fs_info->transaction_throttle); |
| 1536 | init_waitqueue_head(&fs_info->transaction_wait); | 1595 | init_waitqueue_head(&fs_info->transaction_wait); |
| 1537 | init_waitqueue_head(&fs_info->async_submit_wait); | 1596 | init_waitqueue_head(&fs_info->async_submit_wait); |
| 1538 | init_waitqueue_head(&fs_info->tree_log_wait); | ||
| 1539 | atomic_set(&fs_info->tree_log_commit, 0); | ||
| 1540 | atomic_set(&fs_info->tree_log_writers, 0); | ||
| 1541 | fs_info->tree_log_transid = 0; | ||
| 1542 | 1597 | ||
| 1543 | __setup_root(4096, 4096, 4096, 4096, tree_root, | 1598 | __setup_root(4096, 4096, 4096, 4096, tree_root, |
| 1544 | fs_info, BTRFS_ROOT_TREE_OBJECTID); | 1599 | fs_info, BTRFS_ROOT_TREE_OBJECTID); |
| @@ -1627,6 +1682,8 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
| 1627 | * low idle thresh | 1682 | * low idle thresh |
| 1628 | */ | 1683 | */ |
| 1629 | fs_info->endio_workers.idle_thresh = 4; | 1684 | fs_info->endio_workers.idle_thresh = 4; |
| 1685 | fs_info->endio_meta_workers.idle_thresh = 4; | ||
| 1686 | |||
| 1630 | fs_info->endio_write_workers.idle_thresh = 64; | 1687 | fs_info->endio_write_workers.idle_thresh = 64; |
| 1631 | fs_info->endio_meta_write_workers.idle_thresh = 64; | 1688 | fs_info->endio_meta_write_workers.idle_thresh = 64; |
| 1632 | 1689 | ||
| @@ -1740,13 +1797,13 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
| 1740 | fs_info->system_alloc_profile = fs_info->metadata_alloc_profile; | 1797 | fs_info->system_alloc_profile = fs_info->metadata_alloc_profile; |
| 1741 | fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root, | 1798 | fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root, |
| 1742 | "btrfs-cleaner"); | 1799 | "btrfs-cleaner"); |
| 1743 | if (!fs_info->cleaner_kthread) | 1800 | if (IS_ERR(fs_info->cleaner_kthread)) |
| 1744 | goto fail_csum_root; | 1801 | goto fail_csum_root; |
| 1745 | 1802 | ||
| 1746 | fs_info->transaction_kthread = kthread_run(transaction_kthread, | 1803 | fs_info->transaction_kthread = kthread_run(transaction_kthread, |
| 1747 | tree_root, | 1804 | tree_root, |
| 1748 | "btrfs-transaction"); | 1805 | "btrfs-transaction"); |
| 1749 | if (!fs_info->transaction_kthread) | 1806 | if (IS_ERR(fs_info->transaction_kthread)) |
| 1750 | goto fail_cleaner; | 1807 | goto fail_cleaner; |
| 1751 | 1808 | ||
| 1752 | if (btrfs_super_log_root(disk_super) != 0) { | 1809 | if (btrfs_super_log_root(disk_super) != 0) { |
| @@ -1828,13 +1885,14 @@ fail_sb_buffer: | |||
| 1828 | fail_iput: | 1885 | fail_iput: |
| 1829 | invalidate_inode_pages2(fs_info->btree_inode->i_mapping); | 1886 | invalidate_inode_pages2(fs_info->btree_inode->i_mapping); |
| 1830 | iput(fs_info->btree_inode); | 1887 | iput(fs_info->btree_inode); |
| 1831 | fail: | 1888 | |
| 1832 | btrfs_close_devices(fs_info->fs_devices); | 1889 | btrfs_close_devices(fs_info->fs_devices); |
| 1833 | btrfs_mapping_tree_free(&fs_info->mapping_tree); | 1890 | btrfs_mapping_tree_free(&fs_info->mapping_tree); |
| 1891 | bdi_destroy(&fs_info->bdi); | ||
| 1834 | 1892 | ||
| 1893 | fail: | ||
| 1835 | kfree(extent_root); | 1894 | kfree(extent_root); |
| 1836 | kfree(tree_root); | 1895 | kfree(tree_root); |
| 1837 | bdi_destroy(&fs_info->bdi); | ||
| 1838 | kfree(fs_info); | 1896 | kfree(fs_info); |
| 1839 | kfree(chunk_root); | 1897 | kfree(chunk_root); |
| 1840 | kfree(dev_root); | 1898 | kfree(dev_root); |
| @@ -1995,7 +2053,6 @@ static int write_dev_supers(struct btrfs_device *device, | |||
| 1995 | 2053 | ||
| 1996 | int write_all_supers(struct btrfs_root *root, int max_mirrors) | 2054 | int write_all_supers(struct btrfs_root *root, int max_mirrors) |
| 1997 | { | 2055 | { |
| 1998 | struct list_head *cur; | ||
| 1999 | struct list_head *head = &root->fs_info->fs_devices->devices; | 2056 | struct list_head *head = &root->fs_info->fs_devices->devices; |
| 2000 | struct btrfs_device *dev; | 2057 | struct btrfs_device *dev; |
| 2001 | struct btrfs_super_block *sb; | 2058 | struct btrfs_super_block *sb; |
| @@ -2011,8 +2068,7 @@ int write_all_supers(struct btrfs_root *root, int max_mirrors) | |||
| 2011 | 2068 | ||
| 2012 | sb = &root->fs_info->super_for_commit; | 2069 | sb = &root->fs_info->super_for_commit; |
| 2013 | dev_item = &sb->dev_item; | 2070 | dev_item = &sb->dev_item; |
| 2014 | list_for_each(cur, head) { | 2071 | list_for_each_entry(dev, head, dev_list) { |
| 2015 | dev = list_entry(cur, struct btrfs_device, dev_list); | ||
| 2016 | if (!dev->bdev) { | 2072 | if (!dev->bdev) { |
| 2017 | total_errors++; | 2073 | total_errors++; |
| 2018 | continue; | 2074 | continue; |
| @@ -2045,8 +2101,7 @@ int write_all_supers(struct btrfs_root *root, int max_mirrors) | |||
| 2045 | } | 2101 | } |
| 2046 | 2102 | ||
| 2047 | total_errors = 0; | 2103 | total_errors = 0; |
| 2048 | list_for_each(cur, head) { | 2104 | list_for_each_entry(dev, head, dev_list) { |
| 2049 | dev = list_entry(cur, struct btrfs_device, dev_list); | ||
| 2050 | if (!dev->bdev) | 2105 | if (!dev->bdev) |
| 2051 | continue; | 2106 | continue; |
| 2052 | if (!dev->in_fs_metadata || !dev->writeable) | 2107 | if (!dev->in_fs_metadata || !dev->writeable) |
| @@ -2260,6 +2315,8 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf) | |||
| 2260 | u64 transid = btrfs_header_generation(buf); | 2315 | u64 transid = btrfs_header_generation(buf); |
| 2261 | struct inode *btree_inode = root->fs_info->btree_inode; | 2316 | struct inode *btree_inode = root->fs_info->btree_inode; |
| 2262 | 2317 | ||
| 2318 | btrfs_set_lock_blocking(buf); | ||
| 2319 | |||
| 2263 | WARN_ON(!btrfs_tree_locked(buf)); | 2320 | WARN_ON(!btrfs_tree_locked(buf)); |
| 2264 | if (transid != root->fs_info->generation) { | 2321 | if (transid != root->fs_info->generation) { |
| 2265 | printk(KERN_CRIT "btrfs transid mismatch buffer %llu, " | 2322 | printk(KERN_CRIT "btrfs transid mismatch buffer %llu, " |
| @@ -2302,14 +2359,13 @@ int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid) | |||
| 2302 | int ret; | 2359 | int ret; |
| 2303 | ret = btree_read_extent_buffer_pages(root, buf, 0, parent_transid); | 2360 | ret = btree_read_extent_buffer_pages(root, buf, 0, parent_transid); |
| 2304 | if (ret == 0) | 2361 | if (ret == 0) |
| 2305 | buf->flags |= EXTENT_UPTODATE; | 2362 | set_bit(EXTENT_BUFFER_UPTODATE, &buf->bflags); |
| 2306 | return ret; | 2363 | return ret; |
| 2307 | } | 2364 | } |
| 2308 | 2365 | ||
| 2309 | int btree_lock_page_hook(struct page *page) | 2366 | int btree_lock_page_hook(struct page *page) |
| 2310 | { | 2367 | { |
| 2311 | struct inode *inode = page->mapping->host; | 2368 | struct inode *inode = page->mapping->host; |
| 2312 | struct btrfs_root *root = BTRFS_I(inode)->root; | ||
| 2313 | struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; | 2369 | struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; |
| 2314 | struct extent_buffer *eb; | 2370 | struct extent_buffer *eb; |
| 2315 | unsigned long len; | 2371 | unsigned long len; |
| @@ -2324,9 +2380,7 @@ int btree_lock_page_hook(struct page *page) | |||
| 2324 | goto out; | 2380 | goto out; |
| 2325 | 2381 | ||
| 2326 | btrfs_tree_lock(eb); | 2382 | btrfs_tree_lock(eb); |
| 2327 | spin_lock(&root->fs_info->hash_lock); | ||
| 2328 | btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN); | 2383 | btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN); |
| 2329 | spin_unlock(&root->fs_info->hash_lock); | ||
| 2330 | btrfs_tree_unlock(eb); | 2384 | btrfs_tree_unlock(eb); |
| 2331 | free_extent_buffer(eb); | 2385 | free_extent_buffer(eb); |
| 2332 | out: | 2386 | out: |
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h index c0ff404c31b7..494a56eb2986 100644 --- a/fs/btrfs/disk-io.h +++ b/fs/btrfs/disk-io.h | |||
| @@ -98,5 +98,7 @@ int btrfs_free_log_root_tree(struct btrfs_trans_handle *trans, | |||
| 98 | struct btrfs_fs_info *fs_info); | 98 | struct btrfs_fs_info *fs_info); |
| 99 | int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans, | 99 | int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans, |
| 100 | struct btrfs_fs_info *fs_info); | 100 | struct btrfs_fs_info *fs_info); |
| 101 | int btrfs_add_log_tree(struct btrfs_trans_handle *trans, | ||
| 102 | struct btrfs_root *root); | ||
| 101 | int btree_lock_page_hook(struct page *page); | 103 | int btree_lock_page_hook(struct page *page); |
| 102 | #endif | 104 | #endif |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 293da650873f..7527523c2d2d 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #include <linux/pagemap.h> | 19 | #include <linux/pagemap.h> |
| 20 | #include <linux/writeback.h> | 20 | #include <linux/writeback.h> |
| 21 | #include <linux/blkdev.h> | 21 | #include <linux/blkdev.h> |
| 22 | #include <linux/version.h> | 22 | #include <linux/sort.h> |
| 23 | #include "compat.h" | 23 | #include "compat.h" |
| 24 | #include "hash.h" | 24 | #include "hash.h" |
| 25 | #include "crc32c.h" | 25 | #include "crc32c.h" |
| @@ -30,7 +30,6 @@ | |||
| 30 | #include "volumes.h" | 30 | #include "volumes.h" |
| 31 | #include "locking.h" | 31 | #include "locking.h" |
| 32 | #include "ref-cache.h" | 32 | #include "ref-cache.h" |
| 33 | #include "compat.h" | ||
| 34 | 33 | ||
| 35 | #define PENDING_EXTENT_INSERT 0 | 34 | #define PENDING_EXTENT_INSERT 0 |
| 36 | #define PENDING_EXTENT_DELETE 1 | 35 | #define PENDING_EXTENT_DELETE 1 |
| @@ -326,10 +325,8 @@ static struct btrfs_space_info *__find_space_info(struct btrfs_fs_info *info, | |||
| 326 | u64 flags) | 325 | u64 flags) |
| 327 | { | 326 | { |
| 328 | struct list_head *head = &info->space_info; | 327 | struct list_head *head = &info->space_info; |
| 329 | struct list_head *cur; | ||
| 330 | struct btrfs_space_info *found; | 328 | struct btrfs_space_info *found; |
| 331 | list_for_each(cur, head) { | 329 | list_for_each_entry(found, head, list) { |
| 332 | found = list_entry(cur, struct btrfs_space_info, list); | ||
| 333 | if (found->flags == flags) | 330 | if (found->flags == flags) |
| 334 | return found; | 331 | return found; |
| 335 | } | 332 | } |
| @@ -1525,15 +1522,55 @@ out: | |||
| 1525 | return ret; | 1522 | return ret; |
| 1526 | } | 1523 | } |
| 1527 | 1524 | ||
| 1528 | int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 1525 | /* when a block goes through cow, we update the reference counts of |
| 1529 | struct extent_buffer *orig_buf, struct extent_buffer *buf, | 1526 | * everything that block points to. The internal pointers of the block |
| 1530 | u32 *nr_extents) | 1527 | * can be in just about any order, and it is likely to have clusters of |
| 1528 | * things that are close together and clusters of things that are not. | ||
| 1529 | * | ||
| 1530 | * To help reduce the seeks that come with updating all of these reference | ||
| 1531 | * counts, sort them by byte number before actual updates are done. | ||
| 1532 | * | ||
| 1533 | * struct refsort is used to match byte number to slot in the btree block. | ||
| 1534 | * we sort based on the byte number and then use the slot to actually | ||
| 1535 | * find the item. | ||
| 1536 | * | ||
| 1537 | * struct refsort is smaller than strcut btrfs_item and smaller than | ||
| 1538 | * struct btrfs_key_ptr. Since we're currently limited to the page size | ||
| 1539 | * for a btree block, there's no way for a kmalloc of refsorts for a | ||
| 1540 | * single node to be bigger than a page. | ||
| 1541 | */ | ||
| 1542 | struct refsort { | ||
| 1543 | u64 bytenr; | ||
| 1544 | u32 slot; | ||
| 1545 | }; | ||
| 1546 | |||
| 1547 | /* | ||
| 1548 | * for passing into sort() | ||
| 1549 | */ | ||
| 1550 | static int refsort_cmp(const void *a_void, const void *b_void) | ||
| 1551 | { | ||
| 1552 | const struct refsort *a = a_void; | ||
| 1553 | const struct refsort *b = b_void; | ||
| 1554 | |||
| 1555 | if (a->bytenr < b->bytenr) | ||
| 1556 | return -1; | ||
| 1557 | if (a->bytenr > b->bytenr) | ||
| 1558 | return 1; | ||
| 1559 | return 0; | ||
| 1560 | } | ||
| 1561 | |||
| 1562 | |||
| 1563 | noinline int btrfs_inc_ref(struct btrfs_trans_handle *trans, | ||
| 1564 | struct btrfs_root *root, | ||
| 1565 | struct extent_buffer *orig_buf, | ||
| 1566 | struct extent_buffer *buf, u32 *nr_extents) | ||
| 1531 | { | 1567 | { |
| 1532 | u64 bytenr; | 1568 | u64 bytenr; |
| 1533 | u64 ref_root; | 1569 | u64 ref_root; |
| 1534 | u64 orig_root; | 1570 | u64 orig_root; |
| 1535 | u64 ref_generation; | 1571 | u64 ref_generation; |
| 1536 | u64 orig_generation; | 1572 | u64 orig_generation; |
| 1573 | struct refsort *sorted; | ||
| 1537 | u32 nritems; | 1574 | u32 nritems; |
| 1538 | u32 nr_file_extents = 0; | 1575 | u32 nr_file_extents = 0; |
| 1539 | struct btrfs_key key; | 1576 | struct btrfs_key key; |
| @@ -1542,6 +1579,8 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, | |||
| 1542 | int level; | 1579 | int level; |
| 1543 | int ret = 0; | 1580 | int ret = 0; |
| 1544 | int faili = 0; | 1581 | int faili = 0; |
| 1582 | int refi = 0; | ||
| 1583 | int slot; | ||
| 1545 | int (*process_func)(struct btrfs_trans_handle *, struct btrfs_root *, | 1584 | int (*process_func)(struct btrfs_trans_handle *, struct btrfs_root *, |
| 1546 | u64, u64, u64, u64, u64, u64, u64, u64); | 1585 | u64, u64, u64, u64, u64, u64, u64, u64); |
| 1547 | 1586 | ||
| @@ -1553,6 +1592,9 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, | |||
| 1553 | nritems = btrfs_header_nritems(buf); | 1592 | nritems = btrfs_header_nritems(buf); |
| 1554 | level = btrfs_header_level(buf); | 1593 | level = btrfs_header_level(buf); |
| 1555 | 1594 | ||
| 1595 | sorted = kmalloc(sizeof(struct refsort) * nritems, GFP_NOFS); | ||
| 1596 | BUG_ON(!sorted); | ||
| 1597 | |||
| 1556 | if (root->ref_cows) { | 1598 | if (root->ref_cows) { |
| 1557 | process_func = __btrfs_inc_extent_ref; | 1599 | process_func = __btrfs_inc_extent_ref; |
| 1558 | } else { | 1600 | } else { |
| @@ -1565,6 +1607,11 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, | |||
| 1565 | process_func = __btrfs_update_extent_ref; | 1607 | process_func = __btrfs_update_extent_ref; |
| 1566 | } | 1608 | } |
| 1567 | 1609 | ||
| 1610 | /* | ||
| 1611 | * we make two passes through the items. In the first pass we | ||
| 1612 | * only record the byte number and slot. Then we sort based on | ||
| 1613 | * byte number and do the actual work based on the sorted results | ||
| 1614 | */ | ||
| 1568 | for (i = 0; i < nritems; i++) { | 1615 | for (i = 0; i < nritems; i++) { |
| 1569 | cond_resched(); | 1616 | cond_resched(); |
| 1570 | if (level == 0) { | 1617 | if (level == 0) { |
| @@ -1581,6 +1628,32 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, | |||
| 1581 | continue; | 1628 | continue; |
| 1582 | 1629 | ||
| 1583 | nr_file_extents++; | 1630 | nr_file_extents++; |
| 1631 | sorted[refi].bytenr = bytenr; | ||
| 1632 | sorted[refi].slot = i; | ||
| 1633 | refi++; | ||
| 1634 | } else { | ||
| 1635 | bytenr = btrfs_node_blockptr(buf, i); | ||
| 1636 | sorted[refi].bytenr = bytenr; | ||
| 1637 | sorted[refi].slot = i; | ||
| 1638 | refi++; | ||
| 1639 | } | ||
| 1640 | } | ||
| 1641 | /* | ||
| 1642 | * if refi == 0, we didn't actually put anything into the sorted | ||
| 1643 | * array and we're done | ||
| 1644 | */ | ||
| 1645 | if (refi == 0) | ||
| 1646 | goto out; | ||
| 1647 | |||
| 1648 | sort(sorted, refi, sizeof(struct refsort), refsort_cmp, NULL); | ||
| 1649 | |||
| 1650 | for (i = 0; i < refi; i++) { | ||
| 1651 | cond_resched(); | ||
| 1652 | slot = sorted[i].slot; | ||
| 1653 | bytenr = sorted[i].bytenr; | ||
| 1654 | |||
| 1655 | if (level == 0) { | ||
| 1656 | btrfs_item_key_to_cpu(buf, &key, slot); | ||
| 1584 | 1657 | ||
| 1585 | ret = process_func(trans, root, bytenr, | 1658 | ret = process_func(trans, root, bytenr, |
| 1586 | orig_buf->start, buf->start, | 1659 | orig_buf->start, buf->start, |
| @@ -1589,25 +1662,25 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, | |||
| 1589 | key.objectid); | 1662 | key.objectid); |
| 1590 | 1663 | ||
| 1591 | if (ret) { | 1664 | if (ret) { |
| 1592 | faili = i; | 1665 | faili = slot; |
| 1593 | WARN_ON(1); | 1666 | WARN_ON(1); |
| 1594 | goto fail; | 1667 | goto fail; |
| 1595 | } | 1668 | } |
| 1596 | } else { | 1669 | } else { |
| 1597 | bytenr = btrfs_node_blockptr(buf, i); | ||
| 1598 | ret = process_func(trans, root, bytenr, | 1670 | ret = process_func(trans, root, bytenr, |
| 1599 | orig_buf->start, buf->start, | 1671 | orig_buf->start, buf->start, |
| 1600 | orig_root, ref_root, | 1672 | orig_root, ref_root, |
| 1601 | orig_generation, ref_generation, | 1673 | orig_generation, ref_generation, |
| 1602 | level - 1); | 1674 | level - 1); |
| 1603 | if (ret) { | 1675 | if (ret) { |
| 1604 | faili = i; | 1676 | faili = slot; |
| 1605 | WARN_ON(1); | 1677 | WARN_ON(1); |
| 1606 | goto fail; | 1678 | goto fail; |
| 1607 | } | 1679 | } |
| 1608 | } | 1680 | } |
| 1609 | } | 1681 | } |
| 1610 | out: | 1682 | out: |
| 1683 | kfree(sorted); | ||
| 1611 | if (nr_extents) { | 1684 | if (nr_extents) { |
| 1612 | if (level == 0) | 1685 | if (level == 0) |
| 1613 | *nr_extents = nr_file_extents; | 1686 | *nr_extents = nr_file_extents; |
| @@ -1616,6 +1689,7 @@ out: | |||
| 1616 | } | 1689 | } |
| 1617 | return 0; | 1690 | return 0; |
| 1618 | fail: | 1691 | fail: |
| 1692 | kfree(sorted); | ||
| 1619 | WARN_ON(1); | 1693 | WARN_ON(1); |
| 1620 | return ret; | 1694 | return ret; |
| 1621 | } | 1695 | } |
| @@ -2159,7 +2233,8 @@ again: | |||
| 2159 | ret = find_first_extent_bit(&info->extent_ins, search, &start, | 2233 | ret = find_first_extent_bit(&info->extent_ins, search, &start, |
| 2160 | &end, EXTENT_WRITEBACK); | 2234 | &end, EXTENT_WRITEBACK); |
| 2161 | if (ret) { | 2235 | if (ret) { |
| 2162 | if (skipped && all && !num_inserts) { | 2236 | if (skipped && all && !num_inserts && |
| 2237 | list_empty(&update_list)) { | ||
| 2163 | skipped = 0; | 2238 | skipped = 0; |
| 2164 | search = 0; | 2239 | search = 0; |
| 2165 | continue; | 2240 | continue; |
| @@ -2547,6 +2622,7 @@ again: | |||
| 2547 | if (ret) { | 2622 | if (ret) { |
| 2548 | if (all && skipped && !nr) { | 2623 | if (all && skipped && !nr) { |
| 2549 | search = 0; | 2624 | search = 0; |
| 2625 | skipped = 0; | ||
| 2550 | continue; | 2626 | continue; |
| 2551 | } | 2627 | } |
| 2552 | mutex_unlock(&info->extent_ins_mutex); | 2628 | mutex_unlock(&info->extent_ins_mutex); |
| @@ -2700,13 +2776,9 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans, | |||
| 2700 | /* if metadata always pin */ | 2776 | /* if metadata always pin */ |
| 2701 | if (owner_objectid < BTRFS_FIRST_FREE_OBJECTID) { | 2777 | if (owner_objectid < BTRFS_FIRST_FREE_OBJECTID) { |
| 2702 | if (root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID) { | 2778 | if (root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID) { |
| 2703 | struct btrfs_block_group_cache *cache; | 2779 | mutex_lock(&root->fs_info->pinned_mutex); |
| 2704 | 2780 | btrfs_update_pinned_extents(root, bytenr, num_bytes, 1); | |
| 2705 | /* btrfs_free_reserved_extent */ | 2781 | mutex_unlock(&root->fs_info->pinned_mutex); |
| 2706 | cache = btrfs_lookup_block_group(root->fs_info, bytenr); | ||
| 2707 | BUG_ON(!cache); | ||
| 2708 | btrfs_add_free_space(cache, bytenr, num_bytes); | ||
| 2709 | put_block_group(cache); | ||
| 2710 | update_reserved_extents(root, bytenr, num_bytes, 0); | 2782 | update_reserved_extents(root, bytenr, num_bytes, 0); |
| 2711 | return 0; | 2783 | return 0; |
| 2712 | } | 2784 | } |
| @@ -3014,7 +3086,6 @@ loop_check: | |||
| 3014 | static void dump_space_info(struct btrfs_space_info *info, u64 bytes) | 3086 | static void dump_space_info(struct btrfs_space_info *info, u64 bytes) |
| 3015 | { | 3087 | { |
| 3016 | struct btrfs_block_group_cache *cache; | 3088 | struct btrfs_block_group_cache *cache; |
| 3017 | struct list_head *l; | ||
| 3018 | 3089 | ||
| 3019 | printk(KERN_INFO "space_info has %llu free, is %sfull\n", | 3090 | printk(KERN_INFO "space_info has %llu free, is %sfull\n", |
| 3020 | (unsigned long long)(info->total_bytes - info->bytes_used - | 3091 | (unsigned long long)(info->total_bytes - info->bytes_used - |
| @@ -3022,8 +3093,7 @@ static void dump_space_info(struct btrfs_space_info *info, u64 bytes) | |||
| 3022 | (info->full) ? "" : "not "); | 3093 | (info->full) ? "" : "not "); |
| 3023 | 3094 | ||
| 3024 | down_read(&info->groups_sem); | 3095 | down_read(&info->groups_sem); |
| 3025 | list_for_each(l, &info->block_groups) { | 3096 | list_for_each_entry(cache, &info->block_groups, list) { |
| 3026 | cache = list_entry(l, struct btrfs_block_group_cache, list); | ||
| 3027 | spin_lock(&cache->lock); | 3097 | spin_lock(&cache->lock); |
| 3028 | printk(KERN_INFO "block group %llu has %llu bytes, %llu used " | 3098 | printk(KERN_INFO "block group %llu has %llu bytes, %llu used " |
| 3029 | "%llu pinned %llu reserved\n", | 3099 | "%llu pinned %llu reserved\n", |
| @@ -3342,7 +3412,10 @@ struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, | |||
| 3342 | btrfs_set_header_generation(buf, trans->transid); | 3412 | btrfs_set_header_generation(buf, trans->transid); |
| 3343 | btrfs_tree_lock(buf); | 3413 | btrfs_tree_lock(buf); |
| 3344 | clean_tree_block(trans, root, buf); | 3414 | clean_tree_block(trans, root, buf); |
| 3415 | |||
| 3416 | btrfs_set_lock_blocking(buf); | ||
| 3345 | btrfs_set_buffer_uptodate(buf); | 3417 | btrfs_set_buffer_uptodate(buf); |
| 3418 | |||
| 3346 | if (root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID) { | 3419 | if (root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID) { |
| 3347 | set_extent_dirty(&root->dirty_log_pages, buf->start, | 3420 | set_extent_dirty(&root->dirty_log_pages, buf->start, |
| 3348 | buf->start + buf->len - 1, GFP_NOFS); | 3421 | buf->start + buf->len - 1, GFP_NOFS); |
| @@ -3351,6 +3424,7 @@ struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, | |||
| 3351 | buf->start + buf->len - 1, GFP_NOFS); | 3424 | buf->start + buf->len - 1, GFP_NOFS); |
| 3352 | } | 3425 | } |
| 3353 | trans->blocks_used++; | 3426 | trans->blocks_used++; |
| 3427 | /* this returns a buffer locked for blocking */ | ||
| 3354 | return buf; | 3428 | return buf; |
| 3355 | } | 3429 | } |
| 3356 | 3430 | ||
| @@ -3388,36 +3462,73 @@ int btrfs_drop_leaf_ref(struct btrfs_trans_handle *trans, | |||
| 3388 | { | 3462 | { |
| 3389 | u64 leaf_owner; | 3463 | u64 leaf_owner; |
| 3390 | u64 leaf_generation; | 3464 | u64 leaf_generation; |
| 3465 | struct refsort *sorted; | ||
| 3391 | struct btrfs_key key; | 3466 | struct btrfs_key key; |
| 3392 | struct btrfs_file_extent_item *fi; | 3467 | struct btrfs_file_extent_item *fi; |
| 3393 | int i; | 3468 | int i; |
| 3394 | int nritems; | 3469 | int nritems; |
| 3395 | int ret; | 3470 | int ret; |
| 3471 | int refi = 0; | ||
| 3472 | int slot; | ||
| 3396 | 3473 | ||
| 3397 | BUG_ON(!btrfs_is_leaf(leaf)); | 3474 | BUG_ON(!btrfs_is_leaf(leaf)); |
| 3398 | nritems = btrfs_header_nritems(leaf); | 3475 | nritems = btrfs_header_nritems(leaf); |
| 3399 | leaf_owner = btrfs_header_owner(leaf); | 3476 | leaf_owner = btrfs_header_owner(leaf); |
| 3400 | leaf_generation = btrfs_header_generation(leaf); | 3477 | leaf_generation = btrfs_header_generation(leaf); |
| 3401 | 3478 | ||
| 3479 | sorted = kmalloc(sizeof(*sorted) * nritems, GFP_NOFS); | ||
| 3480 | /* we do this loop twice. The first time we build a list | ||
| 3481 | * of the extents we have a reference on, then we sort the list | ||
| 3482 | * by bytenr. The second time around we actually do the | ||
| 3483 | * extent freeing. | ||
| 3484 | */ | ||
| 3402 | for (i = 0; i < nritems; i++) { | 3485 | for (i = 0; i < nritems; i++) { |
| 3403 | u64 disk_bytenr; | 3486 | u64 disk_bytenr; |
| 3404 | cond_resched(); | 3487 | cond_resched(); |
| 3405 | 3488 | ||
| 3406 | btrfs_item_key_to_cpu(leaf, &key, i); | 3489 | btrfs_item_key_to_cpu(leaf, &key, i); |
| 3490 | |||
| 3491 | /* only extents have references, skip everything else */ | ||
| 3407 | if (btrfs_key_type(&key) != BTRFS_EXTENT_DATA_KEY) | 3492 | if (btrfs_key_type(&key) != BTRFS_EXTENT_DATA_KEY) |
| 3408 | continue; | 3493 | continue; |
| 3494 | |||
| 3409 | fi = btrfs_item_ptr(leaf, i, struct btrfs_file_extent_item); | 3495 | fi = btrfs_item_ptr(leaf, i, struct btrfs_file_extent_item); |
| 3496 | |||
| 3497 | /* inline extents live in the btree, they don't have refs */ | ||
| 3410 | if (btrfs_file_extent_type(leaf, fi) == | 3498 | if (btrfs_file_extent_type(leaf, fi) == |
| 3411 | BTRFS_FILE_EXTENT_INLINE) | 3499 | BTRFS_FILE_EXTENT_INLINE) |
| 3412 | continue; | 3500 | continue; |
| 3413 | /* | 3501 | |
| 3414 | * FIXME make sure to insert a trans record that | ||
| 3415 | * repeats the snapshot del on crash | ||
| 3416 | */ | ||
| 3417 | disk_bytenr = btrfs_file_extent_disk_bytenr(leaf, fi); | 3502 | disk_bytenr = btrfs_file_extent_disk_bytenr(leaf, fi); |
| 3503 | |||
| 3504 | /* holes don't have refs */ | ||
| 3418 | if (disk_bytenr == 0) | 3505 | if (disk_bytenr == 0) |
| 3419 | continue; | 3506 | continue; |
| 3420 | 3507 | ||
| 3508 | sorted[refi].bytenr = disk_bytenr; | ||
| 3509 | sorted[refi].slot = i; | ||
| 3510 | refi++; | ||
| 3511 | } | ||
| 3512 | |||
| 3513 | if (refi == 0) | ||
| 3514 | goto out; | ||
| 3515 | |||
| 3516 | sort(sorted, refi, sizeof(struct refsort), refsort_cmp, NULL); | ||
| 3517 | |||
| 3518 | for (i = 0; i < refi; i++) { | ||
| 3519 | u64 disk_bytenr; | ||
| 3520 | |||
| 3521 | disk_bytenr = sorted[i].bytenr; | ||
| 3522 | slot = sorted[i].slot; | ||
| 3523 | |||
| 3524 | cond_resched(); | ||
| 3525 | |||
| 3526 | btrfs_item_key_to_cpu(leaf, &key, slot); | ||
| 3527 | if (btrfs_key_type(&key) != BTRFS_EXTENT_DATA_KEY) | ||
| 3528 | continue; | ||
| 3529 | |||
| 3530 | fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item); | ||
| 3531 | |||
| 3421 | ret = __btrfs_free_extent(trans, root, disk_bytenr, | 3532 | ret = __btrfs_free_extent(trans, root, disk_bytenr, |
| 3422 | btrfs_file_extent_disk_num_bytes(leaf, fi), | 3533 | btrfs_file_extent_disk_num_bytes(leaf, fi), |
| 3423 | leaf->start, leaf_owner, leaf_generation, | 3534 | leaf->start, leaf_owner, leaf_generation, |
| @@ -3428,6 +3539,8 @@ int btrfs_drop_leaf_ref(struct btrfs_trans_handle *trans, | |||
| 3428 | wake_up(&root->fs_info->transaction_throttle); | 3539 | wake_up(&root->fs_info->transaction_throttle); |
| 3429 | cond_resched(); | 3540 | cond_resched(); |
| 3430 | } | 3541 | } |
| 3542 | out: | ||
| 3543 | kfree(sorted); | ||
| 3431 | return 0; | 3544 | return 0; |
| 3432 | } | 3545 | } |
| 3433 | 3546 | ||
| @@ -3437,9 +3550,25 @@ static noinline int cache_drop_leaf_ref(struct btrfs_trans_handle *trans, | |||
| 3437 | { | 3550 | { |
| 3438 | int i; | 3551 | int i; |
| 3439 | int ret; | 3552 | int ret; |
| 3440 | struct btrfs_extent_info *info = ref->extents; | 3553 | struct btrfs_extent_info *info; |
| 3554 | struct refsort *sorted; | ||
| 3555 | |||
| 3556 | if (ref->nritems == 0) | ||
| 3557 | return 0; | ||
| 3441 | 3558 | ||
| 3559 | sorted = kmalloc(sizeof(*sorted) * ref->nritems, GFP_NOFS); | ||
| 3442 | for (i = 0; i < ref->nritems; i++) { | 3560 | for (i = 0; i < ref->nritems; i++) { |
| 3561 | sorted[i].bytenr = ref->extents[i].bytenr; | ||
| 3562 | sorted[i].slot = i; | ||
| 3563 | } | ||
| 3564 | sort(sorted, ref->nritems, sizeof(struct refsort), refsort_cmp, NULL); | ||
| 3565 | |||
| 3566 | /* | ||
| 3567 | * the items in the ref were sorted when the ref was inserted | ||
| 3568 | * into the ref cache, so this is already in order | ||
| 3569 | */ | ||
| 3570 | for (i = 0; i < ref->nritems; i++) { | ||
| 3571 | info = ref->extents + sorted[i].slot; | ||
| 3443 | ret = __btrfs_free_extent(trans, root, info->bytenr, | 3572 | ret = __btrfs_free_extent(trans, root, info->bytenr, |
| 3444 | info->num_bytes, ref->bytenr, | 3573 | info->num_bytes, ref->bytenr, |
| 3445 | ref->owner, ref->generation, | 3574 | ref->owner, ref->generation, |
| @@ -3453,6 +3582,7 @@ static noinline int cache_drop_leaf_ref(struct btrfs_trans_handle *trans, | |||
| 3453 | info++; | 3582 | info++; |
| 3454 | } | 3583 | } |
| 3455 | 3584 | ||
| 3585 | kfree(sorted); | ||
| 3456 | return 0; | 3586 | return 0; |
| 3457 | } | 3587 | } |
| 3458 | 3588 | ||
| @@ -3497,6 +3627,152 @@ static int drop_snap_lookup_refcount(struct btrfs_root *root, u64 start, | |||
| 3497 | } | 3627 | } |
| 3498 | 3628 | ||
| 3499 | /* | 3629 | /* |
| 3630 | * this is used while deleting old snapshots, and it drops the refs | ||
| 3631 | * on a whole subtree starting from a level 1 node. | ||
| 3632 | * | ||
| 3633 | * The idea is to sort all the leaf pointers, and then drop the | ||
| 3634 | * ref on all the leaves in order. Most of the time the leaves | ||
| 3635 | * will have ref cache entries, so no leaf IOs will be required to | ||
| 3636 | * find the extents they have references on. | ||
| 3637 | * | ||
| 3638 | * For each leaf, any references it has are also dropped in order | ||
| 3639 | * | ||
| 3640 | * This ends up dropping the references in something close to optimal | ||
| 3641 | * order for reading and modifying the extent allocation tree. | ||
| 3642 | */ | ||
| 3643 | static noinline int drop_level_one_refs(struct btrfs_trans_handle *trans, | ||
| 3644 | struct btrfs_root *root, | ||
| 3645 | struct btrfs_path *path) | ||
| 3646 | { | ||
| 3647 | u64 bytenr; | ||
| 3648 | u64 root_owner; | ||
| 3649 | u64 root_gen; | ||
| 3650 | struct extent_buffer *eb = path->nodes[1]; | ||
| 3651 | struct extent_buffer *leaf; | ||
| 3652 | struct btrfs_leaf_ref *ref; | ||
| 3653 | struct refsort *sorted = NULL; | ||
| 3654 | int nritems = btrfs_header_nritems(eb); | ||
| 3655 | int ret; | ||
| 3656 | int i; | ||
| 3657 | int refi = 0; | ||
| 3658 | int slot = path->slots[1]; | ||
| 3659 | u32 blocksize = btrfs_level_size(root, 0); | ||
| 3660 | u32 refs; | ||
| 3661 | |||
| 3662 | if (nritems == 0) | ||
| 3663 | goto out; | ||
| 3664 | |||
| 3665 | root_owner = btrfs_header_owner(eb); | ||
| 3666 | root_gen = btrfs_header_generation(eb); | ||
| 3667 | sorted = kmalloc(sizeof(*sorted) * nritems, GFP_NOFS); | ||
| 3668 | |||
| 3669 | /* | ||
| 3670 | * step one, sort all the leaf pointers so we don't scribble | ||
| 3671 | * randomly into the extent allocation tree | ||
| 3672 | */ | ||
| 3673 | for (i = slot; i < nritems; i++) { | ||
| 3674 | sorted[refi].bytenr = btrfs_node_blockptr(eb, i); | ||
| 3675 | sorted[refi].slot = i; | ||
| 3676 | refi++; | ||
| 3677 | } | ||
| 3678 | |||
| 3679 | /* | ||
| 3680 | * nritems won't be zero, but if we're picking up drop_snapshot | ||
| 3681 | * after a crash, slot might be > 0, so double check things | ||
| 3682 | * just in case. | ||
| 3683 | */ | ||
| 3684 | if (refi == 0) | ||
| 3685 | goto out; | ||
| 3686 | |||
| 3687 | sort(sorted, refi, sizeof(struct refsort), refsort_cmp, NULL); | ||
| 3688 | |||
| 3689 | /* | ||
| 3690 | * the first loop frees everything the leaves point to | ||
| 3691 | */ | ||
| 3692 | for (i = 0; i < refi; i++) { | ||
| 3693 | u64 ptr_gen; | ||
| 3694 | |||
| 3695 | bytenr = sorted[i].bytenr; | ||
| 3696 | |||
| 3697 | /* | ||
| 3698 | * check the reference count on this leaf. If it is > 1 | ||
| 3699 | * we just decrement it below and don't update any | ||
| 3700 | * of the refs the leaf points to. | ||
| 3701 | */ | ||
| 3702 | ret = drop_snap_lookup_refcount(root, bytenr, blocksize, &refs); | ||
| 3703 | BUG_ON(ret); | ||
| 3704 | if (refs != 1) | ||
| 3705 | continue; | ||
| 3706 | |||
| 3707 | ptr_gen = btrfs_node_ptr_generation(eb, sorted[i].slot); | ||
| 3708 | |||
| 3709 | /* | ||
| 3710 | * the leaf only had one reference, which means the | ||
| 3711 | * only thing pointing to this leaf is the snapshot | ||
| 3712 | * we're deleting. It isn't possible for the reference | ||
| 3713 | * count to increase again later | ||
| 3714 | * | ||
| 3715 | * The reference cache is checked for the leaf, | ||
| 3716 | * and if found we'll be able to drop any refs held by | ||
| 3717 | * the leaf without needing to read it in. | ||
| 3718 | */ | ||
| 3719 | ref = btrfs_lookup_leaf_ref(root, bytenr); | ||
| 3720 | if (ref && ref->generation != ptr_gen) { | ||
| 3721 | btrfs_free_leaf_ref(root, ref); | ||
| 3722 | ref = NULL; | ||
| 3723 | } | ||
| 3724 | if (ref) { | ||
| 3725 | ret = cache_drop_leaf_ref(trans, root, ref); | ||
| 3726 | BUG_ON(ret); | ||
| 3727 | btrfs_remove_leaf_ref(root, ref); | ||
| 3728 | btrfs_free_leaf_ref(root, ref); | ||
| 3729 | } else { | ||
| 3730 | /* | ||
| 3731 | * the leaf wasn't in the reference cache, so | ||
| 3732 | * we have to read it. | ||
| 3733 | */ | ||
| 3734 | leaf = read_tree_block(root, bytenr, blocksize, | ||
| 3735 | ptr_gen); | ||
| 3736 | ret = btrfs_drop_leaf_ref(trans, root, leaf); | ||
| 3737 | BUG_ON(ret); | ||
| 3738 | free_extent_buffer(leaf); | ||
| 3739 | } | ||
| 3740 | atomic_inc(&root->fs_info->throttle_gen); | ||
| 3741 | wake_up(&root->fs_info->transaction_throttle); | ||
| 3742 | cond_resched(); | ||
| 3743 | } | ||
| 3744 | |||
| 3745 | /* | ||
| 3746 | * run through the loop again to free the refs on the leaves. | ||
| 3747 | * This is faster than doing it in the loop above because | ||
| 3748 | * the leaves are likely to be clustered together. We end up | ||
| 3749 | * working in nice chunks on the extent allocation tree. | ||
| 3750 | */ | ||
| 3751 | for (i = 0; i < refi; i++) { | ||
| 3752 | bytenr = sorted[i].bytenr; | ||
| 3753 | ret = __btrfs_free_extent(trans, root, bytenr, | ||
| 3754 | blocksize, eb->start, | ||
| 3755 | root_owner, root_gen, 0, 1); | ||
| 3756 | BUG_ON(ret); | ||
| 3757 | |||
| 3758 | atomic_inc(&root->fs_info->throttle_gen); | ||
| 3759 | wake_up(&root->fs_info->transaction_throttle); | ||
| 3760 | cond_resched(); | ||
| 3761 | } | ||
| 3762 | out: | ||
| 3763 | kfree(sorted); | ||
| 3764 | |||
| 3765 | /* | ||
| 3766 | * update the path to show we've processed the entire level 1 | ||
| 3767 | * node. This will get saved into the root's drop_snapshot_progress | ||
| 3768 | * field so these drops are not repeated again if this transaction | ||
| 3769 | * commits. | ||
| 3770 | */ | ||
| 3771 | path->slots[1] = nritems; | ||
| 3772 | return 0; | ||
| 3773 | } | ||
| 3774 | |||
| 3775 | /* | ||
| 3500 | * helper function for drop_snapshot, this walks down the tree dropping ref | 3776 | * helper function for drop_snapshot, this walks down the tree dropping ref |
| 3501 | * counts as it goes. | 3777 | * counts as it goes. |
| 3502 | */ | 3778 | */ |
| @@ -3511,7 +3787,6 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans, | |||
| 3511 | struct extent_buffer *next; | 3787 | struct extent_buffer *next; |
| 3512 | struct extent_buffer *cur; | 3788 | struct extent_buffer *cur; |
| 3513 | struct extent_buffer *parent; | 3789 | struct extent_buffer *parent; |
| 3514 | struct btrfs_leaf_ref *ref; | ||
| 3515 | u32 blocksize; | 3790 | u32 blocksize; |
| 3516 | int ret; | 3791 | int ret; |
| 3517 | u32 refs; | 3792 | u32 refs; |
| @@ -3538,17 +3813,46 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans, | |||
| 3538 | if (path->slots[*level] >= | 3813 | if (path->slots[*level] >= |
| 3539 | btrfs_header_nritems(cur)) | 3814 | btrfs_header_nritems(cur)) |
| 3540 | break; | 3815 | break; |
| 3816 | |||
| 3817 | /* the new code goes down to level 1 and does all the | ||
| 3818 | * leaves pointed to that node in bulk. So, this check | ||
| 3819 | * for level 0 will always be false. | ||
| 3820 | * | ||
| 3821 | * But, the disk format allows the drop_snapshot_progress | ||
| 3822 | * field in the root to leave things in a state where | ||
| 3823 | * a leaf will need cleaning up here. If someone crashes | ||
| 3824 | * with the old code and then boots with the new code, | ||
| 3825 | * we might find a leaf here. | ||
| 3826 | */ | ||
| 3541 | if (*level == 0) { | 3827 | if (*level == 0) { |
| 3542 | ret = btrfs_drop_leaf_ref(trans, root, cur); | 3828 | ret = btrfs_drop_leaf_ref(trans, root, cur); |
| 3543 | BUG_ON(ret); | 3829 | BUG_ON(ret); |
| 3544 | break; | 3830 | break; |
| 3545 | } | 3831 | } |
| 3832 | |||
| 3833 | /* | ||
| 3834 | * once we get to level one, process the whole node | ||
| 3835 | * at once, including everything below it. | ||
| 3836 | */ | ||
| 3837 | if (*level == 1) { | ||
| 3838 | ret = drop_level_one_refs(trans, root, path); | ||
| 3839 | BUG_ON(ret); | ||
| 3840 | break; | ||
| 3841 | } | ||
| 3842 | |||
| 3546 | bytenr = btrfs_node_blockptr(cur, path->slots[*level]); | 3843 | bytenr = btrfs_node_blockptr(cur, path->slots[*level]); |
| 3547 | ptr_gen = btrfs_node_ptr_generation(cur, path->slots[*level]); | 3844 | ptr_gen = btrfs_node_ptr_generation(cur, path->slots[*level]); |
| 3548 | blocksize = btrfs_level_size(root, *level - 1); | 3845 | blocksize = btrfs_level_size(root, *level - 1); |
| 3549 | 3846 | ||
| 3550 | ret = drop_snap_lookup_refcount(root, bytenr, blocksize, &refs); | 3847 | ret = drop_snap_lookup_refcount(root, bytenr, blocksize, &refs); |
| 3551 | BUG_ON(ret); | 3848 | BUG_ON(ret); |
| 3849 | |||
| 3850 | /* | ||
| 3851 | * if there is more than one reference, we don't need | ||
| 3852 | * to read that node to drop any references it has. We | ||
| 3853 | * just drop the ref we hold on that node and move on to the | ||
| 3854 | * next slot in this level. | ||
| 3855 | */ | ||
| 3552 | if (refs != 1) { | 3856 | if (refs != 1) { |
| 3553 | parent = path->nodes[*level]; | 3857 | parent = path->nodes[*level]; |
| 3554 | root_owner = btrfs_header_owner(parent); | 3858 | root_owner = btrfs_header_owner(parent); |
| @@ -3567,46 +3871,12 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans, | |||
| 3567 | 3871 | ||
| 3568 | continue; | 3872 | continue; |
| 3569 | } | 3873 | } |
| 3874 | |||
| 3570 | /* | 3875 | /* |
| 3571 | * at this point, we have a single ref, and since the | 3876 | * we need to keep freeing things in the next level down. |
| 3572 | * only place referencing this extent is a dead root | 3877 | * read the block and loop around to process it |
| 3573 | * the reference count should never go higher. | ||
| 3574 | * So, we don't need to check it again | ||
| 3575 | */ | 3878 | */ |
| 3576 | if (*level == 1) { | 3879 | next = read_tree_block(root, bytenr, blocksize, ptr_gen); |
| 3577 | ref = btrfs_lookup_leaf_ref(root, bytenr); | ||
| 3578 | if (ref && ref->generation != ptr_gen) { | ||
| 3579 | btrfs_free_leaf_ref(root, ref); | ||
| 3580 | ref = NULL; | ||
| 3581 | } | ||
| 3582 | if (ref) { | ||
| 3583 | ret = cache_drop_leaf_ref(trans, root, ref); | ||
| 3584 | BUG_ON(ret); | ||
| 3585 | btrfs_remove_leaf_ref(root, ref); | ||
| 3586 | btrfs_free_leaf_ref(root, ref); | ||
| 3587 | *level = 0; | ||
| 3588 | break; | ||
| 3589 | } | ||
| 3590 | } | ||
| 3591 | next = btrfs_find_tree_block(root, bytenr, blocksize); | ||
| 3592 | if (!next || !btrfs_buffer_uptodate(next, ptr_gen)) { | ||
| 3593 | free_extent_buffer(next); | ||
| 3594 | |||
| 3595 | next = read_tree_block(root, bytenr, blocksize, | ||
| 3596 | ptr_gen); | ||
| 3597 | cond_resched(); | ||
| 3598 | #if 0 | ||
| 3599 | /* | ||
| 3600 | * this is a debugging check and can go away | ||
| 3601 | * the ref should never go all the way down to 1 | ||
| 3602 | * at this point | ||
| 3603 | */ | ||
| 3604 | ret = lookup_extent_ref(NULL, root, bytenr, blocksize, | ||
| 3605 | &refs); | ||
| 3606 | BUG_ON(ret); | ||
| 3607 | WARN_ON(refs != 1); | ||
| 3608 | #endif | ||
| 3609 | } | ||
| 3610 | WARN_ON(*level <= 0); | 3880 | WARN_ON(*level <= 0); |
| 3611 | if (path->nodes[*level-1]) | 3881 | if (path->nodes[*level-1]) |
| 3612 | free_extent_buffer(path->nodes[*level-1]); | 3882 | free_extent_buffer(path->nodes[*level-1]); |
| @@ -3631,11 +3901,16 @@ out: | |||
| 3631 | root_owner = btrfs_header_owner(parent); | 3901 | root_owner = btrfs_header_owner(parent); |
| 3632 | root_gen = btrfs_header_generation(parent); | 3902 | root_gen = btrfs_header_generation(parent); |
| 3633 | 3903 | ||
| 3904 | /* | ||
| 3905 | * cleanup and free the reference on the last node | ||
| 3906 | * we processed | ||
| 3907 | */ | ||
| 3634 | ret = __btrfs_free_extent(trans, root, bytenr, blocksize, | 3908 | ret = __btrfs_free_extent(trans, root, bytenr, blocksize, |
| 3635 | parent->start, root_owner, root_gen, | 3909 | parent->start, root_owner, root_gen, |
| 3636 | *level, 1); | 3910 | *level, 1); |
| 3637 | free_extent_buffer(path->nodes[*level]); | 3911 | free_extent_buffer(path->nodes[*level]); |
| 3638 | path->nodes[*level] = NULL; | 3912 | path->nodes[*level] = NULL; |
| 3913 | |||
| 3639 | *level += 1; | 3914 | *level += 1; |
| 3640 | BUG_ON(ret); | 3915 | BUG_ON(ret); |
| 3641 | 3916 | ||
| @@ -3687,6 +3962,7 @@ static noinline int walk_down_subtree(struct btrfs_trans_handle *trans, | |||
| 3687 | 3962 | ||
| 3688 | next = read_tree_block(root, bytenr, blocksize, ptr_gen); | 3963 | next = read_tree_block(root, bytenr, blocksize, ptr_gen); |
| 3689 | btrfs_tree_lock(next); | 3964 | btrfs_tree_lock(next); |
| 3965 | btrfs_set_lock_blocking(next); | ||
| 3690 | 3966 | ||
| 3691 | ret = btrfs_lookup_extent_ref(trans, root, bytenr, blocksize, | 3967 | ret = btrfs_lookup_extent_ref(trans, root, bytenr, blocksize, |
| 3692 | &refs); | 3968 | &refs); |
| @@ -3754,6 +4030,13 @@ static noinline int walk_up_tree(struct btrfs_trans_handle *trans, | |||
| 3754 | if (slot < btrfs_header_nritems(path->nodes[i]) - 1) { | 4030 | if (slot < btrfs_header_nritems(path->nodes[i]) - 1) { |
| 3755 | struct extent_buffer *node; | 4031 | struct extent_buffer *node; |
| 3756 | struct btrfs_disk_key disk_key; | 4032 | struct btrfs_disk_key disk_key; |
| 4033 | |||
| 4034 | /* | ||
| 4035 | * there is more work to do in this level. | ||
| 4036 | * Update the drop_progress marker to reflect | ||
| 4037 | * the work we've done so far, and then bump | ||
| 4038 | * the slot number | ||
| 4039 | */ | ||
| 3757 | node = path->nodes[i]; | 4040 | node = path->nodes[i]; |
| 3758 | path->slots[i]++; | 4041 | path->slots[i]++; |
| 3759 | *level = i; | 4042 | *level = i; |
| @@ -3765,6 +4048,11 @@ static noinline int walk_up_tree(struct btrfs_trans_handle *trans, | |||
| 3765 | return 0; | 4048 | return 0; |
| 3766 | } else { | 4049 | } else { |
| 3767 | struct extent_buffer *parent; | 4050 | struct extent_buffer *parent; |
| 4051 | |||
| 4052 | /* | ||
| 4053 | * this whole node is done, free our reference | ||
| 4054 | * on it and go up one level | ||
| 4055 | */ | ||
| 3768 | if (path->nodes[*level] == root->node) | 4056 | if (path->nodes[*level] == root->node) |
| 3769 | parent = path->nodes[*level]; | 4057 | parent = path->nodes[*level]; |
| 3770 | else | 4058 | else |
| @@ -4444,7 +4732,7 @@ static noinline int replace_one_extent(struct btrfs_trans_handle *trans, | |||
| 4444 | u64 lock_end = 0; | 4732 | u64 lock_end = 0; |
| 4445 | u64 num_bytes; | 4733 | u64 num_bytes; |
| 4446 | u64 ext_offset; | 4734 | u64 ext_offset; |
| 4447 | u64 first_pos; | 4735 | u64 search_end = (u64)-1; |
| 4448 | u32 nritems; | 4736 | u32 nritems; |
| 4449 | int nr_scaned = 0; | 4737 | int nr_scaned = 0; |
| 4450 | int extent_locked = 0; | 4738 | int extent_locked = 0; |
| @@ -4452,7 +4740,6 @@ static noinline int replace_one_extent(struct btrfs_trans_handle *trans, | |||
| 4452 | int ret; | 4740 | int ret; |
| 4453 | 4741 | ||
| 4454 | memcpy(&key, leaf_key, sizeof(key)); | 4742 | memcpy(&key, leaf_key, sizeof(key)); |
| 4455 | first_pos = INT_LIMIT(loff_t) - extent_key->offset; | ||
| 4456 | if (ref_path->owner_objectid != BTRFS_MULTIPLE_OBJECTIDS) { | 4743 | if (ref_path->owner_objectid != BTRFS_MULTIPLE_OBJECTIDS) { |
| 4457 | if (key.objectid < ref_path->owner_objectid || | 4744 | if (key.objectid < ref_path->owner_objectid || |
| 4458 | (key.objectid == ref_path->owner_objectid && | 4745 | (key.objectid == ref_path->owner_objectid && |
| @@ -4501,7 +4788,7 @@ next: | |||
| 4501 | if ((key.objectid > ref_path->owner_objectid) || | 4788 | if ((key.objectid > ref_path->owner_objectid) || |
| 4502 | (key.objectid == ref_path->owner_objectid && | 4789 | (key.objectid == ref_path->owner_objectid && |
| 4503 | key.type > BTRFS_EXTENT_DATA_KEY) || | 4790 | key.type > BTRFS_EXTENT_DATA_KEY) || |
| 4504 | (key.offset >= first_pos + extent_key->offset)) | 4791 | key.offset >= search_end) |
| 4505 | break; | 4792 | break; |
| 4506 | } | 4793 | } |
| 4507 | 4794 | ||
| @@ -4534,8 +4821,10 @@ next: | |||
| 4534 | num_bytes = btrfs_file_extent_num_bytes(leaf, fi); | 4821 | num_bytes = btrfs_file_extent_num_bytes(leaf, fi); |
| 4535 | ext_offset = btrfs_file_extent_offset(leaf, fi); | 4822 | ext_offset = btrfs_file_extent_offset(leaf, fi); |
| 4536 | 4823 | ||
| 4537 | if (first_pos > key.offset - ext_offset) | 4824 | if (search_end == (u64)-1) { |
| 4538 | first_pos = key.offset - ext_offset; | 4825 | search_end = key.offset - ext_offset + |
| 4826 | btrfs_file_extent_ram_bytes(leaf, fi); | ||
| 4827 | } | ||
| 4539 | 4828 | ||
| 4540 | if (!extent_locked) { | 4829 | if (!extent_locked) { |
| 4541 | lock_start = key.offset; | 4830 | lock_start = key.offset; |
| @@ -4724,7 +5013,7 @@ next: | |||
| 4724 | } | 5013 | } |
| 4725 | skip: | 5014 | skip: |
| 4726 | if (ref_path->owner_objectid != BTRFS_MULTIPLE_OBJECTIDS && | 5015 | if (ref_path->owner_objectid != BTRFS_MULTIPLE_OBJECTIDS && |
| 4727 | key.offset >= first_pos + extent_key->offset) | 5016 | key.offset >= search_end) |
| 4728 | break; | 5017 | break; |
| 4729 | 5018 | ||
| 4730 | cond_resched(); | 5019 | cond_resched(); |
| @@ -4778,6 +5067,7 @@ int btrfs_reloc_tree_cache_ref(struct btrfs_trans_handle *trans, | |||
| 4778 | ref->bytenr = buf->start; | 5067 | ref->bytenr = buf->start; |
| 4779 | ref->owner = btrfs_header_owner(buf); | 5068 | ref->owner = btrfs_header_owner(buf); |
| 4780 | ref->generation = btrfs_header_generation(buf); | 5069 | ref->generation = btrfs_header_generation(buf); |
| 5070 | |||
| 4781 | ret = btrfs_add_leaf_ref(root, ref, 0); | 5071 | ret = btrfs_add_leaf_ref(root, ref, 0); |
| 4782 | WARN_ON(ret); | 5072 | WARN_ON(ret); |
| 4783 | btrfs_free_leaf_ref(root, ref); | 5073 | btrfs_free_leaf_ref(root, ref); |
| @@ -5957,9 +6247,11 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, | |||
| 5957 | path = btrfs_alloc_path(); | 6247 | path = btrfs_alloc_path(); |
| 5958 | BUG_ON(!path); | 6248 | BUG_ON(!path); |
| 5959 | 6249 | ||
| 5960 | btrfs_remove_free_space_cache(block_group); | 6250 | spin_lock(&root->fs_info->block_group_cache_lock); |
| 5961 | rb_erase(&block_group->cache_node, | 6251 | rb_erase(&block_group->cache_node, |
| 5962 | &root->fs_info->block_group_cache_tree); | 6252 | &root->fs_info->block_group_cache_tree); |
| 6253 | spin_unlock(&root->fs_info->block_group_cache_lock); | ||
| 6254 | btrfs_remove_free_space_cache(block_group); | ||
| 5963 | down_write(&block_group->space_info->groups_sem); | 6255 | down_write(&block_group->space_info->groups_sem); |
| 5964 | list_del(&block_group->list); | 6256 | list_del(&block_group->list); |
| 5965 | up_write(&block_group->space_info->groups_sem); | 6257 | up_write(&block_group->space_info->groups_sem); |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index e086d407f1fa..37d43b516b79 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | #include <linux/spinlock.h> | 9 | #include <linux/spinlock.h> |
| 10 | #include <linux/blkdev.h> | 10 | #include <linux/blkdev.h> |
| 11 | #include <linux/swap.h> | 11 | #include <linux/swap.h> |
| 12 | #include <linux/version.h> | ||
| 13 | #include <linux/writeback.h> | 12 | #include <linux/writeback.h> |
| 14 | #include <linux/pagevec.h> | 13 | #include <linux/pagevec.h> |
| 15 | #include "extent_io.h" | 14 | #include "extent_io.h" |
| @@ -31,7 +30,7 @@ static LIST_HEAD(buffers); | |||
| 31 | static LIST_HEAD(states); | 30 | static LIST_HEAD(states); |
| 32 | 31 | ||
| 33 | #define LEAK_DEBUG 0 | 32 | #define LEAK_DEBUG 0 |
| 34 | #ifdef LEAK_DEBUG | 33 | #if LEAK_DEBUG |
| 35 | static DEFINE_SPINLOCK(leak_lock); | 34 | static DEFINE_SPINLOCK(leak_lock); |
| 36 | #endif | 35 | #endif |
| 37 | 36 | ||
| @@ -120,7 +119,7 @@ void extent_io_tree_init(struct extent_io_tree *tree, | |||
| 120 | static struct extent_state *alloc_extent_state(gfp_t mask) | 119 | static struct extent_state *alloc_extent_state(gfp_t mask) |
| 121 | { | 120 | { |
| 122 | struct extent_state *state; | 121 | struct extent_state *state; |
| 123 | #ifdef LEAK_DEBUG | 122 | #if LEAK_DEBUG |
| 124 | unsigned long flags; | 123 | unsigned long flags; |
| 125 | #endif | 124 | #endif |
| 126 | 125 | ||
| @@ -130,7 +129,7 @@ static struct extent_state *alloc_extent_state(gfp_t mask) | |||
| 130 | state->state = 0; | 129 | state->state = 0; |
| 131 | state->private = 0; | 130 | state->private = 0; |
| 132 | state->tree = NULL; | 131 | state->tree = NULL; |
| 133 | #ifdef LEAK_DEBUG | 132 | #if LEAK_DEBUG |
| 134 | spin_lock_irqsave(&leak_lock, flags); | 133 | spin_lock_irqsave(&leak_lock, flags); |
| 135 | list_add(&state->leak_list, &states); | 134 | list_add(&state->leak_list, &states); |
| 136 | spin_unlock_irqrestore(&leak_lock, flags); | 135 | spin_unlock_irqrestore(&leak_lock, flags); |
| @@ -145,11 +144,11 @@ static void free_extent_state(struct extent_state *state) | |||
| 145 | if (!state) | 144 | if (!state) |
| 146 | return; | 145 | return; |
| 147 | if (atomic_dec_and_test(&state->refs)) { | 146 | if (atomic_dec_and_test(&state->refs)) { |
| 148 | #ifdef LEAK_DEBUG | 147 | #if LEAK_DEBUG |
| 149 | unsigned long flags; | 148 | unsigned long flags; |
| 150 | #endif | 149 | #endif |
| 151 | WARN_ON(state->tree); | 150 | WARN_ON(state->tree); |
| 152 | #ifdef LEAK_DEBUG | 151 | #if LEAK_DEBUG |
| 153 | spin_lock_irqsave(&leak_lock, flags); | 152 | spin_lock_irqsave(&leak_lock, flags); |
| 154 | list_del(&state->leak_list); | 153 | list_del(&state->leak_list); |
| 155 | spin_unlock_irqrestore(&leak_lock, flags); | 154 | spin_unlock_irqrestore(&leak_lock, flags); |
| @@ -2378,11 +2377,6 @@ static int extent_write_cache_pages(struct extent_io_tree *tree, | |||
| 2378 | int scanned = 0; | 2377 | int scanned = 0; |
| 2379 | int range_whole = 0; | 2378 | int range_whole = 0; |
| 2380 | 2379 | ||
| 2381 | if (wbc->nonblocking && bdi_write_congested(bdi)) { | ||
| 2382 | wbc->encountered_congestion = 1; | ||
| 2383 | return 0; | ||
| 2384 | } | ||
| 2385 | |||
| 2386 | pagevec_init(&pvec, 0); | 2380 | pagevec_init(&pvec, 0); |
| 2387 | if (wbc->range_cyclic) { | 2381 | if (wbc->range_cyclic) { |
| 2388 | index = mapping->writeback_index; /* Start from prev offset */ | 2382 | index = mapping->writeback_index; /* Start from prev offset */ |
| @@ -2855,6 +2849,98 @@ out: | |||
| 2855 | return sector; | 2849 | return sector; |
| 2856 | } | 2850 | } |
| 2857 | 2851 | ||
| 2852 | int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | ||
| 2853 | __u64 start, __u64 len, get_extent_t *get_extent) | ||
| 2854 | { | ||
| 2855 | int ret; | ||
| 2856 | u64 off = start; | ||
| 2857 | u64 max = start + len; | ||
| 2858 | u32 flags = 0; | ||
| 2859 | u64 disko = 0; | ||
| 2860 | struct extent_map *em = NULL; | ||
| 2861 | int end = 0; | ||
| 2862 | u64 em_start = 0, em_len = 0; | ||
| 2863 | unsigned long emflags; | ||
| 2864 | ret = 0; | ||
| 2865 | |||
| 2866 | if (len == 0) | ||
| 2867 | return -EINVAL; | ||
| 2868 | |||
| 2869 | lock_extent(&BTRFS_I(inode)->io_tree, start, start + len, | ||
| 2870 | GFP_NOFS); | ||
| 2871 | em = get_extent(inode, NULL, 0, off, max - off, 0); | ||
| 2872 | if (!em) | ||
| 2873 | goto out; | ||
| 2874 | if (IS_ERR(em)) { | ||
| 2875 | ret = PTR_ERR(em); | ||
| 2876 | goto out; | ||
| 2877 | } | ||
| 2878 | while (!end) { | ||
| 2879 | off = em->start + em->len; | ||
| 2880 | if (off >= max) | ||
| 2881 | end = 1; | ||
| 2882 | |||
| 2883 | em_start = em->start; | ||
| 2884 | em_len = em->len; | ||
| 2885 | |||
| 2886 | disko = 0; | ||
| 2887 | flags = 0; | ||
| 2888 | |||
| 2889 | switch (em->block_start) { | ||
| 2890 | case EXTENT_MAP_LAST_BYTE: | ||
| 2891 | end = 1; | ||
| 2892 | flags |= FIEMAP_EXTENT_LAST; | ||
| 2893 | break; | ||
| 2894 | case EXTENT_MAP_HOLE: | ||
| 2895 | flags |= FIEMAP_EXTENT_UNWRITTEN; | ||
| 2896 | break; | ||
| 2897 | case EXTENT_MAP_INLINE: | ||
| 2898 | flags |= (FIEMAP_EXTENT_DATA_INLINE | | ||
| 2899 | FIEMAP_EXTENT_NOT_ALIGNED); | ||
| 2900 | break; | ||
| 2901 | case EXTENT_MAP_DELALLOC: | ||
| 2902 | flags |= (FIEMAP_EXTENT_DELALLOC | | ||
| 2903 | FIEMAP_EXTENT_UNKNOWN); | ||
| 2904 | break; | ||
| 2905 | default: | ||
| 2906 | disko = em->block_start; | ||
| 2907 | break; | ||
| 2908 | } | ||
| 2909 | if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) | ||
| 2910 | flags |= FIEMAP_EXTENT_ENCODED; | ||
| 2911 | |||
| 2912 | emflags = em->flags; | ||
| 2913 | free_extent_map(em); | ||
| 2914 | em = NULL; | ||
| 2915 | |||
| 2916 | if (!end) { | ||
| 2917 | em = get_extent(inode, NULL, 0, off, max - off, 0); | ||
| 2918 | if (!em) | ||
| 2919 | goto out; | ||
| 2920 | if (IS_ERR(em)) { | ||
| 2921 | ret = PTR_ERR(em); | ||
| 2922 | goto out; | ||
| 2923 | } | ||
| 2924 | emflags = em->flags; | ||
| 2925 | } | ||
| 2926 | if (test_bit(EXTENT_FLAG_VACANCY, &emflags)) { | ||
| 2927 | flags |= FIEMAP_EXTENT_LAST; | ||
| 2928 | end = 1; | ||
| 2929 | } | ||
| 2930 | |||
| 2931 | ret = fiemap_fill_next_extent(fieinfo, em_start, disko, | ||
| 2932 | em_len, flags); | ||
| 2933 | if (ret) | ||
| 2934 | goto out_free; | ||
| 2935 | } | ||
| 2936 | out_free: | ||
| 2937 | free_extent_map(em); | ||
| 2938 | out: | ||
| 2939 | unlock_extent(&BTRFS_I(inode)->io_tree, start, start + len, | ||
| 2940 | GFP_NOFS); | ||
| 2941 | return ret; | ||
| 2942 | } | ||
| 2943 | |||
| 2858 | static inline struct page *extent_buffer_page(struct extent_buffer *eb, | 2944 | static inline struct page *extent_buffer_page(struct extent_buffer *eb, |
| 2859 | unsigned long i) | 2945 | unsigned long i) |
| 2860 | { | 2946 | { |
| @@ -2892,15 +2978,17 @@ static struct extent_buffer *__alloc_extent_buffer(struct extent_io_tree *tree, | |||
| 2892 | gfp_t mask) | 2978 | gfp_t mask) |
| 2893 | { | 2979 | { |
| 2894 | struct extent_buffer *eb = NULL; | 2980 | struct extent_buffer *eb = NULL; |
| 2895 | #ifdef LEAK_DEBUG | 2981 | #if LEAK_DEBUG |
| 2896 | unsigned long flags; | 2982 | unsigned long flags; |
| 2897 | #endif | 2983 | #endif |
| 2898 | 2984 | ||
| 2899 | eb = kmem_cache_zalloc(extent_buffer_cache, mask); | 2985 | eb = kmem_cache_zalloc(extent_buffer_cache, mask); |
| 2900 | eb->start = start; | 2986 | eb->start = start; |
| 2901 | eb->len = len; | 2987 | eb->len = len; |
| 2902 | mutex_init(&eb->mutex); | 2988 | spin_lock_init(&eb->lock); |
| 2903 | #ifdef LEAK_DEBUG | 2989 | init_waitqueue_head(&eb->lock_wq); |
| 2990 | |||
| 2991 | #if LEAK_DEBUG | ||
| 2904 | spin_lock_irqsave(&leak_lock, flags); | 2992 | spin_lock_irqsave(&leak_lock, flags); |
| 2905 | list_add(&eb->leak_list, &buffers); | 2993 | list_add(&eb->leak_list, &buffers); |
| 2906 | spin_unlock_irqrestore(&leak_lock, flags); | 2994 | spin_unlock_irqrestore(&leak_lock, flags); |
| @@ -2912,7 +3000,7 @@ static struct extent_buffer *__alloc_extent_buffer(struct extent_io_tree *tree, | |||
| 2912 | 3000 | ||
| 2913 | static void __free_extent_buffer(struct extent_buffer *eb) | 3001 | static void __free_extent_buffer(struct extent_buffer *eb) |
| 2914 | { | 3002 | { |
| 2915 | #ifdef LEAK_DEBUG | 3003 | #if LEAK_DEBUG |
| 2916 | unsigned long flags; | 3004 | unsigned long flags; |
| 2917 | spin_lock_irqsave(&leak_lock, flags); | 3005 | spin_lock_irqsave(&leak_lock, flags); |
| 2918 | list_del(&eb->leak_list); | 3006 | list_del(&eb->leak_list); |
| @@ -2980,8 +3068,7 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree, | |||
| 2980 | unlock_page(p); | 3068 | unlock_page(p); |
| 2981 | } | 3069 | } |
| 2982 | if (uptodate) | 3070 | if (uptodate) |
| 2983 | eb->flags |= EXTENT_UPTODATE; | 3071 | set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); |
| 2984 | eb->flags |= EXTENT_BUFFER_FILLED; | ||
| 2985 | 3072 | ||
| 2986 | spin_lock(&tree->buffer_lock); | 3073 | spin_lock(&tree->buffer_lock); |
| 2987 | exists = buffer_tree_insert(tree, start, &eb->rb_node); | 3074 | exists = buffer_tree_insert(tree, start, &eb->rb_node); |
| @@ -3135,7 +3222,7 @@ int clear_extent_buffer_uptodate(struct extent_io_tree *tree, | |||
| 3135 | unsigned long num_pages; | 3222 | unsigned long num_pages; |
| 3136 | 3223 | ||
| 3137 | num_pages = num_extent_pages(eb->start, eb->len); | 3224 | num_pages = num_extent_pages(eb->start, eb->len); |
| 3138 | eb->flags &= ~EXTENT_UPTODATE; | 3225 | clear_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); |
| 3139 | 3226 | ||
| 3140 | clear_extent_uptodate(tree, eb->start, eb->start + eb->len - 1, | 3227 | clear_extent_uptodate(tree, eb->start, eb->start + eb->len - 1, |
| 3141 | GFP_NOFS); | 3228 | GFP_NOFS); |
| @@ -3206,7 +3293,7 @@ int extent_buffer_uptodate(struct extent_io_tree *tree, | |||
| 3206 | struct page *page; | 3293 | struct page *page; |
| 3207 | int pg_uptodate = 1; | 3294 | int pg_uptodate = 1; |
| 3208 | 3295 | ||
| 3209 | if (eb->flags & EXTENT_UPTODATE) | 3296 | if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags)) |
| 3210 | return 1; | 3297 | return 1; |
| 3211 | 3298 | ||
| 3212 | ret = test_range_bit(tree, eb->start, eb->start + eb->len - 1, | 3299 | ret = test_range_bit(tree, eb->start, eb->start + eb->len - 1, |
| @@ -3242,7 +3329,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, | |||
| 3242 | struct bio *bio = NULL; | 3329 | struct bio *bio = NULL; |
| 3243 | unsigned long bio_flags = 0; | 3330 | unsigned long bio_flags = 0; |
| 3244 | 3331 | ||
| 3245 | if (eb->flags & EXTENT_UPTODATE) | 3332 | if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags)) |
| 3246 | return 0; | 3333 | return 0; |
| 3247 | 3334 | ||
| 3248 | if (test_range_bit(tree, eb->start, eb->start + eb->len - 1, | 3335 | if (test_range_bit(tree, eb->start, eb->start + eb->len - 1, |
| @@ -3273,7 +3360,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, | |||
| 3273 | } | 3360 | } |
| 3274 | if (all_uptodate) { | 3361 | if (all_uptodate) { |
| 3275 | if (start_i == 0) | 3362 | if (start_i == 0) |
| 3276 | eb->flags |= EXTENT_UPTODATE; | 3363 | set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); |
| 3277 | goto unlock_exit; | 3364 | goto unlock_exit; |
| 3278 | } | 3365 | } |
| 3279 | 3366 | ||
| @@ -3309,7 +3396,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, | |||
| 3309 | } | 3396 | } |
| 3310 | 3397 | ||
| 3311 | if (!ret) | 3398 | if (!ret) |
| 3312 | eb->flags |= EXTENT_UPTODATE; | 3399 | set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); |
| 3313 | return ret; | 3400 | return ret; |
| 3314 | 3401 | ||
| 3315 | unlock_exit: | 3402 | unlock_exit: |
| @@ -3406,7 +3493,6 @@ int map_extent_buffer(struct extent_buffer *eb, unsigned long start, | |||
| 3406 | unmap_extent_buffer(eb, eb->map_token, km); | 3493 | unmap_extent_buffer(eb, eb->map_token, km); |
| 3407 | eb->map_token = NULL; | 3494 | eb->map_token = NULL; |
| 3408 | save = 1; | 3495 | save = 1; |
| 3409 | WARN_ON(!mutex_is_locked(&eb->mutex)); | ||
| 3410 | } | 3496 | } |
| 3411 | err = map_private_extent_buffer(eb, start, min_len, token, map, | 3497 | err = map_private_extent_buffer(eb, start, min_len, token, map, |
| 3412 | map_start, map_len, km); | 3498 | map_start, map_len, km); |
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index c5b483a79137..1f9df88afbf6 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
| @@ -22,6 +22,10 @@ | |||
| 22 | /* flags for bio submission */ | 22 | /* flags for bio submission */ |
| 23 | #define EXTENT_BIO_COMPRESSED 1 | 23 | #define EXTENT_BIO_COMPRESSED 1 |
| 24 | 24 | ||
| 25 | /* these are bit numbers for test/set bit */ | ||
| 26 | #define EXTENT_BUFFER_UPTODATE 0 | ||
| 27 | #define EXTENT_BUFFER_BLOCKING 1 | ||
| 28 | |||
| 25 | /* | 29 | /* |
| 26 | * page->private values. Every page that is controlled by the extent | 30 | * page->private values. Every page that is controlled by the extent |
| 27 | * map has page->private set to one. | 31 | * map has page->private set to one. |
| @@ -95,11 +99,19 @@ struct extent_buffer { | |||
| 95 | unsigned long map_start; | 99 | unsigned long map_start; |
| 96 | unsigned long map_len; | 100 | unsigned long map_len; |
| 97 | struct page *first_page; | 101 | struct page *first_page; |
| 102 | unsigned long bflags; | ||
| 98 | atomic_t refs; | 103 | atomic_t refs; |
| 99 | int flags; | ||
| 100 | struct list_head leak_list; | 104 | struct list_head leak_list; |
| 101 | struct rb_node rb_node; | 105 | struct rb_node rb_node; |
| 102 | struct mutex mutex; | 106 | |
| 107 | /* the spinlock is used to protect most operations */ | ||
| 108 | spinlock_t lock; | ||
| 109 | |||
| 110 | /* | ||
| 111 | * when we keep the lock held while blocking, waiters go onto | ||
| 112 | * the wq | ||
| 113 | */ | ||
| 114 | wait_queue_head_t lock_wq; | ||
| 103 | }; | 115 | }; |
| 104 | 116 | ||
| 105 | struct extent_map_tree; | 117 | struct extent_map_tree; |
| @@ -193,6 +205,8 @@ int extent_commit_write(struct extent_io_tree *tree, | |||
| 193 | unsigned from, unsigned to); | 205 | unsigned from, unsigned to); |
| 194 | sector_t extent_bmap(struct address_space *mapping, sector_t iblock, | 206 | sector_t extent_bmap(struct address_space *mapping, sector_t iblock, |
| 195 | get_extent_t *get_extent); | 207 | get_extent_t *get_extent); |
| 208 | int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | ||
| 209 | __u64 start, __u64 len, get_extent_t *get_extent); | ||
| 196 | int set_range_dirty(struct extent_io_tree *tree, u64 start, u64 end); | 210 | int set_range_dirty(struct extent_io_tree *tree, u64 start, u64 end); |
| 197 | int set_state_private(struct extent_io_tree *tree, u64 start, u64 private); | 211 | int set_state_private(struct extent_io_tree *tree, u64 start, u64 private); |
| 198 | int get_state_private(struct extent_io_tree *tree, u64 start, u64 *private); | 212 | int get_state_private(struct extent_io_tree *tree, u64 start, u64 *private); |
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 4a83e33ada32..50da69da20ce 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | #include <linux/slab.h> | 3 | #include <linux/slab.h> |
| 4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
| 5 | #include <linux/spinlock.h> | 5 | #include <linux/spinlock.h> |
| 6 | #include <linux/version.h> | ||
| 7 | #include <linux/hardirq.h> | 6 | #include <linux/hardirq.h> |
| 8 | #include "extent_map.h" | 7 | #include "extent_map.h" |
| 9 | 8 | ||
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 90268334145e..3e8023efaff7 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
| @@ -29,7 +29,6 @@ | |||
| 29 | #include <linux/writeback.h> | 29 | #include <linux/writeback.h> |
| 30 | #include <linux/statfs.h> | 30 | #include <linux/statfs.h> |
| 31 | #include <linux/compat.h> | 31 | #include <linux/compat.h> |
| 32 | #include <linux/version.h> | ||
| 33 | #include "ctree.h" | 32 | #include "ctree.h" |
| 34 | #include "disk-io.h" | 33 | #include "disk-io.h" |
| 35 | #include "transaction.h" | 34 | #include "transaction.h" |
| @@ -1215,10 +1214,10 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
| 1215 | } | 1214 | } |
| 1216 | mutex_unlock(&root->fs_info->trans_mutex); | 1215 | mutex_unlock(&root->fs_info->trans_mutex); |
| 1217 | 1216 | ||
| 1218 | root->fs_info->tree_log_batch++; | 1217 | root->log_batch++; |
| 1219 | filemap_fdatawrite(inode->i_mapping); | 1218 | filemap_fdatawrite(inode->i_mapping); |
| 1220 | btrfs_wait_ordered_range(inode, 0, (u64)-1); | 1219 | btrfs_wait_ordered_range(inode, 0, (u64)-1); |
| 1221 | root->fs_info->tree_log_batch++; | 1220 | root->log_batch++; |
| 1222 | 1221 | ||
| 1223 | /* | 1222 | /* |
| 1224 | * ok we haven't committed the transaction yet, lets do a commit | 1223 | * ok we haven't committed the transaction yet, lets do a commit |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8adfe059ab41..8f0706210a47 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -34,7 +34,6 @@ | |||
| 34 | #include <linux/statfs.h> | 34 | #include <linux/statfs.h> |
| 35 | #include <linux/compat.h> | 35 | #include <linux/compat.h> |
| 36 | #include <linux/bit_spinlock.h> | 36 | #include <linux/bit_spinlock.h> |
| 37 | #include <linux/version.h> | ||
| 38 | #include <linux/xattr.h> | 37 | #include <linux/xattr.h> |
| 39 | #include <linux/posix_acl.h> | 38 | #include <linux/posix_acl.h> |
| 40 | #include <linux/falloc.h> | 39 | #include <linux/falloc.h> |
| @@ -51,6 +50,7 @@ | |||
| 51 | #include "tree-log.h" | 50 | #include "tree-log.h" |
| 52 | #include "ref-cache.h" | 51 | #include "ref-cache.h" |
| 53 | #include "compression.h" | 52 | #include "compression.h" |
| 53 | #include "locking.h" | ||
| 54 | 54 | ||
| 55 | struct btrfs_iget_args { | 55 | struct btrfs_iget_args { |
| 56 | u64 ino; | 56 | u64 ino; |
| @@ -91,6 +91,16 @@ static noinline int cow_file_range(struct inode *inode, | |||
| 91 | u64 start, u64 end, int *page_started, | 91 | u64 start, u64 end, int *page_started, |
| 92 | unsigned long *nr_written, int unlock); | 92 | unsigned long *nr_written, int unlock); |
| 93 | 93 | ||
| 94 | static int btrfs_init_inode_security(struct inode *inode, struct inode *dir) | ||
| 95 | { | ||
| 96 | int err; | ||
| 97 | |||
| 98 | err = btrfs_init_acl(inode, dir); | ||
| 99 | if (!err) | ||
| 100 | err = btrfs_xattr_security_init(inode, dir); | ||
| 101 | return err; | ||
| 102 | } | ||
| 103 | |||
| 94 | /* | 104 | /* |
| 95 | * a very lame attempt at stopping writes when the FS is 85% full. There | 105 | * a very lame attempt at stopping writes when the FS is 85% full. There |
| 96 | * are countless ways this is incorrect, but it is better than nothing. | 106 | * are countless ways this is incorrect, but it is better than nothing. |
| @@ -350,6 +360,19 @@ again: | |||
| 350 | nr_pages = (end >> PAGE_CACHE_SHIFT) - (start >> PAGE_CACHE_SHIFT) + 1; | 360 | nr_pages = (end >> PAGE_CACHE_SHIFT) - (start >> PAGE_CACHE_SHIFT) + 1; |
| 351 | nr_pages = min(nr_pages, (128 * 1024UL) / PAGE_CACHE_SIZE); | 361 | nr_pages = min(nr_pages, (128 * 1024UL) / PAGE_CACHE_SIZE); |
| 352 | 362 | ||
| 363 | /* | ||
| 364 | * we don't want to send crud past the end of i_size through | ||
| 365 | * compression, that's just a waste of CPU time. So, if the | ||
| 366 | * end of the file is before the start of our current | ||
| 367 | * requested range of bytes, we bail out to the uncompressed | ||
| 368 | * cleanup code that can deal with all of this. | ||
| 369 | * | ||
| 370 | * It isn't really the fastest way to fix things, but this is a | ||
| 371 | * very uncommon corner. | ||
| 372 | */ | ||
| 373 | if (actual_end <= start) | ||
| 374 | goto cleanup_and_bail_uncompressed; | ||
| 375 | |||
| 353 | total_compressed = actual_end - start; | 376 | total_compressed = actual_end - start; |
| 354 | 377 | ||
| 355 | /* we want to make sure that amount of ram required to uncompress | 378 | /* we want to make sure that amount of ram required to uncompress |
| @@ -494,6 +517,7 @@ again: | |||
| 494 | goto again; | 517 | goto again; |
| 495 | } | 518 | } |
| 496 | } else { | 519 | } else { |
| 520 | cleanup_and_bail_uncompressed: | ||
| 497 | /* | 521 | /* |
| 498 | * No compression, but we still need to write the pages in | 522 | * No compression, but we still need to write the pages in |
| 499 | * the file we've been given so far. redirty the locked | 523 | * the file we've been given so far. redirty the locked |
| @@ -1324,12 +1348,11 @@ static noinline int add_pending_csums(struct btrfs_trans_handle *trans, | |||
| 1324 | struct inode *inode, u64 file_offset, | 1348 | struct inode *inode, u64 file_offset, |
| 1325 | struct list_head *list) | 1349 | struct list_head *list) |
| 1326 | { | 1350 | { |
| 1327 | struct list_head *cur; | ||
| 1328 | struct btrfs_ordered_sum *sum; | 1351 | struct btrfs_ordered_sum *sum; |
| 1329 | 1352 | ||
| 1330 | btrfs_set_trans_block_group(trans, inode); | 1353 | btrfs_set_trans_block_group(trans, inode); |
| 1331 | list_for_each(cur, list) { | 1354 | |
| 1332 | sum = list_entry(cur, struct btrfs_ordered_sum, list); | 1355 | list_for_each_entry(sum, list, list) { |
| 1333 | btrfs_csum_file_blocks(trans, | 1356 | btrfs_csum_file_blocks(trans, |
| 1334 | BTRFS_I(inode)->root->fs_info->csum_root, sum); | 1357 | BTRFS_I(inode)->root->fs_info->csum_root, sum); |
| 1335 | } | 1358 | } |
| @@ -2013,6 +2036,7 @@ void btrfs_read_locked_inode(struct inode *inode) | |||
| 2013 | BTRFS_I(inode)->flags = btrfs_inode_flags(leaf, inode_item); | 2036 | BTRFS_I(inode)->flags = btrfs_inode_flags(leaf, inode_item); |
| 2014 | 2037 | ||
| 2015 | alloc_group_block = btrfs_inode_block_group(leaf, inode_item); | 2038 | alloc_group_block = btrfs_inode_block_group(leaf, inode_item); |
| 2039 | |||
| 2016 | BTRFS_I(inode)->block_group = btrfs_find_block_group(root, 0, | 2040 | BTRFS_I(inode)->block_group = btrfs_find_block_group(root, 0, |
| 2017 | alloc_group_block, 0); | 2041 | alloc_group_block, 0); |
| 2018 | btrfs_free_path(path); | 2042 | btrfs_free_path(path); |
| @@ -2039,6 +2063,7 @@ void btrfs_read_locked_inode(struct inode *inode) | |||
| 2039 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | 2063 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; |
| 2040 | break; | 2064 | break; |
| 2041 | default: | 2065 | default: |
| 2066 | inode->i_op = &btrfs_special_inode_operations; | ||
| 2042 | init_special_inode(inode, inode->i_mode, rdev); | 2067 | init_special_inode(inode, inode->i_mode, rdev); |
| 2043 | break; | 2068 | break; |
| 2044 | } | 2069 | } |
| @@ -2108,6 +2133,7 @@ noinline int btrfs_update_inode(struct btrfs_trans_handle *trans, | |||
| 2108 | goto failed; | 2133 | goto failed; |
| 2109 | } | 2134 | } |
| 2110 | 2135 | ||
| 2136 | btrfs_unlock_up_safe(path, 1); | ||
| 2111 | leaf = path->nodes[0]; | 2137 | leaf = path->nodes[0]; |
| 2112 | inode_item = btrfs_item_ptr(leaf, path->slots[0], | 2138 | inode_item = btrfs_item_ptr(leaf, path->slots[0], |
| 2113 | struct btrfs_inode_item); | 2139 | struct btrfs_inode_item); |
| @@ -2429,6 +2455,8 @@ next_node: | |||
| 2429 | ref->generation = leaf_gen; | 2455 | ref->generation = leaf_gen; |
| 2430 | ref->nritems = 0; | 2456 | ref->nritems = 0; |
| 2431 | 2457 | ||
| 2458 | btrfs_sort_leaf_ref(ref); | ||
| 2459 | |||
| 2432 | ret = btrfs_add_leaf_ref(root, ref, 0); | 2460 | ret = btrfs_add_leaf_ref(root, ref, 0); |
| 2433 | WARN_ON(ret); | 2461 | WARN_ON(ret); |
| 2434 | btrfs_free_leaf_ref(root, ref); | 2462 | btrfs_free_leaf_ref(root, ref); |
| @@ -2476,7 +2504,7 @@ noinline int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, | |||
| 2476 | struct btrfs_path *path; | 2504 | struct btrfs_path *path; |
| 2477 | struct btrfs_key key; | 2505 | struct btrfs_key key; |
| 2478 | struct btrfs_key found_key; | 2506 | struct btrfs_key found_key; |
| 2479 | u32 found_type; | 2507 | u32 found_type = (u8)-1; |
| 2480 | struct extent_buffer *leaf; | 2508 | struct extent_buffer *leaf; |
| 2481 | struct btrfs_file_extent_item *fi; | 2509 | struct btrfs_file_extent_item *fi; |
| 2482 | u64 extent_start = 0; | 2510 | u64 extent_start = 0; |
| @@ -2663,6 +2691,8 @@ next: | |||
| 2663 | if (pending_del_nr) | 2691 | if (pending_del_nr) |
| 2664 | goto del_pending; | 2692 | goto del_pending; |
| 2665 | btrfs_release_path(root, path); | 2693 | btrfs_release_path(root, path); |
| 2694 | if (found_type == BTRFS_INODE_ITEM_KEY) | ||
| 2695 | break; | ||
| 2666 | goto search_again; | 2696 | goto search_again; |
| 2667 | } | 2697 | } |
| 2668 | 2698 | ||
| @@ -2679,6 +2709,8 @@ del_pending: | |||
| 2679 | BUG_ON(ret); | 2709 | BUG_ON(ret); |
| 2680 | pending_del_nr = 0; | 2710 | pending_del_nr = 0; |
| 2681 | btrfs_release_path(root, path); | 2711 | btrfs_release_path(root, path); |
| 2712 | if (found_type == BTRFS_INODE_ITEM_KEY) | ||
| 2713 | break; | ||
| 2682 | goto search_again; | 2714 | goto search_again; |
| 2683 | } | 2715 | } |
| 2684 | } | 2716 | } |
| @@ -3265,7 +3297,7 @@ skip: | |||
| 3265 | 3297 | ||
| 3266 | /* Reached end of directory/root. Bump pos past the last item. */ | 3298 | /* Reached end of directory/root. Bump pos past the last item. */ |
| 3267 | if (key_type == BTRFS_DIR_INDEX_KEY) | 3299 | if (key_type == BTRFS_DIR_INDEX_KEY) |
| 3268 | filp->f_pos = INT_LIMIT(typeof(filp->f_pos)); | 3300 | filp->f_pos = INT_LIMIT(off_t); |
| 3269 | else | 3301 | else |
| 3270 | filp->f_pos++; | 3302 | filp->f_pos++; |
| 3271 | nopos: | 3303 | nopos: |
| @@ -3458,7 +3490,14 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
| 3458 | root->highest_inode = objectid; | 3490 | root->highest_inode = objectid; |
| 3459 | 3491 | ||
| 3460 | inode->i_uid = current_fsuid(); | 3492 | inode->i_uid = current_fsuid(); |
| 3461 | inode->i_gid = current_fsgid(); | 3493 | |
| 3494 | if (dir && (dir->i_mode & S_ISGID)) { | ||
| 3495 | inode->i_gid = dir->i_gid; | ||
| 3496 | if (S_ISDIR(mode)) | ||
| 3497 | mode |= S_ISGID; | ||
| 3498 | } else | ||
| 3499 | inode->i_gid = current_fsgid(); | ||
| 3500 | |||
| 3462 | inode->i_mode = mode; | 3501 | inode->i_mode = mode; |
| 3463 | inode->i_ino = objectid; | 3502 | inode->i_ino = objectid; |
| 3464 | inode_set_bytes(inode, 0); | 3503 | inode_set_bytes(inode, 0); |
| @@ -3586,7 +3625,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry, | |||
| 3586 | if (IS_ERR(inode)) | 3625 | if (IS_ERR(inode)) |
| 3587 | goto out_unlock; | 3626 | goto out_unlock; |
| 3588 | 3627 | ||
| 3589 | err = btrfs_init_acl(inode, dir); | 3628 | err = btrfs_init_inode_security(inode, dir); |
| 3590 | if (err) { | 3629 | if (err) { |
| 3591 | drop_inode = 1; | 3630 | drop_inode = 1; |
| 3592 | goto out_unlock; | 3631 | goto out_unlock; |
| @@ -3649,7 +3688,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, | |||
| 3649 | if (IS_ERR(inode)) | 3688 | if (IS_ERR(inode)) |
| 3650 | goto out_unlock; | 3689 | goto out_unlock; |
| 3651 | 3690 | ||
| 3652 | err = btrfs_init_acl(inode, dir); | 3691 | err = btrfs_init_inode_security(inode, dir); |
| 3653 | if (err) { | 3692 | if (err) { |
| 3654 | drop_inode = 1; | 3693 | drop_inode = 1; |
| 3655 | goto out_unlock; | 3694 | goto out_unlock; |
| @@ -3772,7 +3811,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
| 3772 | 3811 | ||
| 3773 | drop_on_err = 1; | 3812 | drop_on_err = 1; |
| 3774 | 3813 | ||
| 3775 | err = btrfs_init_acl(inode, dir); | 3814 | err = btrfs_init_inode_security(inode, dir); |
| 3776 | if (err) | 3815 | if (err) |
| 3777 | goto out_fail; | 3816 | goto out_fail; |
| 3778 | 3817 | ||
| @@ -4158,9 +4197,10 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, | |||
| 4158 | return -EINVAL; | 4197 | return -EINVAL; |
| 4159 | } | 4198 | } |
| 4160 | 4199 | ||
| 4161 | static sector_t btrfs_bmap(struct address_space *mapping, sector_t iblock) | 4200 | static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
| 4201 | __u64 start, __u64 len) | ||
| 4162 | { | 4202 | { |
| 4163 | return extent_bmap(mapping, iblock, btrfs_get_extent); | 4203 | return extent_fiemap(inode, fieinfo, start, len, btrfs_get_extent); |
| 4164 | } | 4204 | } |
| 4165 | 4205 | ||
| 4166 | int btrfs_readpage(struct file *file, struct page *page) | 4206 | int btrfs_readpage(struct file *file, struct page *page) |
| @@ -4733,7 +4773,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
| 4733 | if (IS_ERR(inode)) | 4773 | if (IS_ERR(inode)) |
| 4734 | goto out_unlock; | 4774 | goto out_unlock; |
| 4735 | 4775 | ||
| 4736 | err = btrfs_init_acl(inode, dir); | 4776 | err = btrfs_init_inode_security(inode, dir); |
| 4737 | if (err) { | 4777 | if (err) { |
| 4738 | drop_inode = 1; | 4778 | drop_inode = 1; |
| 4739 | goto out_unlock; | 4779 | goto out_unlock; |
| @@ -4987,13 +5027,24 @@ static struct extent_io_ops btrfs_extent_io_ops = { | |||
| 4987 | .clear_bit_hook = btrfs_clear_bit_hook, | 5027 | .clear_bit_hook = btrfs_clear_bit_hook, |
| 4988 | }; | 5028 | }; |
| 4989 | 5029 | ||
| 5030 | /* | ||
| 5031 | * btrfs doesn't support the bmap operation because swapfiles | ||
| 5032 | * use bmap to make a mapping of extents in the file. They assume | ||
| 5033 | * these extents won't change over the life of the file and they | ||
| 5034 | * use the bmap result to do IO directly to the drive. | ||
| 5035 | * | ||
| 5036 | * the btrfs bmap call would return logical addresses that aren't | ||
| 5037 | * suitable for IO and they also will change frequently as COW | ||
| 5038 | * operations happen. So, swapfile + btrfs == corruption. | ||
| 5039 | * | ||
| 5040 | * For now we're avoiding this by dropping bmap. | ||
| 5041 | */ | ||
| 4990 | static struct address_space_operations btrfs_aops = { | 5042 | static struct address_space_operations btrfs_aops = { |
| 4991 | .readpage = btrfs_readpage, | 5043 | .readpage = btrfs_readpage, |
| 4992 | .writepage = btrfs_writepage, | 5044 | .writepage = btrfs_writepage, |
| 4993 | .writepages = btrfs_writepages, | 5045 | .writepages = btrfs_writepages, |
| 4994 | .readpages = btrfs_readpages, | 5046 | .readpages = btrfs_readpages, |
| 4995 | .sync_page = block_sync_page, | 5047 | .sync_page = block_sync_page, |
| 4996 | .bmap = btrfs_bmap, | ||
| 4997 | .direct_IO = btrfs_direct_IO, | 5048 | .direct_IO = btrfs_direct_IO, |
| 4998 | .invalidatepage = btrfs_invalidatepage, | 5049 | .invalidatepage = btrfs_invalidatepage, |
| 4999 | .releasepage = btrfs_releasepage, | 5050 | .releasepage = btrfs_releasepage, |
| @@ -5017,6 +5068,7 @@ static struct inode_operations btrfs_file_inode_operations = { | |||
| 5017 | .removexattr = btrfs_removexattr, | 5068 | .removexattr = btrfs_removexattr, |
| 5018 | .permission = btrfs_permission, | 5069 | .permission = btrfs_permission, |
| 5019 | .fallocate = btrfs_fallocate, | 5070 | .fallocate = btrfs_fallocate, |
| 5071 | .fiemap = btrfs_fiemap, | ||
| 5020 | }; | 5072 | }; |
| 5021 | static struct inode_operations btrfs_special_inode_operations = { | 5073 | static struct inode_operations btrfs_special_inode_operations = { |
| 5022 | .getattr = btrfs_getattr, | 5074 | .getattr = btrfs_getattr, |
| @@ -5032,4 +5084,8 @@ static struct inode_operations btrfs_symlink_inode_operations = { | |||
| 5032 | .follow_link = page_follow_link_light, | 5084 | .follow_link = page_follow_link_light, |
| 5033 | .put_link = page_put_link, | 5085 | .put_link = page_put_link, |
| 5034 | .permission = btrfs_permission, | 5086 | .permission = btrfs_permission, |
| 5087 | .setxattr = btrfs_setxattr, | ||
| 5088 | .getxattr = btrfs_getxattr, | ||
| 5089 | .listxattr = btrfs_listxattr, | ||
| 5090 | .removexattr = btrfs_removexattr, | ||
| 5035 | }; | 5091 | }; |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index c2aa33e3feb5..988fdc8b49eb 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | #include <linux/compat.h> | 38 | #include <linux/compat.h> |
| 39 | #include <linux/bit_spinlock.h> | 39 | #include <linux/bit_spinlock.h> |
| 40 | #include <linux/security.h> | 40 | #include <linux/security.h> |
| 41 | #include <linux/version.h> | ||
| 42 | #include <linux/xattr.h> | 41 | #include <linux/xattr.h> |
| 43 | #include <linux/vmalloc.h> | 42 | #include <linux/vmalloc.h> |
| 44 | #include "compat.h" | 43 | #include "compat.h" |
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c index 39bae7761db6..68fd9ccf1805 100644 --- a/fs/btrfs/locking.c +++ b/fs/btrfs/locking.c | |||
| @@ -26,45 +26,215 @@ | |||
| 26 | #include "locking.h" | 26 | #include "locking.h" |
| 27 | 27 | ||
| 28 | /* | 28 | /* |
| 29 | * locks the per buffer mutex in an extent buffer. This uses adaptive locks | 29 | * btrfs_header_level() isn't free, so don't call it when lockdep isn't |
| 30 | * and the spin is not tuned very extensively. The spinning does make a big | 30 | * on |
| 31 | * difference in almost every workload, but spinning for the right amount of | ||
| 32 | * time needs some help. | ||
| 33 | * | ||
| 34 | * In general, we want to spin as long as the lock holder is doing btree | ||
| 35 | * searches, and we should give up if they are in more expensive code. | ||
| 36 | */ | 31 | */ |
| 32 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 33 | static inline void spin_nested(struct extent_buffer *eb) | ||
| 34 | { | ||
| 35 | spin_lock_nested(&eb->lock, BTRFS_MAX_LEVEL - btrfs_header_level(eb)); | ||
| 36 | } | ||
| 37 | #else | ||
| 38 | static inline void spin_nested(struct extent_buffer *eb) | ||
| 39 | { | ||
| 40 | spin_lock(&eb->lock); | ||
| 41 | } | ||
| 42 | #endif | ||
| 37 | 43 | ||
| 38 | int btrfs_tree_lock(struct extent_buffer *eb) | 44 | /* |
| 45 | * Setting a lock to blocking will drop the spinlock and set the | ||
| 46 | * flag that forces other procs who want the lock to wait. After | ||
| 47 | * this you can safely schedule with the lock held. | ||
| 48 | */ | ||
| 49 | void btrfs_set_lock_blocking(struct extent_buffer *eb) | ||
| 39 | { | 50 | { |
| 40 | int i; | 51 | if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags)) { |
| 52 | set_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags); | ||
| 53 | spin_unlock(&eb->lock); | ||
| 54 | } | ||
| 55 | /* exit with the spin lock released and the bit set */ | ||
| 56 | } | ||
| 41 | 57 | ||
| 42 | if (mutex_trylock(&eb->mutex)) | 58 | /* |
| 43 | return 0; | 59 | * clearing the blocking flag will take the spinlock again. |
| 60 | * After this you can't safely schedule | ||
| 61 | */ | ||
| 62 | void btrfs_clear_lock_blocking(struct extent_buffer *eb) | ||
| 63 | { | ||
| 64 | if (test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags)) { | ||
| 65 | spin_nested(eb); | ||
| 66 | clear_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags); | ||
| 67 | smp_mb__after_clear_bit(); | ||
| 68 | } | ||
| 69 | /* exit with the spin lock held */ | ||
| 70 | } | ||
| 71 | |||
| 72 | /* | ||
| 73 | * unfortunately, many of the places that currently set a lock to blocking | ||
| 74 | * don't end up blocking for every long, and often they don't block | ||
| 75 | * at all. For a dbench 50 run, if we don't spin one the blocking bit | ||
| 76 | * at all, the context switch rate can jump up to 400,000/sec or more. | ||
| 77 | * | ||
| 78 | * So, we're still stuck with this crummy spin on the blocking bit, | ||
| 79 | * at least until the most common causes of the short blocks | ||
| 80 | * can be dealt with. | ||
| 81 | */ | ||
| 82 | static int btrfs_spin_on_block(struct extent_buffer *eb) | ||
| 83 | { | ||
| 84 | int i; | ||
| 44 | for (i = 0; i < 512; i++) { | 85 | for (i = 0; i < 512; i++) { |
| 45 | cpu_relax(); | 86 | cpu_relax(); |
| 46 | if (mutex_trylock(&eb->mutex)) | 87 | if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags)) |
| 88 | return 1; | ||
| 89 | if (need_resched()) | ||
| 90 | break; | ||
| 91 | } | ||
| 92 | return 0; | ||
| 93 | } | ||
| 94 | |||
| 95 | /* | ||
| 96 | * This is somewhat different from trylock. It will take the | ||
| 97 | * spinlock but if it finds the lock is set to blocking, it will | ||
| 98 | * return without the lock held. | ||
| 99 | * | ||
| 100 | * returns 1 if it was able to take the lock and zero otherwise | ||
| 101 | * | ||
| 102 | * After this call, scheduling is not safe without first calling | ||
| 103 | * btrfs_set_lock_blocking() | ||
| 104 | */ | ||
| 105 | int btrfs_try_spin_lock(struct extent_buffer *eb) | ||
| 106 | { | ||
| 107 | int i; | ||
| 108 | |||
| 109 | spin_nested(eb); | ||
| 110 | if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags)) | ||
| 111 | return 1; | ||
| 112 | spin_unlock(&eb->lock); | ||
| 113 | |||
| 114 | /* spin for a bit on the BLOCKING flag */ | ||
| 115 | for (i = 0; i < 2; i++) { | ||
| 116 | if (!btrfs_spin_on_block(eb)) | ||
| 117 | break; | ||
| 118 | |||
| 119 | spin_nested(eb); | ||
| 120 | if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags)) | ||
| 121 | return 1; | ||
| 122 | spin_unlock(&eb->lock); | ||
| 123 | } | ||
| 124 | return 0; | ||
| 125 | } | ||
| 126 | |||
| 127 | /* | ||
| 128 | * the autoremove wake function will return 0 if it tried to wake up | ||
| 129 | * a process that was already awake, which means that process won't | ||
| 130 | * count as an exclusive wakeup. The waitq code will continue waking | ||
| 131 | * procs until it finds one that was actually sleeping. | ||
| 132 | * | ||
| 133 | * For btrfs, this isn't quite what we want. We want a single proc | ||
| 134 | * to be notified that the lock is ready for taking. If that proc | ||
| 135 | * already happen to be awake, great, it will loop around and try for | ||
| 136 | * the lock. | ||
| 137 | * | ||
| 138 | * So, btrfs_wake_function always returns 1, even when the proc that we | ||
| 139 | * tried to wake up was already awake. | ||
| 140 | */ | ||
| 141 | static int btrfs_wake_function(wait_queue_t *wait, unsigned mode, | ||
| 142 | int sync, void *key) | ||
| 143 | { | ||
| 144 | autoremove_wake_function(wait, mode, sync, key); | ||
| 145 | return 1; | ||
| 146 | } | ||
| 147 | |||
| 148 | /* | ||
| 149 | * returns with the extent buffer spinlocked. | ||
| 150 | * | ||
| 151 | * This will spin and/or wait as required to take the lock, and then | ||
| 152 | * return with the spinlock held. | ||
| 153 | * | ||
| 154 | * After this call, scheduling is not safe without first calling | ||
| 155 | * btrfs_set_lock_blocking() | ||
| 156 | */ | ||
| 157 | int btrfs_tree_lock(struct extent_buffer *eb) | ||
| 158 | { | ||
| 159 | DEFINE_WAIT(wait); | ||
| 160 | wait.func = btrfs_wake_function; | ||
| 161 | |||
| 162 | while(1) { | ||
| 163 | spin_nested(eb); | ||
| 164 | |||
| 165 | /* nobody is blocking, exit with the spinlock held */ | ||
| 166 | if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags)) | ||
| 47 | return 0; | 167 | return 0; |
| 168 | |||
| 169 | /* | ||
| 170 | * we have the spinlock, but the real owner is blocking. | ||
| 171 | * wait for them | ||
| 172 | */ | ||
| 173 | spin_unlock(&eb->lock); | ||
| 174 | |||
| 175 | /* | ||
| 176 | * spin for a bit, and if the blocking flag goes away, | ||
| 177 | * loop around | ||
| 178 | */ | ||
| 179 | if (btrfs_spin_on_block(eb)) | ||
| 180 | continue; | ||
| 181 | |||
| 182 | prepare_to_wait_exclusive(&eb->lock_wq, &wait, | ||
| 183 | TASK_UNINTERRUPTIBLE); | ||
| 184 | |||
| 185 | if (test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags)) | ||
| 186 | schedule(); | ||
| 187 | |||
| 188 | finish_wait(&eb->lock_wq, &wait); | ||
| 48 | } | 189 | } |
| 49 | cpu_relax(); | ||
| 50 | mutex_lock_nested(&eb->mutex, BTRFS_MAX_LEVEL - btrfs_header_level(eb)); | ||
| 51 | return 0; | 190 | return 0; |
| 52 | } | 191 | } |
| 53 | 192 | ||
| 193 | /* | ||
| 194 | * Very quick trylock, this does not spin or schedule. It returns | ||
| 195 | * 1 with the spinlock held if it was able to take the lock, or it | ||
| 196 | * returns zero if it was unable to take the lock. | ||
| 197 | * | ||
| 198 | * After this call, scheduling is not safe without first calling | ||
| 199 | * btrfs_set_lock_blocking() | ||
| 200 | */ | ||
| 54 | int btrfs_try_tree_lock(struct extent_buffer *eb) | 201 | int btrfs_try_tree_lock(struct extent_buffer *eb) |
| 55 | { | 202 | { |
| 56 | return mutex_trylock(&eb->mutex); | 203 | if (spin_trylock(&eb->lock)) { |
| 204 | if (test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags)) { | ||
| 205 | /* | ||
| 206 | * we've got the spinlock, but the real owner is | ||
| 207 | * blocking. Drop the spinlock and return failure | ||
| 208 | */ | ||
| 209 | spin_unlock(&eb->lock); | ||
| 210 | return 0; | ||
| 211 | } | ||
| 212 | return 1; | ||
| 213 | } | ||
| 214 | /* someone else has the spinlock giveup */ | ||
| 215 | return 0; | ||
| 57 | } | 216 | } |
| 58 | 217 | ||
| 59 | int btrfs_tree_unlock(struct extent_buffer *eb) | 218 | int btrfs_tree_unlock(struct extent_buffer *eb) |
| 60 | { | 219 | { |
| 61 | mutex_unlock(&eb->mutex); | 220 | /* |
| 221 | * if we were a blocking owner, we don't have the spinlock held | ||
| 222 | * just clear the bit and look for waiters | ||
| 223 | */ | ||
| 224 | if (test_and_clear_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags)) | ||
| 225 | smp_mb__after_clear_bit(); | ||
| 226 | else | ||
| 227 | spin_unlock(&eb->lock); | ||
| 228 | |||
| 229 | if (waitqueue_active(&eb->lock_wq)) | ||
| 230 | wake_up(&eb->lock_wq); | ||
| 62 | return 0; | 231 | return 0; |
| 63 | } | 232 | } |
| 64 | 233 | ||
| 65 | int btrfs_tree_locked(struct extent_buffer *eb) | 234 | int btrfs_tree_locked(struct extent_buffer *eb) |
| 66 | { | 235 | { |
| 67 | return mutex_is_locked(&eb->mutex); | 236 | return test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags) || |
| 237 | spin_is_locked(&eb->lock); | ||
| 68 | } | 238 | } |
| 69 | 239 | ||
| 70 | /* | 240 | /* |
| @@ -75,12 +245,14 @@ int btrfs_path_lock_waiting(struct btrfs_path *path, int level) | |||
| 75 | { | 245 | { |
| 76 | int i; | 246 | int i; |
| 77 | struct extent_buffer *eb; | 247 | struct extent_buffer *eb; |
| 248 | |||
| 78 | for (i = level; i <= level + 1 && i < BTRFS_MAX_LEVEL; i++) { | 249 | for (i = level; i <= level + 1 && i < BTRFS_MAX_LEVEL; i++) { |
| 79 | eb = path->nodes[i]; | 250 | eb = path->nodes[i]; |
| 80 | if (!eb) | 251 | if (!eb) |
| 81 | break; | 252 | break; |
| 82 | smp_mb(); | 253 | smp_mb(); |
| 83 | if (!list_empty(&eb->mutex.wait_list)) | 254 | if (spin_is_contended(&eb->lock) || |
| 255 | waitqueue_active(&eb->lock_wq)) | ||
| 84 | return 1; | 256 | return 1; |
| 85 | } | 257 | } |
| 86 | return 0; | 258 | return 0; |
diff --git a/fs/btrfs/locking.h b/fs/btrfs/locking.h index bc1faef12519..d92e707f5870 100644 --- a/fs/btrfs/locking.h +++ b/fs/btrfs/locking.h | |||
| @@ -22,6 +22,12 @@ | |||
| 22 | int btrfs_tree_lock(struct extent_buffer *eb); | 22 | int btrfs_tree_lock(struct extent_buffer *eb); |
| 23 | int btrfs_tree_unlock(struct extent_buffer *eb); | 23 | int btrfs_tree_unlock(struct extent_buffer *eb); |
| 24 | int btrfs_tree_locked(struct extent_buffer *eb); | 24 | int btrfs_tree_locked(struct extent_buffer *eb); |
| 25 | |||
| 25 | int btrfs_try_tree_lock(struct extent_buffer *eb); | 26 | int btrfs_try_tree_lock(struct extent_buffer *eb); |
| 27 | int btrfs_try_spin_lock(struct extent_buffer *eb); | ||
| 28 | |||
| 26 | int btrfs_path_lock_waiting(struct btrfs_path *path, int level); | 29 | int btrfs_path_lock_waiting(struct btrfs_path *path, int level); |
| 30 | |||
| 31 | void btrfs_set_lock_blocking(struct extent_buffer *eb); | ||
| 32 | void btrfs_clear_lock_blocking(struct extent_buffer *eb); | ||
| 27 | #endif | 33 | #endif |
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index a20940170274..77c2411a5f0f 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
| @@ -613,7 +613,6 @@ int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr, | |||
| 613 | struct btrfs_sector_sum *sector_sums; | 613 | struct btrfs_sector_sum *sector_sums; |
| 614 | struct btrfs_ordered_extent *ordered; | 614 | struct btrfs_ordered_extent *ordered; |
| 615 | struct btrfs_ordered_inode_tree *tree = &BTRFS_I(inode)->ordered_tree; | 615 | struct btrfs_ordered_inode_tree *tree = &BTRFS_I(inode)->ordered_tree; |
| 616 | struct list_head *cur; | ||
| 617 | unsigned long num_sectors; | 616 | unsigned long num_sectors; |
| 618 | unsigned long i; | 617 | unsigned long i; |
| 619 | u32 sectorsize = BTRFS_I(inode)->root->sectorsize; | 618 | u32 sectorsize = BTRFS_I(inode)->root->sectorsize; |
| @@ -624,8 +623,7 @@ int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr, | |||
| 624 | return 1; | 623 | return 1; |
| 625 | 624 | ||
| 626 | mutex_lock(&tree->mutex); | 625 | mutex_lock(&tree->mutex); |
| 627 | list_for_each_prev(cur, &ordered->list) { | 626 | list_for_each_entry_reverse(ordered_sum, &ordered->list, list) { |
| 628 | ordered_sum = list_entry(cur, struct btrfs_ordered_sum, list); | ||
| 629 | if (disk_bytenr >= ordered_sum->bytenr) { | 627 | if (disk_bytenr >= ordered_sum->bytenr) { |
| 630 | num_sectors = ordered_sum->len / sectorsize; | 628 | num_sectors = ordered_sum->len / sectorsize; |
| 631 | sector_sums = ordered_sum->sums; | 629 | sector_sums = ordered_sum->sums; |
diff --git a/fs/btrfs/ref-cache.c b/fs/btrfs/ref-cache.c index 6f0acc4c9eab..d0cc62bccb94 100644 --- a/fs/btrfs/ref-cache.c +++ b/fs/btrfs/ref-cache.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
| 20 | #include <linux/sort.h> | ||
| 20 | #include "ctree.h" | 21 | #include "ctree.h" |
| 21 | #include "ref-cache.h" | 22 | #include "ref-cache.h" |
| 22 | #include "transaction.h" | 23 | #include "transaction.h" |
diff --git a/fs/btrfs/ref-cache.h b/fs/btrfs/ref-cache.h index 16f3183d7c59..bc283ad2db73 100644 --- a/fs/btrfs/ref-cache.h +++ b/fs/btrfs/ref-cache.h | |||
| @@ -73,5 +73,4 @@ int btrfs_add_leaf_ref(struct btrfs_root *root, struct btrfs_leaf_ref *ref, | |||
| 73 | int btrfs_remove_leaf_refs(struct btrfs_root *root, u64 max_root_gen, | 73 | int btrfs_remove_leaf_refs(struct btrfs_root *root, u64 max_root_gen, |
| 74 | int shared); | 74 | int shared); |
| 75 | int btrfs_remove_leaf_ref(struct btrfs_root *root, struct btrfs_leaf_ref *ref); | 75 | int btrfs_remove_leaf_ref(struct btrfs_root *root, struct btrfs_leaf_ref *ref); |
| 76 | |||
| 77 | #endif | 76 | #endif |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index db9fb3bc1e33..f3fd7e2cbc38 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
| @@ -37,7 +37,6 @@ | |||
| 37 | #include <linux/ctype.h> | 37 | #include <linux/ctype.h> |
| 38 | #include <linux/namei.h> | 38 | #include <linux/namei.h> |
| 39 | #include <linux/miscdevice.h> | 39 | #include <linux/miscdevice.h> |
| 40 | #include <linux/version.h> | ||
| 41 | #include <linux/magic.h> | 40 | #include <linux/magic.h> |
| 42 | #include "compat.h" | 41 | #include "compat.h" |
| 43 | #include "ctree.h" | 42 | #include "ctree.h" |
| @@ -583,17 +582,18 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd, | |||
| 583 | struct btrfs_ioctl_vol_args *vol; | 582 | struct btrfs_ioctl_vol_args *vol; |
| 584 | struct btrfs_fs_devices *fs_devices; | 583 | struct btrfs_fs_devices *fs_devices; |
| 585 | int ret = -ENOTTY; | 584 | int ret = -ENOTTY; |
| 586 | int len; | ||
| 587 | 585 | ||
| 588 | if (!capable(CAP_SYS_ADMIN)) | 586 | if (!capable(CAP_SYS_ADMIN)) |
| 589 | return -EPERM; | 587 | return -EPERM; |
| 590 | 588 | ||
| 591 | vol = kmalloc(sizeof(*vol), GFP_KERNEL); | 589 | vol = kmalloc(sizeof(*vol), GFP_KERNEL); |
| 590 | if (!vol) | ||
| 591 | return -ENOMEM; | ||
| 592 | |||
| 592 | if (copy_from_user(vol, (void __user *)arg, sizeof(*vol))) { | 593 | if (copy_from_user(vol, (void __user *)arg, sizeof(*vol))) { |
| 593 | ret = -EFAULT; | 594 | ret = -EFAULT; |
| 594 | goto out; | 595 | goto out; |
| 595 | } | 596 | } |
| 596 | len = strnlen(vol->name, BTRFS_PATH_NAME_MAX); | ||
| 597 | 597 | ||
| 598 | switch (cmd) { | 598 | switch (cmd) { |
| 599 | case BTRFS_IOC_SCAN_DEV: | 599 | case BTRFS_IOC_SCAN_DEV: |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 8a08f9443340..919172de5c9a 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
| @@ -852,11 +852,9 @@ static noinline int create_pending_snapshots(struct btrfs_trans_handle *trans, | |||
| 852 | { | 852 | { |
| 853 | struct btrfs_pending_snapshot *pending; | 853 | struct btrfs_pending_snapshot *pending; |
| 854 | struct list_head *head = &trans->transaction->pending_snapshots; | 854 | struct list_head *head = &trans->transaction->pending_snapshots; |
| 855 | struct list_head *cur; | ||
| 856 | int ret; | 855 | int ret; |
| 857 | 856 | ||
| 858 | list_for_each(cur, head) { | 857 | list_for_each_entry(pending, head, list) { |
| 859 | pending = list_entry(cur, struct btrfs_pending_snapshot, list); | ||
| 860 | ret = create_pending_snapshot(trans, fs_info, pending); | 858 | ret = create_pending_snapshot(trans, fs_info, pending); |
| 861 | BUG_ON(ret); | 859 | BUG_ON(ret); |
| 862 | } | 860 | } |
diff --git a/fs/btrfs/tree-defrag.c b/fs/btrfs/tree-defrag.c index 3e8358c36165..98d25fa4570e 100644 --- a/fs/btrfs/tree-defrag.c +++ b/fs/btrfs/tree-defrag.c | |||
| @@ -74,6 +74,7 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans, | |||
| 74 | u32 nritems; | 74 | u32 nritems; |
| 75 | 75 | ||
| 76 | root_node = btrfs_lock_root_node(root); | 76 | root_node = btrfs_lock_root_node(root); |
| 77 | btrfs_set_lock_blocking(root_node); | ||
| 77 | nritems = btrfs_header_nritems(root_node); | 78 | nritems = btrfs_header_nritems(root_node); |
| 78 | root->defrag_max.objectid = 0; | 79 | root->defrag_max.objectid = 0; |
| 79 | /* from above we know this is not a leaf */ | 80 | /* from above we know this is not a leaf */ |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index d81cda2e077c..20794290256b 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
| @@ -78,104 +78,6 @@ static int link_to_fixup_dir(struct btrfs_trans_handle *trans, | |||
| 78 | */ | 78 | */ |
| 79 | 79 | ||
| 80 | /* | 80 | /* |
| 81 | * btrfs_add_log_tree adds a new per-subvolume log tree into the | ||
| 82 | * tree of log tree roots. This must be called with a tree log transaction | ||
| 83 | * running (see start_log_trans). | ||
| 84 | */ | ||
| 85 | static int btrfs_add_log_tree(struct btrfs_trans_handle *trans, | ||
| 86 | struct btrfs_root *root) | ||
| 87 | { | ||
| 88 | struct btrfs_key key; | ||
| 89 | struct btrfs_root_item root_item; | ||
| 90 | struct btrfs_inode_item *inode_item; | ||
| 91 | struct extent_buffer *leaf; | ||
| 92 | struct btrfs_root *new_root = root; | ||
| 93 | int ret; | ||
| 94 | u64 objectid = root->root_key.objectid; | ||
| 95 | |||
| 96 | leaf = btrfs_alloc_free_block(trans, root, root->leafsize, 0, | ||
| 97 | BTRFS_TREE_LOG_OBJECTID, | ||
| 98 | trans->transid, 0, 0, 0); | ||
| 99 | if (IS_ERR(leaf)) { | ||
| 100 | ret = PTR_ERR(leaf); | ||
| 101 | return ret; | ||
| 102 | } | ||
| 103 | |||
| 104 | btrfs_set_header_nritems(leaf, 0); | ||
| 105 | btrfs_set_header_level(leaf, 0); | ||
| 106 | btrfs_set_header_bytenr(leaf, leaf->start); | ||
| 107 | btrfs_set_header_generation(leaf, trans->transid); | ||
| 108 | btrfs_set_header_owner(leaf, BTRFS_TREE_LOG_OBJECTID); | ||
| 109 | |||
| 110 | write_extent_buffer(leaf, root->fs_info->fsid, | ||
| 111 | (unsigned long)btrfs_header_fsid(leaf), | ||
| 112 | BTRFS_FSID_SIZE); | ||
| 113 | btrfs_mark_buffer_dirty(leaf); | ||
| 114 | |||
| 115 | inode_item = &root_item.inode; | ||
| 116 | memset(inode_item, 0, sizeof(*inode_item)); | ||
| 117 | inode_item->generation = cpu_to_le64(1); | ||
| 118 | inode_item->size = cpu_to_le64(3); | ||
| 119 | inode_item->nlink = cpu_to_le32(1); | ||
| 120 | inode_item->nbytes = cpu_to_le64(root->leafsize); | ||
| 121 | inode_item->mode = cpu_to_le32(S_IFDIR | 0755); | ||
| 122 | |||
| 123 | btrfs_set_root_bytenr(&root_item, leaf->start); | ||
| 124 | btrfs_set_root_generation(&root_item, trans->transid); | ||
| 125 | btrfs_set_root_level(&root_item, 0); | ||
| 126 | btrfs_set_root_refs(&root_item, 0); | ||
| 127 | btrfs_set_root_used(&root_item, 0); | ||
| 128 | |||
| 129 | memset(&root_item.drop_progress, 0, sizeof(root_item.drop_progress)); | ||
| 130 | root_item.drop_level = 0; | ||
| 131 | |||
| 132 | btrfs_tree_unlock(leaf); | ||
| 133 | free_extent_buffer(leaf); | ||
| 134 | leaf = NULL; | ||
| 135 | |||
| 136 | btrfs_set_root_dirid(&root_item, 0); | ||
| 137 | |||
| 138 | key.objectid = BTRFS_TREE_LOG_OBJECTID; | ||
| 139 | key.offset = objectid; | ||
| 140 | btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY); | ||
| 141 | ret = btrfs_insert_root(trans, root->fs_info->log_root_tree, &key, | ||
| 142 | &root_item); | ||
| 143 | if (ret) | ||
| 144 | goto fail; | ||
| 145 | |||
| 146 | new_root = btrfs_read_fs_root_no_radix(root->fs_info->log_root_tree, | ||
| 147 | &key); | ||
| 148 | BUG_ON(!new_root); | ||
| 149 | |||
| 150 | WARN_ON(root->log_root); | ||
| 151 | root->log_root = new_root; | ||
| 152 | |||
| 153 | /* | ||
| 154 | * log trees do not get reference counted because they go away | ||
| 155 | * before a real commit is actually done. They do store pointers | ||
| 156 | * to file data extents, and those reference counts still get | ||
| 157 | * updated (along with back refs to the log tree). | ||
| 158 | */ | ||
| 159 | new_root->ref_cows = 0; | ||
| 160 | new_root->last_trans = trans->transid; | ||
| 161 | |||
| 162 | /* | ||
| 163 | * we need to make sure the root block for this new tree | ||
| 164 | * is marked as dirty in the dirty_log_pages tree. This | ||
| 165 | * is how it gets flushed down to disk at tree log commit time. | ||
| 166 | * | ||
| 167 | * the tree logging mutex keeps others from coming in and changing | ||
| 168 | * the new_root->node, so we can safely access it here | ||
| 169 | */ | ||
| 170 | set_extent_dirty(&new_root->dirty_log_pages, new_root->node->start, | ||
| 171 | new_root->node->start + new_root->node->len - 1, | ||
| 172 | GFP_NOFS); | ||
| 173 | |||
| 174 | fail: | ||
| 175 | return ret; | ||
| 176 | } | ||
| 177 | |||
| 178 | /* | ||
| 179 | * start a sub transaction and setup the log tree | 81 | * start a sub transaction and setup the log tree |
| 180 | * this increments the log tree writer count to make the people | 82 | * this increments the log tree writer count to make the people |
| 181 | * syncing the tree wait for us to finish | 83 | * syncing the tree wait for us to finish |
| @@ -184,6 +86,14 @@ static int start_log_trans(struct btrfs_trans_handle *trans, | |||
| 184 | struct btrfs_root *root) | 86 | struct btrfs_root *root) |
| 185 | { | 87 | { |
| 186 | int ret; | 88 | int ret; |
| 89 | |||
| 90 | mutex_lock(&root->log_mutex); | ||
| 91 | if (root->log_root) { | ||
| 92 | root->log_batch++; | ||
| 93 | atomic_inc(&root->log_writers); | ||
| 94 | mutex_unlock(&root->log_mutex); | ||
| 95 | return 0; | ||
| 96 | } | ||
| 187 | mutex_lock(&root->fs_info->tree_log_mutex); | 97 | mutex_lock(&root->fs_info->tree_log_mutex); |
| 188 | if (!root->fs_info->log_root_tree) { | 98 | if (!root->fs_info->log_root_tree) { |
| 189 | ret = btrfs_init_log_root_tree(trans, root->fs_info); | 99 | ret = btrfs_init_log_root_tree(trans, root->fs_info); |
| @@ -193,9 +103,10 @@ static int start_log_trans(struct btrfs_trans_handle *trans, | |||
| 193 | ret = btrfs_add_log_tree(trans, root); | 103 | ret = btrfs_add_log_tree(trans, root); |
| 194 | BUG_ON(ret); | 104 | BUG_ON(ret); |
| 195 | } | 105 | } |
| 196 | atomic_inc(&root->fs_info->tree_log_writers); | ||
| 197 | root->fs_info->tree_log_batch++; | ||
| 198 | mutex_unlock(&root->fs_info->tree_log_mutex); | 106 | mutex_unlock(&root->fs_info->tree_log_mutex); |
| 107 | root->log_batch++; | ||
| 108 | atomic_inc(&root->log_writers); | ||
| 109 | mutex_unlock(&root->log_mutex); | ||
| 199 | return 0; | 110 | return 0; |
| 200 | } | 111 | } |
| 201 | 112 | ||
| @@ -212,13 +123,12 @@ static int join_running_log_trans(struct btrfs_root *root) | |||
| 212 | if (!root->log_root) | 123 | if (!root->log_root) |
| 213 | return -ENOENT; | 124 | return -ENOENT; |
| 214 | 125 | ||
| 215 | mutex_lock(&root->fs_info->tree_log_mutex); | 126 | mutex_lock(&root->log_mutex); |
| 216 | if (root->log_root) { | 127 | if (root->log_root) { |
| 217 | ret = 0; | 128 | ret = 0; |
| 218 | atomic_inc(&root->fs_info->tree_log_writers); | 129 | atomic_inc(&root->log_writers); |
| 219 | root->fs_info->tree_log_batch++; | ||
| 220 | } | 130 | } |
| 221 | mutex_unlock(&root->fs_info->tree_log_mutex); | 131 | mutex_unlock(&root->log_mutex); |
| 222 | return ret; | 132 | return ret; |
| 223 | } | 133 | } |
| 224 | 134 | ||
| @@ -228,10 +138,11 @@ static int join_running_log_trans(struct btrfs_root *root) | |||
| 228 | */ | 138 | */ |
| 229 | static int end_log_trans(struct btrfs_root *root) | 139 | static int end_log_trans(struct btrfs_root *root) |
| 230 | { | 140 | { |
| 231 | atomic_dec(&root->fs_info->tree_log_writers); | 141 | if (atomic_dec_and_test(&root->log_writers)) { |
| 232 | smp_mb(); | 142 | smp_mb(); |
| 233 | if (waitqueue_active(&root->fs_info->tree_log_wait)) | 143 | if (waitqueue_active(&root->log_writer_wait)) |
| 234 | wake_up(&root->fs_info->tree_log_wait); | 144 | wake_up(&root->log_writer_wait); |
| 145 | } | ||
| 235 | return 0; | 146 | return 0; |
| 236 | } | 147 | } |
| 237 | 148 | ||
| @@ -1704,6 +1615,7 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans, | |||
| 1704 | 1615 | ||
| 1705 | btrfs_tree_lock(next); | 1616 | btrfs_tree_lock(next); |
| 1706 | clean_tree_block(trans, root, next); | 1617 | clean_tree_block(trans, root, next); |
| 1618 | btrfs_set_lock_blocking(next); | ||
| 1707 | btrfs_wait_tree_block_writeback(next); | 1619 | btrfs_wait_tree_block_writeback(next); |
| 1708 | btrfs_tree_unlock(next); | 1620 | btrfs_tree_unlock(next); |
| 1709 | 1621 | ||
| @@ -1750,6 +1662,7 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans, | |||
| 1750 | next = path->nodes[*level]; | 1662 | next = path->nodes[*level]; |
| 1751 | btrfs_tree_lock(next); | 1663 | btrfs_tree_lock(next); |
| 1752 | clean_tree_block(trans, root, next); | 1664 | clean_tree_block(trans, root, next); |
| 1665 | btrfs_set_lock_blocking(next); | ||
| 1753 | btrfs_wait_tree_block_writeback(next); | 1666 | btrfs_wait_tree_block_writeback(next); |
| 1754 | btrfs_tree_unlock(next); | 1667 | btrfs_tree_unlock(next); |
| 1755 | 1668 | ||
| @@ -1807,6 +1720,7 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans, | |||
| 1807 | 1720 | ||
| 1808 | btrfs_tree_lock(next); | 1721 | btrfs_tree_lock(next); |
| 1809 | clean_tree_block(trans, root, next); | 1722 | clean_tree_block(trans, root, next); |
| 1723 | btrfs_set_lock_blocking(next); | ||
| 1810 | btrfs_wait_tree_block_writeback(next); | 1724 | btrfs_wait_tree_block_writeback(next); |
| 1811 | btrfs_tree_unlock(next); | 1725 | btrfs_tree_unlock(next); |
| 1812 | 1726 | ||
| @@ -1879,6 +1793,7 @@ static int walk_log_tree(struct btrfs_trans_handle *trans, | |||
| 1879 | 1793 | ||
| 1880 | btrfs_tree_lock(next); | 1794 | btrfs_tree_lock(next); |
| 1881 | clean_tree_block(trans, log, next); | 1795 | clean_tree_block(trans, log, next); |
| 1796 | btrfs_set_lock_blocking(next); | ||
| 1882 | btrfs_wait_tree_block_writeback(next); | 1797 | btrfs_wait_tree_block_writeback(next); |
| 1883 | btrfs_tree_unlock(next); | 1798 | btrfs_tree_unlock(next); |
| 1884 | 1799 | ||
| @@ -1902,26 +1817,65 @@ static int walk_log_tree(struct btrfs_trans_handle *trans, | |||
| 1902 | } | 1817 | } |
| 1903 | } | 1818 | } |
| 1904 | btrfs_free_path(path); | 1819 | btrfs_free_path(path); |
| 1905 | if (wc->free) | ||
| 1906 | free_extent_buffer(log->node); | ||
| 1907 | return ret; | 1820 | return ret; |
| 1908 | } | 1821 | } |
| 1909 | 1822 | ||
| 1910 | static int wait_log_commit(struct btrfs_root *log) | 1823 | /* |
| 1824 | * helper function to update the item for a given subvolumes log root | ||
| 1825 | * in the tree of log roots | ||
| 1826 | */ | ||
| 1827 | static int update_log_root(struct btrfs_trans_handle *trans, | ||
| 1828 | struct btrfs_root *log) | ||
| 1829 | { | ||
| 1830 | int ret; | ||
| 1831 | |||
| 1832 | if (log->log_transid == 1) { | ||
| 1833 | /* insert root item on the first sync */ | ||
| 1834 | ret = btrfs_insert_root(trans, log->fs_info->log_root_tree, | ||
| 1835 | &log->root_key, &log->root_item); | ||
| 1836 | } else { | ||
| 1837 | ret = btrfs_update_root(trans, log->fs_info->log_root_tree, | ||
| 1838 | &log->root_key, &log->root_item); | ||
| 1839 | } | ||
| 1840 | return ret; | ||
| 1841 | } | ||
| 1842 | |||
| 1843 | static int wait_log_commit(struct btrfs_root *root, unsigned long transid) | ||
| 1911 | { | 1844 | { |
| 1912 | DEFINE_WAIT(wait); | 1845 | DEFINE_WAIT(wait); |
| 1913 | u64 transid = log->fs_info->tree_log_transid; | 1846 | int index = transid % 2; |
| 1914 | 1847 | ||
| 1848 | /* | ||
| 1849 | * we only allow two pending log transactions at a time, | ||
| 1850 | * so we know that if ours is more than 2 older than the | ||
| 1851 | * current transaction, we're done | ||
| 1852 | */ | ||
| 1915 | do { | 1853 | do { |
| 1916 | prepare_to_wait(&log->fs_info->tree_log_wait, &wait, | 1854 | prepare_to_wait(&root->log_commit_wait[index], |
| 1917 | TASK_UNINTERRUPTIBLE); | 1855 | &wait, TASK_UNINTERRUPTIBLE); |
| 1918 | mutex_unlock(&log->fs_info->tree_log_mutex); | 1856 | mutex_unlock(&root->log_mutex); |
| 1919 | if (atomic_read(&log->fs_info->tree_log_commit)) | 1857 | if (root->log_transid < transid + 2 && |
| 1858 | atomic_read(&root->log_commit[index])) | ||
| 1920 | schedule(); | 1859 | schedule(); |
| 1921 | finish_wait(&log->fs_info->tree_log_wait, &wait); | 1860 | finish_wait(&root->log_commit_wait[index], &wait); |
| 1922 | mutex_lock(&log->fs_info->tree_log_mutex); | 1861 | mutex_lock(&root->log_mutex); |
| 1923 | } while (transid == log->fs_info->tree_log_transid && | 1862 | } while (root->log_transid < transid + 2 && |
| 1924 | atomic_read(&log->fs_info->tree_log_commit)); | 1863 | atomic_read(&root->log_commit[index])); |
| 1864 | return 0; | ||
| 1865 | } | ||
| 1866 | |||
| 1867 | static int wait_for_writer(struct btrfs_root *root) | ||
| 1868 | { | ||
| 1869 | DEFINE_WAIT(wait); | ||
| 1870 | while (atomic_read(&root->log_writers)) { | ||
| 1871 | prepare_to_wait(&root->log_writer_wait, | ||
| 1872 | &wait, TASK_UNINTERRUPTIBLE); | ||
| 1873 | mutex_unlock(&root->log_mutex); | ||
| 1874 | if (atomic_read(&root->log_writers)) | ||
| 1875 | schedule(); | ||
| 1876 | mutex_lock(&root->log_mutex); | ||
| 1877 | finish_wait(&root->log_writer_wait, &wait); | ||
| 1878 | } | ||
| 1925 | return 0; | 1879 | return 0; |
| 1926 | } | 1880 | } |
| 1927 | 1881 | ||
| @@ -1933,57 +1887,114 @@ static int wait_log_commit(struct btrfs_root *log) | |||
| 1933 | int btrfs_sync_log(struct btrfs_trans_handle *trans, | 1887 | int btrfs_sync_log(struct btrfs_trans_handle *trans, |
| 1934 | struct btrfs_root *root) | 1888 | struct btrfs_root *root) |
| 1935 | { | 1889 | { |
| 1890 | int index1; | ||
| 1891 | int index2; | ||
| 1936 | int ret; | 1892 | int ret; |
| 1937 | unsigned long batch; | ||
| 1938 | struct btrfs_root *log = root->log_root; | 1893 | struct btrfs_root *log = root->log_root; |
| 1894 | struct btrfs_root *log_root_tree = root->fs_info->log_root_tree; | ||
| 1939 | 1895 | ||
| 1940 | mutex_lock(&log->fs_info->tree_log_mutex); | 1896 | mutex_lock(&root->log_mutex); |
| 1941 | if (atomic_read(&log->fs_info->tree_log_commit)) { | 1897 | index1 = root->log_transid % 2; |
| 1942 | wait_log_commit(log); | 1898 | if (atomic_read(&root->log_commit[index1])) { |
| 1943 | goto out; | 1899 | wait_log_commit(root, root->log_transid); |
| 1900 | mutex_unlock(&root->log_mutex); | ||
| 1901 | return 0; | ||
| 1944 | } | 1902 | } |
| 1945 | atomic_set(&log->fs_info->tree_log_commit, 1); | 1903 | atomic_set(&root->log_commit[index1], 1); |
| 1904 | |||
| 1905 | /* wait for previous tree log sync to complete */ | ||
| 1906 | if (atomic_read(&root->log_commit[(index1 + 1) % 2])) | ||
| 1907 | wait_log_commit(root, root->log_transid - 1); | ||
| 1946 | 1908 | ||
| 1947 | while (1) { | 1909 | while (1) { |
| 1948 | batch = log->fs_info->tree_log_batch; | 1910 | unsigned long batch = root->log_batch; |
| 1949 | mutex_unlock(&log->fs_info->tree_log_mutex); | 1911 | mutex_unlock(&root->log_mutex); |
| 1950 | schedule_timeout_uninterruptible(1); | 1912 | schedule_timeout_uninterruptible(1); |
| 1951 | mutex_lock(&log->fs_info->tree_log_mutex); | 1913 | mutex_lock(&root->log_mutex); |
| 1952 | 1914 | wait_for_writer(root); | |
| 1953 | while (atomic_read(&log->fs_info->tree_log_writers)) { | 1915 | if (batch == root->log_batch) |
| 1954 | DEFINE_WAIT(wait); | ||
| 1955 | prepare_to_wait(&log->fs_info->tree_log_wait, &wait, | ||
| 1956 | TASK_UNINTERRUPTIBLE); | ||
| 1957 | mutex_unlock(&log->fs_info->tree_log_mutex); | ||
| 1958 | if (atomic_read(&log->fs_info->tree_log_writers)) | ||
| 1959 | schedule(); | ||
| 1960 | mutex_lock(&log->fs_info->tree_log_mutex); | ||
| 1961 | finish_wait(&log->fs_info->tree_log_wait, &wait); | ||
| 1962 | } | ||
| 1963 | if (batch == log->fs_info->tree_log_batch) | ||
| 1964 | break; | 1916 | break; |
| 1965 | } | 1917 | } |
| 1966 | 1918 | ||
| 1967 | ret = btrfs_write_and_wait_marked_extents(log, &log->dirty_log_pages); | 1919 | ret = btrfs_write_and_wait_marked_extents(log, &log->dirty_log_pages); |
| 1968 | BUG_ON(ret); | 1920 | BUG_ON(ret); |
| 1969 | ret = btrfs_write_and_wait_marked_extents(root->fs_info->log_root_tree, | 1921 | |
| 1970 | &root->fs_info->log_root_tree->dirty_log_pages); | 1922 | btrfs_set_root_bytenr(&log->root_item, log->node->start); |
| 1923 | btrfs_set_root_generation(&log->root_item, trans->transid); | ||
| 1924 | btrfs_set_root_level(&log->root_item, btrfs_header_level(log->node)); | ||
| 1925 | |||
| 1926 | root->log_batch = 0; | ||
| 1927 | root->log_transid++; | ||
| 1928 | log->log_transid = root->log_transid; | ||
| 1929 | smp_mb(); | ||
| 1930 | /* | ||
| 1931 | * log tree has been flushed to disk, new modifications of | ||
| 1932 | * the log will be written to new positions. so it's safe to | ||
| 1933 | * allow log writers to go in. | ||
| 1934 | */ | ||
| 1935 | mutex_unlock(&root->log_mutex); | ||
| 1936 | |||
| 1937 | mutex_lock(&log_root_tree->log_mutex); | ||
| 1938 | log_root_tree->log_batch++; | ||
| 1939 | atomic_inc(&log_root_tree->log_writers); | ||
| 1940 | mutex_unlock(&log_root_tree->log_mutex); | ||
| 1941 | |||
| 1942 | ret = update_log_root(trans, log); | ||
| 1943 | BUG_ON(ret); | ||
| 1944 | |||
| 1945 | mutex_lock(&log_root_tree->log_mutex); | ||
| 1946 | if (atomic_dec_and_test(&log_root_tree->log_writers)) { | ||
| 1947 | smp_mb(); | ||
| 1948 | if (waitqueue_active(&log_root_tree->log_writer_wait)) | ||
| 1949 | wake_up(&log_root_tree->log_writer_wait); | ||
| 1950 | } | ||
| 1951 | |||
| 1952 | index2 = log_root_tree->log_transid % 2; | ||
| 1953 | if (atomic_read(&log_root_tree->log_commit[index2])) { | ||
| 1954 | wait_log_commit(log_root_tree, log_root_tree->log_transid); | ||
| 1955 | mutex_unlock(&log_root_tree->log_mutex); | ||
| 1956 | goto out; | ||
| 1957 | } | ||
| 1958 | atomic_set(&log_root_tree->log_commit[index2], 1); | ||
| 1959 | |||
| 1960 | if (atomic_read(&log_root_tree->log_commit[(index2 + 1) % 2])) | ||
| 1961 | wait_log_commit(log_root_tree, log_root_tree->log_transid - 1); | ||
| 1962 | |||
| 1963 | wait_for_writer(log_root_tree); | ||
| 1964 | |||
| 1965 | ret = btrfs_write_and_wait_marked_extents(log_root_tree, | ||
| 1966 | &log_root_tree->dirty_log_pages); | ||
| 1971 | BUG_ON(ret); | 1967 | BUG_ON(ret); |
| 1972 | 1968 | ||
| 1973 | btrfs_set_super_log_root(&root->fs_info->super_for_commit, | 1969 | btrfs_set_super_log_root(&root->fs_info->super_for_commit, |
| 1974 | log->fs_info->log_root_tree->node->start); | 1970 | log_root_tree->node->start); |
| 1975 | btrfs_set_super_log_root_level(&root->fs_info->super_for_commit, | 1971 | btrfs_set_super_log_root_level(&root->fs_info->super_for_commit, |
| 1976 | btrfs_header_level(log->fs_info->log_root_tree->node)); | 1972 | btrfs_header_level(log_root_tree->node)); |
| 1973 | |||
| 1974 | log_root_tree->log_batch = 0; | ||
| 1975 | log_root_tree->log_transid++; | ||
| 1976 | smp_mb(); | ||
| 1977 | |||
| 1978 | mutex_unlock(&log_root_tree->log_mutex); | ||
| 1979 | |||
| 1980 | /* | ||
| 1981 | * nobody else is going to jump in and write the the ctree | ||
| 1982 | * super here because the log_commit atomic below is protecting | ||
| 1983 | * us. We must be called with a transaction handle pinning | ||
| 1984 | * the running transaction open, so a full commit can't hop | ||
| 1985 | * in and cause problems either. | ||
| 1986 | */ | ||
| 1987 | write_ctree_super(trans, root->fs_info->tree_root, 2); | ||
| 1977 | 1988 | ||
| 1978 | write_ctree_super(trans, log->fs_info->tree_root, 2); | 1989 | atomic_set(&log_root_tree->log_commit[index2], 0); |
| 1979 | log->fs_info->tree_log_transid++; | ||
| 1980 | log->fs_info->tree_log_batch = 0; | ||
| 1981 | atomic_set(&log->fs_info->tree_log_commit, 0); | ||
| 1982 | smp_mb(); | 1990 | smp_mb(); |
| 1983 | if (waitqueue_active(&log->fs_info->tree_log_wait)) | 1991 | if (waitqueue_active(&log_root_tree->log_commit_wait[index2])) |
| 1984 | wake_up(&log->fs_info->tree_log_wait); | 1992 | wake_up(&log_root_tree->log_commit_wait[index2]); |
| 1985 | out: | 1993 | out: |
| 1986 | mutex_unlock(&log->fs_info->tree_log_mutex); | 1994 | atomic_set(&root->log_commit[index1], 0); |
| 1995 | smp_mb(); | ||
| 1996 | if (waitqueue_active(&root->log_commit_wait[index1])) | ||
| 1997 | wake_up(&root->log_commit_wait[index1]); | ||
| 1987 | return 0; | 1998 | return 0; |
| 1988 | } | 1999 | } |
| 1989 | 2000 | ||
| @@ -2019,38 +2030,18 @@ int btrfs_free_log(struct btrfs_trans_handle *trans, struct btrfs_root *root) | |||
| 2019 | start, end, GFP_NOFS); | 2030 | start, end, GFP_NOFS); |
| 2020 | } | 2031 | } |
| 2021 | 2032 | ||
| 2022 | log = root->log_root; | 2033 | if (log->log_transid > 0) { |
| 2023 | ret = btrfs_del_root(trans, root->fs_info->log_root_tree, | 2034 | ret = btrfs_del_root(trans, root->fs_info->log_root_tree, |
| 2024 | &log->root_key); | 2035 | &log->root_key); |
| 2025 | BUG_ON(ret); | 2036 | BUG_ON(ret); |
| 2037 | } | ||
| 2026 | root->log_root = NULL; | 2038 | root->log_root = NULL; |
| 2027 | kfree(root->log_root); | 2039 | free_extent_buffer(log->node); |
| 2040 | kfree(log); | ||
| 2028 | return 0; | 2041 | return 0; |
| 2029 | } | 2042 | } |
| 2030 | 2043 | ||
| 2031 | /* | 2044 | /* |
| 2032 | * helper function to update the item for a given subvolumes log root | ||
| 2033 | * in the tree of log roots | ||
| 2034 | */ | ||
| 2035 | static int update_log_root(struct btrfs_trans_handle *trans, | ||
| 2036 | struct btrfs_root *log) | ||
| 2037 | { | ||
| 2038 | u64 bytenr = btrfs_root_bytenr(&log->root_item); | ||
| 2039 | int ret; | ||
| 2040 | |||
| 2041 | if (log->node->start == bytenr) | ||
| 2042 | return 0; | ||
| 2043 | |||
| 2044 | btrfs_set_root_bytenr(&log->root_item, log->node->start); | ||
| 2045 | btrfs_set_root_generation(&log->root_item, trans->transid); | ||
| 2046 | btrfs_set_root_level(&log->root_item, btrfs_header_level(log->node)); | ||
| 2047 | ret = btrfs_update_root(trans, log->fs_info->log_root_tree, | ||
| 2048 | &log->root_key, &log->root_item); | ||
| 2049 | BUG_ON(ret); | ||
| 2050 | return ret; | ||
| 2051 | } | ||
| 2052 | |||
| 2053 | /* | ||
| 2054 | * If both a file and directory are logged, and unlinks or renames are | 2045 | * If both a file and directory are logged, and unlinks or renames are |
| 2055 | * mixed in, we have a few interesting corners: | 2046 | * mixed in, we have a few interesting corners: |
| 2056 | * | 2047 | * |
| @@ -2711,11 +2702,6 @@ next_slot: | |||
| 2711 | 2702 | ||
| 2712 | btrfs_free_path(path); | 2703 | btrfs_free_path(path); |
| 2713 | btrfs_free_path(dst_path); | 2704 | btrfs_free_path(dst_path); |
| 2714 | |||
| 2715 | mutex_lock(&root->fs_info->tree_log_mutex); | ||
| 2716 | ret = update_log_root(trans, log); | ||
| 2717 | BUG_ON(ret); | ||
| 2718 | mutex_unlock(&root->fs_info->tree_log_mutex); | ||
| 2719 | out: | 2705 | out: |
| 2720 | return 0; | 2706 | return 0; |
| 2721 | } | 2707 | } |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 3451e1cca2b5..bcd14ebccae1 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | #include <linux/buffer_head.h> | 20 | #include <linux/buffer_head.h> |
| 21 | #include <linux/blkdev.h> | 21 | #include <linux/blkdev.h> |
| 22 | #include <linux/random.h> | 22 | #include <linux/random.h> |
| 23 | #include <linux/version.h> | ||
| 24 | #include <asm/div64.h> | 23 | #include <asm/div64.h> |
| 25 | #include "compat.h" | 24 | #include "compat.h" |
| 26 | #include "ctree.h" | 25 | #include "ctree.h" |
| @@ -104,10 +103,8 @@ static noinline struct btrfs_device *__find_device(struct list_head *head, | |||
| 104 | u64 devid, u8 *uuid) | 103 | u64 devid, u8 *uuid) |
| 105 | { | 104 | { |
| 106 | struct btrfs_device *dev; | 105 | struct btrfs_device *dev; |
| 107 | struct list_head *cur; | ||
| 108 | 106 | ||
| 109 | list_for_each(cur, head) { | 107 | list_for_each_entry(dev, head, dev_list) { |
| 110 | dev = list_entry(cur, struct btrfs_device, dev_list); | ||
| 111 | if (dev->devid == devid && | 108 | if (dev->devid == devid && |
| 112 | (!uuid || !memcmp(dev->uuid, uuid, BTRFS_UUID_SIZE))) { | 109 | (!uuid || !memcmp(dev->uuid, uuid, BTRFS_UUID_SIZE))) { |
| 113 | return dev; | 110 | return dev; |
| @@ -118,11 +115,9 @@ static noinline struct btrfs_device *__find_device(struct list_head *head, | |||
| 118 | 115 | ||
| 119 | static noinline struct btrfs_fs_devices *find_fsid(u8 *fsid) | 116 | static noinline struct btrfs_fs_devices *find_fsid(u8 *fsid) |
| 120 | { | 117 | { |
| 121 | struct list_head *cur; | ||
| 122 | struct btrfs_fs_devices *fs_devices; | 118 | struct btrfs_fs_devices *fs_devices; |
| 123 | 119 | ||
| 124 | list_for_each(cur, &fs_uuids) { | 120 | list_for_each_entry(fs_devices, &fs_uuids, list) { |
| 125 | fs_devices = list_entry(cur, struct btrfs_fs_devices, list); | ||
| 126 | if (memcmp(fsid, fs_devices->fsid, BTRFS_FSID_SIZE) == 0) | 121 | if (memcmp(fsid, fs_devices->fsid, BTRFS_FSID_SIZE) == 0) |
| 127 | return fs_devices; | 122 | return fs_devices; |
| 128 | } | 123 | } |
| @@ -159,6 +154,7 @@ static noinline int run_scheduled_bios(struct btrfs_device *device) | |||
| 159 | loop: | 154 | loop: |
| 160 | spin_lock(&device->io_lock); | 155 | spin_lock(&device->io_lock); |
| 161 | 156 | ||
| 157 | loop_lock: | ||
| 162 | /* take all the bios off the list at once and process them | 158 | /* take all the bios off the list at once and process them |
| 163 | * later on (without the lock held). But, remember the | 159 | * later on (without the lock held). But, remember the |
| 164 | * tail and other pointers so the bios can be properly reinserted | 160 | * tail and other pointers so the bios can be properly reinserted |
| @@ -208,7 +204,7 @@ loop: | |||
| 208 | * is now congested. Back off and let other work structs | 204 | * is now congested. Back off and let other work structs |
| 209 | * run instead | 205 | * run instead |
| 210 | */ | 206 | */ |
| 211 | if (pending && bdi_write_congested(bdi) && | 207 | if (pending && bdi_write_congested(bdi) && num_run > 16 && |
| 212 | fs_info->fs_devices->open_devices > 1) { | 208 | fs_info->fs_devices->open_devices > 1) { |
| 213 | struct bio *old_head; | 209 | struct bio *old_head; |
| 214 | 210 | ||
| @@ -220,7 +216,8 @@ loop: | |||
| 220 | tail->bi_next = old_head; | 216 | tail->bi_next = old_head; |
| 221 | else | 217 | else |
| 222 | device->pending_bio_tail = tail; | 218 | device->pending_bio_tail = tail; |
| 223 | device->running_pending = 0; | 219 | |
| 220 | device->running_pending = 1; | ||
| 224 | 221 | ||
| 225 | spin_unlock(&device->io_lock); | 222 | spin_unlock(&device->io_lock); |
| 226 | btrfs_requeue_work(&device->work); | 223 | btrfs_requeue_work(&device->work); |
| @@ -229,6 +226,11 @@ loop: | |||
| 229 | } | 226 | } |
| 230 | if (again) | 227 | if (again) |
| 231 | goto loop; | 228 | goto loop; |
| 229 | |||
| 230 | spin_lock(&device->io_lock); | ||
| 231 | if (device->pending_bios) | ||
| 232 | goto loop_lock; | ||
| 233 | spin_unlock(&device->io_lock); | ||
| 232 | done: | 234 | done: |
| 233 | return 0; | 235 | return 0; |
| 234 | } | 236 | } |
| @@ -345,14 +347,11 @@ error: | |||
| 345 | 347 | ||
| 346 | int btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices) | 348 | int btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices) |
| 347 | { | 349 | { |
| 348 | struct list_head *tmp; | 350 | struct btrfs_device *device, *next; |
| 349 | struct list_head *cur; | ||
| 350 | struct btrfs_device *device; | ||
| 351 | 351 | ||
| 352 | mutex_lock(&uuid_mutex); | 352 | mutex_lock(&uuid_mutex); |
| 353 | again: | 353 | again: |
| 354 | list_for_each_safe(cur, tmp, &fs_devices->devices) { | 354 | list_for_each_entry_safe(device, next, &fs_devices->devices, dev_list) { |
| 355 | device = list_entry(cur, struct btrfs_device, dev_list); | ||
| 356 | if (device->in_fs_metadata) | 355 | if (device->in_fs_metadata) |
| 357 | continue; | 356 | continue; |
| 358 | 357 | ||
| @@ -383,14 +382,12 @@ again: | |||
| 383 | 382 | ||
| 384 | static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices) | 383 | static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices) |
| 385 | { | 384 | { |
| 386 | struct list_head *cur; | ||
| 387 | struct btrfs_device *device; | 385 | struct btrfs_device *device; |
| 388 | 386 | ||
| 389 | if (--fs_devices->opened > 0) | 387 | if (--fs_devices->opened > 0) |
| 390 | return 0; | 388 | return 0; |
| 391 | 389 | ||
| 392 | list_for_each(cur, &fs_devices->devices) { | 390 | list_for_each_entry(device, &fs_devices->devices, dev_list) { |
| 393 | device = list_entry(cur, struct btrfs_device, dev_list); | ||
| 394 | if (device->bdev) { | 391 | if (device->bdev) { |
| 395 | close_bdev_exclusive(device->bdev, device->mode); | 392 | close_bdev_exclusive(device->bdev, device->mode); |
| 396 | fs_devices->open_devices--; | 393 | fs_devices->open_devices--; |
| @@ -439,7 +436,6 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices, | |||
| 439 | { | 436 | { |
| 440 | struct block_device *bdev; | 437 | struct block_device *bdev; |
| 441 | struct list_head *head = &fs_devices->devices; | 438 | struct list_head *head = &fs_devices->devices; |
| 442 | struct list_head *cur; | ||
| 443 | struct btrfs_device *device; | 439 | struct btrfs_device *device; |
| 444 | struct block_device *latest_bdev = NULL; | 440 | struct block_device *latest_bdev = NULL; |
| 445 | struct buffer_head *bh; | 441 | struct buffer_head *bh; |
| @@ -450,8 +446,7 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices, | |||
| 450 | int seeding = 1; | 446 | int seeding = 1; |
| 451 | int ret = 0; | 447 | int ret = 0; |
| 452 | 448 | ||
| 453 | list_for_each(cur, head) { | 449 | list_for_each_entry(device, head, dev_list) { |
| 454 | device = list_entry(cur, struct btrfs_device, dev_list); | ||
| 455 | if (device->bdev) | 450 | if (device->bdev) |
| 456 | continue; | 451 | continue; |
| 457 | if (!device->name) | 452 | if (!device->name) |
| @@ -578,7 +573,7 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder, | |||
| 578 | *(unsigned long long *)disk_super->fsid, | 573 | *(unsigned long long *)disk_super->fsid, |
| 579 | *(unsigned long long *)(disk_super->fsid + 8)); | 574 | *(unsigned long long *)(disk_super->fsid + 8)); |
| 580 | } | 575 | } |
| 581 | printk(KERN_INFO "devid %llu transid %llu %s\n", | 576 | printk(KERN_CONT "devid %llu transid %llu %s\n", |
| 582 | (unsigned long long)devid, (unsigned long long)transid, path); | 577 | (unsigned long long)devid, (unsigned long long)transid, path); |
| 583 | ret = device_list_add(path, disk_super, devid, fs_devices_ret); | 578 | ret = device_list_add(path, disk_super, devid, fs_devices_ret); |
| 584 | 579 | ||
| @@ -1017,14 +1012,12 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
| 1017 | } | 1012 | } |
| 1018 | 1013 | ||
| 1019 | if (strcmp(device_path, "missing") == 0) { | 1014 | if (strcmp(device_path, "missing") == 0) { |
| 1020 | struct list_head *cur; | ||
| 1021 | struct list_head *devices; | 1015 | struct list_head *devices; |
| 1022 | struct btrfs_device *tmp; | 1016 | struct btrfs_device *tmp; |
| 1023 | 1017 | ||
| 1024 | device = NULL; | 1018 | device = NULL; |
| 1025 | devices = &root->fs_info->fs_devices->devices; | 1019 | devices = &root->fs_info->fs_devices->devices; |
| 1026 | list_for_each(cur, devices) { | 1020 | list_for_each_entry(tmp, devices, dev_list) { |
| 1027 | tmp = list_entry(cur, struct btrfs_device, dev_list); | ||
| 1028 | if (tmp->in_fs_metadata && !tmp->bdev) { | 1021 | if (tmp->in_fs_metadata && !tmp->bdev) { |
| 1029 | device = tmp; | 1022 | device = tmp; |
| 1030 | break; | 1023 | break; |
| @@ -1280,7 +1273,6 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
| 1280 | struct btrfs_trans_handle *trans; | 1273 | struct btrfs_trans_handle *trans; |
| 1281 | struct btrfs_device *device; | 1274 | struct btrfs_device *device; |
| 1282 | struct block_device *bdev; | 1275 | struct block_device *bdev; |
| 1283 | struct list_head *cur; | ||
| 1284 | struct list_head *devices; | 1276 | struct list_head *devices; |
| 1285 | struct super_block *sb = root->fs_info->sb; | 1277 | struct super_block *sb = root->fs_info->sb; |
| 1286 | u64 total_bytes; | 1278 | u64 total_bytes; |
| @@ -1304,8 +1296,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
| 1304 | mutex_lock(&root->fs_info->volume_mutex); | 1296 | mutex_lock(&root->fs_info->volume_mutex); |
| 1305 | 1297 | ||
| 1306 | devices = &root->fs_info->fs_devices->devices; | 1298 | devices = &root->fs_info->fs_devices->devices; |
| 1307 | list_for_each(cur, devices) { | 1299 | list_for_each_entry(device, devices, dev_list) { |
| 1308 | device = list_entry(cur, struct btrfs_device, dev_list); | ||
| 1309 | if (device->bdev == bdev) { | 1300 | if (device->bdev == bdev) { |
| 1310 | ret = -EEXIST; | 1301 | ret = -EEXIST; |
| 1311 | goto error; | 1302 | goto error; |
| @@ -1704,7 +1695,6 @@ static u64 div_factor(u64 num, int factor) | |||
| 1704 | int btrfs_balance(struct btrfs_root *dev_root) | 1695 | int btrfs_balance(struct btrfs_root *dev_root) |
| 1705 | { | 1696 | { |
| 1706 | int ret; | 1697 | int ret; |
| 1707 | struct list_head *cur; | ||
| 1708 | struct list_head *devices = &dev_root->fs_info->fs_devices->devices; | 1698 | struct list_head *devices = &dev_root->fs_info->fs_devices->devices; |
| 1709 | struct btrfs_device *device; | 1699 | struct btrfs_device *device; |
| 1710 | u64 old_size; | 1700 | u64 old_size; |
| @@ -1723,8 +1713,7 @@ int btrfs_balance(struct btrfs_root *dev_root) | |||
| 1723 | dev_root = dev_root->fs_info->dev_root; | 1713 | dev_root = dev_root->fs_info->dev_root; |
| 1724 | 1714 | ||
| 1725 | /* step one make some room on all the devices */ | 1715 | /* step one make some room on all the devices */ |
| 1726 | list_for_each(cur, devices) { | 1716 | list_for_each_entry(device, devices, dev_list) { |
| 1727 | device = list_entry(cur, struct btrfs_device, dev_list); | ||
| 1728 | old_size = device->total_bytes; | 1717 | old_size = device->total_bytes; |
| 1729 | size_to_free = div_factor(old_size, 1); | 1718 | size_to_free = div_factor(old_size, 1); |
| 1730 | size_to_free = min(size_to_free, (u64)1 * 1024 * 1024); | 1719 | size_to_free = min(size_to_free, (u64)1 * 1024 * 1024); |
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index 7f332e270894..a9d3bf4d2689 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
| 22 | #include <linux/rwsem.h> | 22 | #include <linux/rwsem.h> |
| 23 | #include <linux/xattr.h> | 23 | #include <linux/xattr.h> |
| 24 | #include <linux/security.h> | ||
| 24 | #include "ctree.h" | 25 | #include "ctree.h" |
| 25 | #include "btrfs_inode.h" | 26 | #include "btrfs_inode.h" |
| 26 | #include "transaction.h" | 27 | #include "transaction.h" |
| @@ -45,9 +46,12 @@ ssize_t __btrfs_getxattr(struct inode *inode, const char *name, | |||
| 45 | /* lookup the xattr by name */ | 46 | /* lookup the xattr by name */ |
| 46 | di = btrfs_lookup_xattr(NULL, root, path, inode->i_ino, name, | 47 | di = btrfs_lookup_xattr(NULL, root, path, inode->i_ino, name, |
| 47 | strlen(name), 0); | 48 | strlen(name), 0); |
| 48 | if (!di || IS_ERR(di)) { | 49 | if (!di) { |
| 49 | ret = -ENODATA; | 50 | ret = -ENODATA; |
| 50 | goto out; | 51 | goto out; |
| 52 | } else if (IS_ERR(di)) { | ||
| 53 | ret = PTR_ERR(di); | ||
| 54 | goto out; | ||
| 51 | } | 55 | } |
| 52 | 56 | ||
| 53 | leaf = path->nodes[0]; | 57 | leaf = path->nodes[0]; |
| @@ -62,6 +66,14 @@ ssize_t __btrfs_getxattr(struct inode *inode, const char *name, | |||
| 62 | ret = -ERANGE; | 66 | ret = -ERANGE; |
| 63 | goto out; | 67 | goto out; |
| 64 | } | 68 | } |
| 69 | |||
| 70 | /* | ||
| 71 | * The way things are packed into the leaf is like this | ||
| 72 | * |struct btrfs_dir_item|name|data| | ||
| 73 | * where name is the xattr name, so security.foo, and data is the | ||
| 74 | * content of the xattr. data_ptr points to the location in memory | ||
| 75 | * where the data starts in the in memory leaf | ||
| 76 | */ | ||
| 65 | data_ptr = (unsigned long)((char *)(di + 1) + | 77 | data_ptr = (unsigned long)((char *)(di + 1) + |
| 66 | btrfs_dir_name_len(leaf, di)); | 78 | btrfs_dir_name_len(leaf, di)); |
| 67 | read_extent_buffer(leaf, buffer, data_ptr, | 79 | read_extent_buffer(leaf, buffer, data_ptr, |
| @@ -86,7 +98,7 @@ int __btrfs_setxattr(struct inode *inode, const char *name, | |||
| 86 | if (!path) | 98 | if (!path) |
| 87 | return -ENOMEM; | 99 | return -ENOMEM; |
| 88 | 100 | ||
| 89 | trans = btrfs_start_transaction(root, 1); | 101 | trans = btrfs_join_transaction(root, 1); |
| 90 | btrfs_set_trans_block_group(trans, inode); | 102 | btrfs_set_trans_block_group(trans, inode); |
| 91 | 103 | ||
| 92 | /* first lets see if we already have this xattr */ | 104 | /* first lets see if we already have this xattr */ |
| @@ -176,7 +188,6 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size) | |||
| 176 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); | 188 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); |
| 177 | if (ret < 0) | 189 | if (ret < 0) |
| 178 | goto err; | 190 | goto err; |
| 179 | ret = 0; | ||
| 180 | advance = 0; | 191 | advance = 0; |
| 181 | while (1) { | 192 | while (1) { |
| 182 | leaf = path->nodes[0]; | 193 | leaf = path->nodes[0]; |
| @@ -320,3 +331,34 @@ int btrfs_removexattr(struct dentry *dentry, const char *name) | |||
| 320 | return -EOPNOTSUPP; | 331 | return -EOPNOTSUPP; |
| 321 | return __btrfs_setxattr(dentry->d_inode, name, NULL, 0, XATTR_REPLACE); | 332 | return __btrfs_setxattr(dentry->d_inode, name, NULL, 0, XATTR_REPLACE); |
| 322 | } | 333 | } |
| 334 | |||
| 335 | int btrfs_xattr_security_init(struct inode *inode, struct inode *dir) | ||
| 336 | { | ||
| 337 | int err; | ||
| 338 | size_t len; | ||
| 339 | void *value; | ||
| 340 | char *suffix; | ||
| 341 | char *name; | ||
| 342 | |||
| 343 | err = security_inode_init_security(inode, dir, &suffix, &value, &len); | ||
| 344 | if (err) { | ||
| 345 | if (err == -EOPNOTSUPP) | ||
| 346 | return 0; | ||
| 347 | return err; | ||
| 348 | } | ||
| 349 | |||
| 350 | name = kmalloc(XATTR_SECURITY_PREFIX_LEN + strlen(suffix) + 1, | ||
| 351 | GFP_NOFS); | ||
| 352 | if (!name) { | ||
| 353 | err = -ENOMEM; | ||
| 354 | } else { | ||
| 355 | strcpy(name, XATTR_SECURITY_PREFIX); | ||
| 356 | strcpy(name + XATTR_SECURITY_PREFIX_LEN, suffix); | ||
| 357 | err = __btrfs_setxattr(inode, name, value, len, 0); | ||
| 358 | kfree(name); | ||
| 359 | } | ||
| 360 | |||
| 361 | kfree(suffix); | ||
| 362 | kfree(value); | ||
| 363 | return err; | ||
| 364 | } | ||
diff --git a/fs/btrfs/xattr.h b/fs/btrfs/xattr.h index 5b1d08f8e68d..c71e9c3cf3f7 100644 --- a/fs/btrfs/xattr.h +++ b/fs/btrfs/xattr.h | |||
| @@ -36,4 +36,6 @@ extern int btrfs_setxattr(struct dentry *dentry, const char *name, | |||
| 36 | const void *value, size_t size, int flags); | 36 | const void *value, size_t size, int flags); |
| 37 | extern int btrfs_removexattr(struct dentry *dentry, const char *name); | 37 | extern int btrfs_removexattr(struct dentry *dentry, const char *name); |
| 38 | 38 | ||
| 39 | extern int btrfs_xattr_security_init(struct inode *inode, struct inode *dir); | ||
| 40 | |||
| 39 | #endif /* __XATTR__ */ | 41 | #endif /* __XATTR__ */ |
diff --git a/fs/buffer.c b/fs/buffer.c index b58208f1640a..665d446b25bc 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
| @@ -2688,7 +2688,7 @@ int nobh_write_end(struct file *file, struct address_space *mapping, | |||
| 2688 | struct buffer_head *bh; | 2688 | struct buffer_head *bh; |
| 2689 | BUG_ON(fsdata != NULL && page_has_buffers(page)); | 2689 | BUG_ON(fsdata != NULL && page_has_buffers(page)); |
| 2690 | 2690 | ||
| 2691 | if (unlikely(copied < len) && !page_has_buffers(page)) | 2691 | if (unlikely(copied < len) && head) |
| 2692 | attach_nobh_buffers(page, head); | 2692 | attach_nobh_buffers(page, head); |
| 2693 | if (page_has_buffers(page)) | 2693 | if (page_has_buffers(page)) |
| 2694 | return generic_write_end(file, mapping, pos, len, | 2694 | return generic_write_end(file, mapping, pos, len, |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index c8f8d5904f5e..9c6d815dd191 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
| @@ -785,7 +785,7 @@ static int sg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
| 785 | 785 | ||
| 786 | if (copy_in_user(&sgio->status, &sgio32->status, | 786 | if (copy_in_user(&sgio->status, &sgio32->status, |
| 787 | (4 * sizeof(unsigned char)) + | 787 | (4 * sizeof(unsigned char)) + |
| 788 | (2 * sizeof(unsigned (short))) + | 788 | (2 * sizeof(unsigned short)) + |
| 789 | (3 * sizeof(int)))) | 789 | (3 * sizeof(int)))) |
| 790 | return -EFAULT; | 790 | return -EFAULT; |
| 791 | 791 | ||
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index c01e043670e2..f6caeb1d1106 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
| @@ -1716,7 +1716,7 @@ static int ecryptfs_copy_filename(char **copied_name, size_t *copied_name_size, | |||
| 1716 | { | 1716 | { |
| 1717 | int rc = 0; | 1717 | int rc = 0; |
| 1718 | 1718 | ||
| 1719 | (*copied_name) = kmalloc((name_size + 2), GFP_KERNEL); | 1719 | (*copied_name) = kmalloc((name_size + 1), GFP_KERNEL); |
| 1720 | if (!(*copied_name)) { | 1720 | if (!(*copied_name)) { |
| 1721 | rc = -ENOMEM; | 1721 | rc = -ENOMEM; |
| 1722 | goto out; | 1722 | goto out; |
| @@ -1726,7 +1726,7 @@ static int ecryptfs_copy_filename(char **copied_name, size_t *copied_name_size, | |||
| 1726 | * in printing out the | 1726 | * in printing out the |
| 1727 | * string in debug | 1727 | * string in debug |
| 1728 | * messages */ | 1728 | * messages */ |
| 1729 | (*copied_name_size) = (name_size + 1); | 1729 | (*copied_name_size) = name_size; |
| 1730 | out: | 1730 | out: |
| 1731 | return rc; | 1731 | return rc; |
| 1732 | } | 1732 | } |
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index d861096c9d81..60fe74035db5 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
| @@ -5390,6 +5390,9 @@ int ocfs2_remove_btree_range(struct inode *inode, | |||
| 5390 | goto out; | 5390 | goto out; |
| 5391 | } | 5391 | } |
| 5392 | 5392 | ||
| 5393 | vfs_dq_free_space_nodirty(inode, | ||
| 5394 | ocfs2_clusters_to_bytes(inode->i_sb, len)); | ||
| 5395 | |||
| 5393 | ret = ocfs2_remove_extent(inode, et, cpos, len, handle, meta_ac, | 5396 | ret = ocfs2_remove_extent(inode, et, cpos, len, handle, meta_ac, |
| 5394 | dealloc); | 5397 | dealloc); |
| 5395 | if (ret) { | 5398 | if (ret) { |
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c index b1cc7c381e88..e9d7c2038c0f 100644 --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | #include "dlmglue.h" | 38 | #include "dlmglue.h" |
| 39 | #include "file.h" | 39 | #include "file.h" |
| 40 | #include "inode.h" | 40 | #include "inode.h" |
| 41 | #include "super.h" | ||
| 41 | 42 | ||
| 42 | 43 | ||
| 43 | static int ocfs2_dentry_revalidate(struct dentry *dentry, | 44 | static int ocfs2_dentry_revalidate(struct dentry *dentry, |
| @@ -294,6 +295,34 @@ out_attach: | |||
| 294 | return ret; | 295 | return ret; |
| 295 | } | 296 | } |
| 296 | 297 | ||
| 298 | static DEFINE_SPINLOCK(dentry_list_lock); | ||
| 299 | |||
| 300 | /* We limit the number of dentry locks to drop in one go. We have | ||
| 301 | * this limit so that we don't starve other users of ocfs2_wq. */ | ||
| 302 | #define DL_INODE_DROP_COUNT 64 | ||
| 303 | |||
| 304 | /* Drop inode references from dentry locks */ | ||
| 305 | void ocfs2_drop_dl_inodes(struct work_struct *work) | ||
| 306 | { | ||
| 307 | struct ocfs2_super *osb = container_of(work, struct ocfs2_super, | ||
| 308 | dentry_lock_work); | ||
| 309 | struct ocfs2_dentry_lock *dl; | ||
| 310 | int drop_count = DL_INODE_DROP_COUNT; | ||
| 311 | |||
| 312 | spin_lock(&dentry_list_lock); | ||
| 313 | while (osb->dentry_lock_list && drop_count--) { | ||
| 314 | dl = osb->dentry_lock_list; | ||
| 315 | osb->dentry_lock_list = dl->dl_next; | ||
| 316 | spin_unlock(&dentry_list_lock); | ||
| 317 | iput(dl->dl_inode); | ||
| 318 | kfree(dl); | ||
| 319 | spin_lock(&dentry_list_lock); | ||
| 320 | } | ||
| 321 | if (osb->dentry_lock_list) | ||
| 322 | queue_work(ocfs2_wq, &osb->dentry_lock_work); | ||
| 323 | spin_unlock(&dentry_list_lock); | ||
| 324 | } | ||
| 325 | |||
| 297 | /* | 326 | /* |
| 298 | * ocfs2_dentry_iput() and friends. | 327 | * ocfs2_dentry_iput() and friends. |
| 299 | * | 328 | * |
| @@ -318,16 +347,23 @@ out_attach: | |||
| 318 | static void ocfs2_drop_dentry_lock(struct ocfs2_super *osb, | 347 | static void ocfs2_drop_dentry_lock(struct ocfs2_super *osb, |
| 319 | struct ocfs2_dentry_lock *dl) | 348 | struct ocfs2_dentry_lock *dl) |
| 320 | { | 349 | { |
| 321 | iput(dl->dl_inode); | ||
| 322 | ocfs2_simple_drop_lockres(osb, &dl->dl_lockres); | 350 | ocfs2_simple_drop_lockres(osb, &dl->dl_lockres); |
| 323 | ocfs2_lock_res_free(&dl->dl_lockres); | 351 | ocfs2_lock_res_free(&dl->dl_lockres); |
| 324 | kfree(dl); | 352 | |
| 353 | /* We leave dropping of inode reference to ocfs2_wq as that can | ||
| 354 | * possibly lead to inode deletion which gets tricky */ | ||
| 355 | spin_lock(&dentry_list_lock); | ||
| 356 | if (!osb->dentry_lock_list) | ||
| 357 | queue_work(ocfs2_wq, &osb->dentry_lock_work); | ||
| 358 | dl->dl_next = osb->dentry_lock_list; | ||
| 359 | osb->dentry_lock_list = dl; | ||
| 360 | spin_unlock(&dentry_list_lock); | ||
| 325 | } | 361 | } |
| 326 | 362 | ||
| 327 | void ocfs2_dentry_lock_put(struct ocfs2_super *osb, | 363 | void ocfs2_dentry_lock_put(struct ocfs2_super *osb, |
| 328 | struct ocfs2_dentry_lock *dl) | 364 | struct ocfs2_dentry_lock *dl) |
| 329 | { | 365 | { |
| 330 | int unlock = 0; | 366 | int unlock; |
| 331 | 367 | ||
| 332 | BUG_ON(dl->dl_count == 0); | 368 | BUG_ON(dl->dl_count == 0); |
| 333 | 369 | ||
diff --git a/fs/ocfs2/dcache.h b/fs/ocfs2/dcache.h index c091c34d9883..d06e16c06640 100644 --- a/fs/ocfs2/dcache.h +++ b/fs/ocfs2/dcache.h | |||
| @@ -29,8 +29,13 @@ | |||
| 29 | extern struct dentry_operations ocfs2_dentry_ops; | 29 | extern struct dentry_operations ocfs2_dentry_ops; |
| 30 | 30 | ||
| 31 | struct ocfs2_dentry_lock { | 31 | struct ocfs2_dentry_lock { |
| 32 | /* Use count of dentry lock */ | ||
| 32 | unsigned int dl_count; | 33 | unsigned int dl_count; |
| 33 | u64 dl_parent_blkno; | 34 | union { |
| 35 | /* Linked list of dentry locks to release */ | ||
| 36 | struct ocfs2_dentry_lock *dl_next; | ||
| 37 | u64 dl_parent_blkno; | ||
| 38 | }; | ||
| 34 | 39 | ||
| 35 | /* | 40 | /* |
| 36 | * The ocfs2_dentry_lock keeps an inode reference until | 41 | * The ocfs2_dentry_lock keeps an inode reference until |
| @@ -47,6 +52,8 @@ int ocfs2_dentry_attach_lock(struct dentry *dentry, struct inode *inode, | |||
| 47 | void ocfs2_dentry_lock_put(struct ocfs2_super *osb, | 52 | void ocfs2_dentry_lock_put(struct ocfs2_super *osb, |
| 48 | struct ocfs2_dentry_lock *dl); | 53 | struct ocfs2_dentry_lock *dl); |
| 49 | 54 | ||
| 55 | void ocfs2_drop_dl_inodes(struct work_struct *work); | ||
| 56 | |||
| 50 | struct dentry *ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno, | 57 | struct dentry *ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno, |
| 51 | int skip_unhashed); | 58 | int skip_unhashed); |
| 52 | 59 | ||
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index b0c4cadd4c45..206a2370876a 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
| @@ -2860,6 +2860,10 @@ static void ocfs2_unlock_ast(void *opaque, int error) | |||
| 2860 | case OCFS2_UNLOCK_CANCEL_CONVERT: | 2860 | case OCFS2_UNLOCK_CANCEL_CONVERT: |
| 2861 | mlog(0, "Cancel convert success for %s\n", lockres->l_name); | 2861 | mlog(0, "Cancel convert success for %s\n", lockres->l_name); |
| 2862 | lockres->l_action = OCFS2_AST_INVALID; | 2862 | lockres->l_action = OCFS2_AST_INVALID; |
| 2863 | /* Downconvert thread may have requeued this lock, we | ||
| 2864 | * need to wake it. */ | ||
| 2865 | if (lockres->l_flags & OCFS2_LOCK_BLOCKED) | ||
| 2866 | ocfs2_wake_downconvert_thread(ocfs2_get_lockres_osb(lockres)); | ||
| 2863 | break; | 2867 | break; |
| 2864 | case OCFS2_UNLOCK_DROP_LOCK: | 2868 | case OCFS2_UNLOCK_DROP_LOCK: |
| 2865 | lockres->l_level = DLM_LOCK_IV; | 2869 | lockres->l_level = DLM_LOCK_IV; |
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index ad5c24a29edd..077384135f4e 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
| @@ -210,6 +210,7 @@ struct ocfs2_journal; | |||
| 210 | struct ocfs2_slot_info; | 210 | struct ocfs2_slot_info; |
| 211 | struct ocfs2_recovery_map; | 211 | struct ocfs2_recovery_map; |
| 212 | struct ocfs2_quota_recovery; | 212 | struct ocfs2_quota_recovery; |
| 213 | struct ocfs2_dentry_lock; | ||
| 213 | struct ocfs2_super | 214 | struct ocfs2_super |
| 214 | { | 215 | { |
| 215 | struct task_struct *commit_task; | 216 | struct task_struct *commit_task; |
| @@ -325,6 +326,11 @@ struct ocfs2_super | |||
| 325 | struct list_head blocked_lock_list; | 326 | struct list_head blocked_lock_list; |
| 326 | unsigned long blocked_lock_count; | 327 | unsigned long blocked_lock_count; |
| 327 | 328 | ||
| 329 | /* List of dentry locks to release. Anyone can add locks to | ||
| 330 | * the list, ocfs2_wq processes the list */ | ||
| 331 | struct ocfs2_dentry_lock *dentry_lock_list; | ||
| 332 | struct work_struct dentry_lock_work; | ||
| 333 | |||
| 328 | wait_queue_head_t osb_mount_event; | 334 | wait_queue_head_t osb_mount_event; |
| 329 | 335 | ||
| 330 | /* Truncate log info */ | 336 | /* Truncate log info */ |
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index f4efa89baee5..1ed0f7c86869 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c | |||
| @@ -754,7 +754,9 @@ static int ocfs2_mark_dquot_dirty(struct dquot *dquot) | |||
| 754 | if (dquot->dq_flags & mask) | 754 | if (dquot->dq_flags & mask) |
| 755 | sync = 1; | 755 | sync = 1; |
| 756 | spin_unlock(&dq_data_lock); | 756 | spin_unlock(&dq_data_lock); |
| 757 | if (!sync) { | 757 | /* This is a slight hack but we can't afford getting global quota |
| 758 | * lock if we already have a transaction started. */ | ||
| 759 | if (!sync || journal_current_handle()) { | ||
| 758 | status = ocfs2_write_dquot(dquot); | 760 | status = ocfs2_write_dquot(dquot); |
| 759 | goto out; | 761 | goto out; |
| 760 | } | 762 | } |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 43ed11345b59..b1cb38fbe807 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
| @@ -1887,6 +1887,9 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
| 1887 | INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery); | 1887 | INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery); |
| 1888 | journal->j_state = OCFS2_JOURNAL_FREE; | 1888 | journal->j_state = OCFS2_JOURNAL_FREE; |
| 1889 | 1889 | ||
| 1890 | INIT_WORK(&osb->dentry_lock_work, ocfs2_drop_dl_inodes); | ||
| 1891 | osb->dentry_lock_list = NULL; | ||
| 1892 | |||
| 1890 | /* get some pseudo constants for clustersize bits */ | 1893 | /* get some pseudo constants for clustersize bits */ |
| 1891 | osb->s_clustersize_bits = | 1894 | osb->s_clustersize_bits = |
| 1892 | le32_to_cpu(di->id2.i_super.s_clustersize_bits); | 1895 | le32_to_cpu(di->id2.i_super.s_clustersize_bits); |
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index e1d638af6ac3..915039fffe6e 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
| @@ -4729,13 +4729,6 @@ static int ocfs2_xattr_bucket_value_truncate(struct inode *inode, | |||
| 4729 | vb.vb_xv = (struct ocfs2_xattr_value_root *) | 4729 | vb.vb_xv = (struct ocfs2_xattr_value_root *) |
| 4730 | (vb.vb_bh->b_data + offset % blocksize); | 4730 | (vb.vb_bh->b_data + offset % blocksize); |
| 4731 | 4731 | ||
| 4732 | ret = ocfs2_xattr_bucket_journal_access(ctxt->handle, bucket, | ||
| 4733 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
| 4734 | if (ret) { | ||
| 4735 | mlog_errno(ret); | ||
| 4736 | goto out; | ||
| 4737 | } | ||
| 4738 | |||
| 4739 | /* | 4732 | /* |
| 4740 | * From here on out we have to dirty the bucket. The generic | 4733 | * From here on out we have to dirty the bucket. The generic |
| 4741 | * value calls only modify one of the bucket's bhs, but we need | 4734 | * value calls only modify one of the bucket's bhs, but we need |
| @@ -4748,12 +4741,18 @@ static int ocfs2_xattr_bucket_value_truncate(struct inode *inode, | |||
| 4748 | ret = ocfs2_xattr_value_truncate(inode, &vb, len, ctxt); | 4741 | ret = ocfs2_xattr_value_truncate(inode, &vb, len, ctxt); |
| 4749 | if (ret) { | 4742 | if (ret) { |
| 4750 | mlog_errno(ret); | 4743 | mlog_errno(ret); |
| 4751 | goto out_dirty; | 4744 | goto out; |
| 4745 | } | ||
| 4746 | |||
| 4747 | ret = ocfs2_xattr_bucket_journal_access(ctxt->handle, bucket, | ||
| 4748 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
| 4749 | if (ret) { | ||
| 4750 | mlog_errno(ret); | ||
| 4751 | goto out; | ||
| 4752 | } | 4752 | } |
| 4753 | 4753 | ||
| 4754 | xe->xe_value_size = cpu_to_le64(len); | 4754 | xe->xe_value_size = cpu_to_le64(len); |
| 4755 | 4755 | ||
| 4756 | out_dirty: | ||
| 4757 | ocfs2_xattr_bucket_journal_dirty(ctxt->handle, bucket); | 4756 | ocfs2_xattr_bucket_journal_dirty(ctxt->handle, bucket); |
| 4758 | 4757 | ||
| 4759 | out: | 4758 | out: |
diff --git a/fs/seq_file.c b/fs/seq_file.c index b569ff1c4dc8..5267098532bf 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
| @@ -54,6 +54,64 @@ int seq_open(struct file *file, const struct seq_operations *op) | |||
| 54 | } | 54 | } |
| 55 | EXPORT_SYMBOL(seq_open); | 55 | EXPORT_SYMBOL(seq_open); |
| 56 | 56 | ||
| 57 | static int traverse(struct seq_file *m, loff_t offset) | ||
| 58 | { | ||
| 59 | loff_t pos = 0, index; | ||
| 60 | int error = 0; | ||
| 61 | void *p; | ||
| 62 | |||
| 63 | m->version = 0; | ||
| 64 | index = 0; | ||
| 65 | m->count = m->from = 0; | ||
| 66 | if (!offset) { | ||
| 67 | m->index = index; | ||
| 68 | return 0; | ||
| 69 | } | ||
| 70 | if (!m->buf) { | ||
| 71 | m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL); | ||
| 72 | if (!m->buf) | ||
| 73 | return -ENOMEM; | ||
| 74 | } | ||
| 75 | p = m->op->start(m, &index); | ||
| 76 | while (p) { | ||
| 77 | error = PTR_ERR(p); | ||
| 78 | if (IS_ERR(p)) | ||
| 79 | break; | ||
| 80 | error = m->op->show(m, p); | ||
| 81 | if (error < 0) | ||
| 82 | break; | ||
| 83 | if (unlikely(error)) { | ||
| 84 | error = 0; | ||
| 85 | m->count = 0; | ||
| 86 | } | ||
| 87 | if (m->count == m->size) | ||
| 88 | goto Eoverflow; | ||
| 89 | if (pos + m->count > offset) { | ||
| 90 | m->from = offset - pos; | ||
| 91 | m->count -= m->from; | ||
| 92 | m->index = index; | ||
| 93 | break; | ||
| 94 | } | ||
| 95 | pos += m->count; | ||
| 96 | m->count = 0; | ||
| 97 | if (pos == offset) { | ||
| 98 | index++; | ||
| 99 | m->index = index; | ||
| 100 | break; | ||
| 101 | } | ||
| 102 | p = m->op->next(m, p, &index); | ||
| 103 | } | ||
| 104 | m->op->stop(m, p); | ||
| 105 | m->index = index; | ||
| 106 | return error; | ||
| 107 | |||
| 108 | Eoverflow: | ||
| 109 | m->op->stop(m, p); | ||
| 110 | kfree(m->buf); | ||
| 111 | m->buf = kmalloc(m->size <<= 1, GFP_KERNEL); | ||
| 112 | return !m->buf ? -ENOMEM : -EAGAIN; | ||
| 113 | } | ||
| 114 | |||
| 57 | /** | 115 | /** |
| 58 | * seq_read - ->read() method for sequential files. | 116 | * seq_read - ->read() method for sequential files. |
| 59 | * @file: the file to read from | 117 | * @file: the file to read from |
| @@ -186,63 +244,6 @@ Efault: | |||
| 186 | } | 244 | } |
| 187 | EXPORT_SYMBOL(seq_read); | 245 | EXPORT_SYMBOL(seq_read); |
| 188 | 246 | ||
| 189 | static int traverse(struct seq_file *m, loff_t offset) | ||
| 190 | { | ||
| 191 | loff_t pos = 0, index; | ||
| 192 | int error = 0; | ||
| 193 | void *p; | ||
| 194 | |||
| 195 | m->version = 0; | ||
| 196 | index = 0; | ||
| 197 | m->count = m->from = 0; | ||
| 198 | if (!offset) { | ||
| 199 | m->index = index; | ||
| 200 | return 0; | ||
| 201 | } | ||
| 202 | if (!m->buf) { | ||
| 203 | m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL); | ||
| 204 | if (!m->buf) | ||
| 205 | return -ENOMEM; | ||
| 206 | } | ||
| 207 | p = m->op->start(m, &index); | ||
| 208 | while (p) { | ||
| 209 | error = PTR_ERR(p); | ||
| 210 | if (IS_ERR(p)) | ||
| 211 | break; | ||
| 212 | error = m->op->show(m, p); | ||
| 213 | if (error < 0) | ||
| 214 | break; | ||
| 215 | if (unlikely(error)) { | ||
| 216 | error = 0; | ||
| 217 | m->count = 0; | ||
| 218 | } | ||
| 219 | if (m->count == m->size) | ||
| 220 | goto Eoverflow; | ||
| 221 | if (pos + m->count > offset) { | ||
| 222 | m->from = offset - pos; | ||
| 223 | m->count -= m->from; | ||
| 224 | m->index = index; | ||
| 225 | break; | ||
| 226 | } | ||
| 227 | pos += m->count; | ||
| 228 | m->count = 0; | ||
| 229 | if (pos == offset) { | ||
| 230 | index++; | ||
| 231 | m->index = index; | ||
| 232 | break; | ||
| 233 | } | ||
| 234 | p = m->op->next(m, p, &index); | ||
| 235 | } | ||
| 236 | m->op->stop(m, p); | ||
| 237 | return error; | ||
| 238 | |||
| 239 | Eoverflow: | ||
| 240 | m->op->stop(m, p); | ||
| 241 | kfree(m->buf); | ||
| 242 | m->buf = kmalloc(m->size <<= 1, GFP_KERNEL); | ||
| 243 | return !m->buf ? -ENOMEM : -EAGAIN; | ||
| 244 | } | ||
| 245 | |||
| 246 | /** | 247 | /** |
| 247 | * seq_lseek - ->llseek() method for sequential files. | 248 | * seq_lseek - ->llseek() method for sequential files. |
| 248 | * @file: the file in question | 249 | * @file: the file in question |
diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c index 175f9c590b77..f393620890ee 100644 --- a/fs/ubifs/budget.c +++ b/fs/ubifs/budget.c | |||
| @@ -689,7 +689,7 @@ long long ubifs_reported_space(const struct ubifs_info *c, long long free) | |||
| 689 | } | 689 | } |
| 690 | 690 | ||
| 691 | /** | 691 | /** |
| 692 | * ubifs_get_free_space - return amount of free space. | 692 | * ubifs_get_free_space_nolock - return amount of free space. |
| 693 | * @c: UBIFS file-system description object | 693 | * @c: UBIFS file-system description object |
| 694 | * | 694 | * |
| 695 | * This function calculates amount of free space to report to user-space. | 695 | * This function calculates amount of free space to report to user-space. |
| @@ -704,16 +704,14 @@ long long ubifs_reported_space(const struct ubifs_info *c, long long free) | |||
| 704 | * traditional file-systems, because they have way less overhead than UBIFS. | 704 | * traditional file-systems, because they have way less overhead than UBIFS. |
| 705 | * So, to keep users happy, UBIFS tries to take the overhead into account. | 705 | * So, to keep users happy, UBIFS tries to take the overhead into account. |
| 706 | */ | 706 | */ |
| 707 | long long ubifs_get_free_space(struct ubifs_info *c) | 707 | long long ubifs_get_free_space_nolock(struct ubifs_info *c) |
| 708 | { | 708 | { |
| 709 | int min_idx_lebs, rsvd_idx_lebs, lebs; | 709 | int rsvd_idx_lebs, lebs; |
| 710 | long long available, outstanding, free; | 710 | long long available, outstanding, free; |
| 711 | 711 | ||
| 712 | spin_lock(&c->space_lock); | 712 | ubifs_assert(c->min_idx_lebs == ubifs_calc_min_idx_lebs(c)); |
| 713 | min_idx_lebs = c->min_idx_lebs; | ||
| 714 | ubifs_assert(min_idx_lebs == ubifs_calc_min_idx_lebs(c)); | ||
| 715 | outstanding = c->budg_data_growth + c->budg_dd_growth; | 713 | outstanding = c->budg_data_growth + c->budg_dd_growth; |
| 716 | available = ubifs_calc_available(c, min_idx_lebs); | 714 | available = ubifs_calc_available(c, c->min_idx_lebs); |
| 717 | 715 | ||
| 718 | /* | 716 | /* |
| 719 | * When reporting free space to user-space, UBIFS guarantees that it is | 717 | * When reporting free space to user-space, UBIFS guarantees that it is |
| @@ -726,15 +724,14 @@ long long ubifs_get_free_space(struct ubifs_info *c) | |||
| 726 | * Note, the calculations below are similar to what we have in | 724 | * Note, the calculations below are similar to what we have in |
| 727 | * 'do_budget_space()', so refer there for comments. | 725 | * 'do_budget_space()', so refer there for comments. |
| 728 | */ | 726 | */ |
| 729 | if (min_idx_lebs > c->lst.idx_lebs) | 727 | if (c->min_idx_lebs > c->lst.idx_lebs) |
| 730 | rsvd_idx_lebs = min_idx_lebs - c->lst.idx_lebs; | 728 | rsvd_idx_lebs = c->min_idx_lebs - c->lst.idx_lebs; |
| 731 | else | 729 | else |
| 732 | rsvd_idx_lebs = 0; | 730 | rsvd_idx_lebs = 0; |
| 733 | lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt - | 731 | lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt - |
| 734 | c->lst.taken_empty_lebs; | 732 | c->lst.taken_empty_lebs; |
| 735 | lebs -= rsvd_idx_lebs; | 733 | lebs -= rsvd_idx_lebs; |
| 736 | available += lebs * (c->dark_wm - c->leb_overhead); | 734 | available += lebs * (c->dark_wm - c->leb_overhead); |
| 737 | spin_unlock(&c->space_lock); | ||
| 738 | 735 | ||
| 739 | if (available > outstanding) | 736 | if (available > outstanding) |
| 740 | free = ubifs_reported_space(c, available - outstanding); | 737 | free = ubifs_reported_space(c, available - outstanding); |
| @@ -742,3 +739,21 @@ long long ubifs_get_free_space(struct ubifs_info *c) | |||
| 742 | free = 0; | 739 | free = 0; |
| 743 | return free; | 740 | return free; |
| 744 | } | 741 | } |
| 742 | |||
| 743 | /** | ||
| 744 | * ubifs_get_free_space - return amount of free space. | ||
| 745 | * @c: UBIFS file-system description object | ||
| 746 | * | ||
| 747 | * This function calculates and retuns amount of free space to report to | ||
| 748 | * user-space. | ||
| 749 | */ | ||
| 750 | long long ubifs_get_free_space(struct ubifs_info *c) | ||
| 751 | { | ||
| 752 | long long free; | ||
| 753 | |||
| 754 | spin_lock(&c->space_lock); | ||
| 755 | free = ubifs_get_free_space_nolock(c); | ||
| 756 | spin_unlock(&c->space_lock); | ||
| 757 | |||
| 758 | return free; | ||
| 759 | } | ||
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 792c5a16c182..e975bd82f38b 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
| @@ -620,9 +620,11 @@ void dbg_dump_budg(struct ubifs_info *c) | |||
| 620 | c->dark_wm, c->dead_wm, c->max_idx_node_sz); | 620 | c->dark_wm, c->dead_wm, c->max_idx_node_sz); |
| 621 | printk(KERN_DEBUG "\tgc_lnum %d, ihead_lnum %d\n", | 621 | printk(KERN_DEBUG "\tgc_lnum %d, ihead_lnum %d\n", |
| 622 | c->gc_lnum, c->ihead_lnum); | 622 | c->gc_lnum, c->ihead_lnum); |
| 623 | for (i = 0; i < c->jhead_cnt; i++) | 623 | /* If we are in R/O mode, journal heads do not exist */ |
| 624 | printk(KERN_DEBUG "\tjhead %d\t LEB %d\n", | 624 | if (c->jheads) |
| 625 | c->jheads[i].wbuf.jhead, c->jheads[i].wbuf.lnum); | 625 | for (i = 0; i < c->jhead_cnt; i++) |
| 626 | printk(KERN_DEBUG "\tjhead %d\t LEB %d\n", | ||
| 627 | c->jheads[i].wbuf.jhead, c->jheads[i].wbuf.lnum); | ||
| 626 | for (rb = rb_first(&c->buds); rb; rb = rb_next(rb)) { | 628 | for (rb = rb_first(&c->buds); rb; rb = rb_next(rb)) { |
| 627 | bud = rb_entry(rb, struct ubifs_bud, rb); | 629 | bud = rb_entry(rb, struct ubifs_bud, rb); |
| 628 | printk(KERN_DEBUG "\tbud LEB %d\n", bud->lnum); | 630 | printk(KERN_DEBUG "\tbud LEB %d\n", bud->lnum); |
| @@ -637,10 +639,7 @@ void dbg_dump_budg(struct ubifs_info *c) | |||
| 637 | /* Print budgeting predictions */ | 639 | /* Print budgeting predictions */ |
| 638 | available = ubifs_calc_available(c, c->min_idx_lebs); | 640 | available = ubifs_calc_available(c, c->min_idx_lebs); |
| 639 | outstanding = c->budg_data_growth + c->budg_dd_growth; | 641 | outstanding = c->budg_data_growth + c->budg_dd_growth; |
| 640 | if (available > outstanding) | 642 | free = ubifs_get_free_space_nolock(c); |
| 641 | free = ubifs_reported_space(c, available - outstanding); | ||
| 642 | else | ||
| 643 | free = 0; | ||
| 644 | printk(KERN_DEBUG "Budgeting predictions:\n"); | 643 | printk(KERN_DEBUG "Budgeting predictions:\n"); |
| 645 | printk(KERN_DEBUG "\tavailable: %lld, outstanding %lld, free %lld\n", | 644 | printk(KERN_DEBUG "\tavailable: %lld, outstanding %lld, free %lld\n", |
| 646 | available, outstanding, free); | 645 | available, outstanding, free); |
| @@ -861,6 +860,65 @@ void dbg_dump_index(struct ubifs_info *c) | |||
| 861 | } | 860 | } |
| 862 | 861 | ||
| 863 | /** | 862 | /** |
| 863 | * dbg_save_space_info - save information about flash space. | ||
| 864 | * @c: UBIFS file-system description object | ||
| 865 | * | ||
| 866 | * This function saves information about UBIFS free space, dirty space, etc, in | ||
| 867 | * order to check it later. | ||
| 868 | */ | ||
| 869 | void dbg_save_space_info(struct ubifs_info *c) | ||
| 870 | { | ||
| 871 | struct ubifs_debug_info *d = c->dbg; | ||
| 872 | |||
| 873 | ubifs_get_lp_stats(c, &d->saved_lst); | ||
| 874 | |||
| 875 | spin_lock(&c->space_lock); | ||
| 876 | d->saved_free = ubifs_get_free_space_nolock(c); | ||
| 877 | spin_unlock(&c->space_lock); | ||
| 878 | } | ||
| 879 | |||
| 880 | /** | ||
| 881 | * dbg_check_space_info - check flash space information. | ||
| 882 | * @c: UBIFS file-system description object | ||
| 883 | * | ||
| 884 | * This function compares current flash space information with the information | ||
| 885 | * which was saved when the 'dbg_save_space_info()' function was called. | ||
| 886 | * Returns zero if the information has not changed, and %-EINVAL it it has | ||
| 887 | * changed. | ||
| 888 | */ | ||
| 889 | int dbg_check_space_info(struct ubifs_info *c) | ||
| 890 | { | ||
| 891 | struct ubifs_debug_info *d = c->dbg; | ||
| 892 | struct ubifs_lp_stats lst; | ||
| 893 | long long avail, free; | ||
| 894 | |||
| 895 | spin_lock(&c->space_lock); | ||
| 896 | avail = ubifs_calc_available(c, c->min_idx_lebs); | ||
| 897 | spin_unlock(&c->space_lock); | ||
| 898 | free = ubifs_get_free_space(c); | ||
| 899 | |||
| 900 | if (free != d->saved_free) { | ||
| 901 | ubifs_err("free space changed from %lld to %lld", | ||
| 902 | d->saved_free, free); | ||
| 903 | goto out; | ||
| 904 | } | ||
| 905 | |||
| 906 | return 0; | ||
| 907 | |||
| 908 | out: | ||
| 909 | ubifs_msg("saved lprops statistics dump"); | ||
| 910 | dbg_dump_lstats(&d->saved_lst); | ||
| 911 | ubifs_get_lp_stats(c, &lst); | ||
| 912 | ubifs_msg("current lprops statistics dump"); | ||
| 913 | dbg_dump_lstats(&d->saved_lst); | ||
| 914 | spin_lock(&c->space_lock); | ||
| 915 | dbg_dump_budg(c); | ||
| 916 | spin_unlock(&c->space_lock); | ||
| 917 | dump_stack(); | ||
| 918 | return -EINVAL; | ||
| 919 | } | ||
| 920 | |||
| 921 | /** | ||
| 864 | * dbg_check_synced_i_size - check synchronized inode size. | 922 | * dbg_check_synced_i_size - check synchronized inode size. |
| 865 | * @inode: inode to check | 923 | * @inode: inode to check |
| 866 | * | 924 | * |
| @@ -1349,7 +1407,7 @@ int dbg_check_tnc(struct ubifs_info *c, int extra) | |||
| 1349 | * @c: UBIFS file-system description object | 1407 | * @c: UBIFS file-system description object |
| 1350 | * @leaf_cb: called for each leaf node | 1408 | * @leaf_cb: called for each leaf node |
| 1351 | * @znode_cb: called for each indexing node | 1409 | * @znode_cb: called for each indexing node |
| 1352 | * @priv: private date which is passed to callbacks | 1410 | * @priv: private data which is passed to callbacks |
| 1353 | * | 1411 | * |
| 1354 | * This function walks the UBIFS index and calls the @leaf_cb for each leaf | 1412 | * This function walks the UBIFS index and calls the @leaf_cb for each leaf |
| 1355 | * node and @znode_cb for each indexing node. Returns zero in case of success | 1413 | * node and @znode_cb for each indexing node. Returns zero in case of success |
| @@ -2409,7 +2467,7 @@ void ubifs_debugging_exit(struct ubifs_info *c) | |||
| 2409 | * Root directory for UBIFS stuff in debugfs. Contains sub-directories which | 2467 | * Root directory for UBIFS stuff in debugfs. Contains sub-directories which |
| 2410 | * contain the stuff specific to particular file-system mounts. | 2468 | * contain the stuff specific to particular file-system mounts. |
| 2411 | */ | 2469 | */ |
| 2412 | static struct dentry *debugfs_rootdir; | 2470 | static struct dentry *dfs_rootdir; |
| 2413 | 2471 | ||
| 2414 | /** | 2472 | /** |
| 2415 | * dbg_debugfs_init - initialize debugfs file-system. | 2473 | * dbg_debugfs_init - initialize debugfs file-system. |
| @@ -2421,9 +2479,9 @@ static struct dentry *debugfs_rootdir; | |||
| 2421 | */ | 2479 | */ |
| 2422 | int dbg_debugfs_init(void) | 2480 | int dbg_debugfs_init(void) |
| 2423 | { | 2481 | { |
| 2424 | debugfs_rootdir = debugfs_create_dir("ubifs", NULL); | 2482 | dfs_rootdir = debugfs_create_dir("ubifs", NULL); |
| 2425 | if (IS_ERR(debugfs_rootdir)) { | 2483 | if (IS_ERR(dfs_rootdir)) { |
| 2426 | int err = PTR_ERR(debugfs_rootdir); | 2484 | int err = PTR_ERR(dfs_rootdir); |
| 2427 | ubifs_err("cannot create \"ubifs\" debugfs directory, " | 2485 | ubifs_err("cannot create \"ubifs\" debugfs directory, " |
| 2428 | "error %d\n", err); | 2486 | "error %d\n", err); |
| 2429 | return err; | 2487 | return err; |
| @@ -2437,7 +2495,7 @@ int dbg_debugfs_init(void) | |||
| 2437 | */ | 2495 | */ |
| 2438 | void dbg_debugfs_exit(void) | 2496 | void dbg_debugfs_exit(void) |
| 2439 | { | 2497 | { |
| 2440 | debugfs_remove(debugfs_rootdir); | 2498 | debugfs_remove(dfs_rootdir); |
| 2441 | } | 2499 | } |
| 2442 | 2500 | ||
| 2443 | static int open_debugfs_file(struct inode *inode, struct file *file) | 2501 | static int open_debugfs_file(struct inode *inode, struct file *file) |
| @@ -2452,13 +2510,13 @@ static ssize_t write_debugfs_file(struct file *file, const char __user *buf, | |||
| 2452 | struct ubifs_info *c = file->private_data; | 2510 | struct ubifs_info *c = file->private_data; |
| 2453 | struct ubifs_debug_info *d = c->dbg; | 2511 | struct ubifs_debug_info *d = c->dbg; |
| 2454 | 2512 | ||
| 2455 | if (file->f_path.dentry == d->dump_lprops) | 2513 | if (file->f_path.dentry == d->dfs_dump_lprops) |
| 2456 | dbg_dump_lprops(c); | 2514 | dbg_dump_lprops(c); |
| 2457 | else if (file->f_path.dentry == d->dump_budg) { | 2515 | else if (file->f_path.dentry == d->dfs_dump_budg) { |
| 2458 | spin_lock(&c->space_lock); | 2516 | spin_lock(&c->space_lock); |
| 2459 | dbg_dump_budg(c); | 2517 | dbg_dump_budg(c); |
| 2460 | spin_unlock(&c->space_lock); | 2518 | spin_unlock(&c->space_lock); |
| 2461 | } else if (file->f_path.dentry == d->dump_tnc) { | 2519 | } else if (file->f_path.dentry == d->dfs_dump_tnc) { |
| 2462 | mutex_lock(&c->tnc_mutex); | 2520 | mutex_lock(&c->tnc_mutex); |
| 2463 | dbg_dump_tnc(c); | 2521 | dbg_dump_tnc(c); |
| 2464 | mutex_unlock(&c->tnc_mutex); | 2522 | mutex_unlock(&c->tnc_mutex); |
| @@ -2469,7 +2527,7 @@ static ssize_t write_debugfs_file(struct file *file, const char __user *buf, | |||
| 2469 | return count; | 2527 | return count; |
| 2470 | } | 2528 | } |
| 2471 | 2529 | ||
| 2472 | static const struct file_operations debugfs_fops = { | 2530 | static const struct file_operations dfs_fops = { |
| 2473 | .open = open_debugfs_file, | 2531 | .open = open_debugfs_file, |
| 2474 | .write = write_debugfs_file, | 2532 | .write = write_debugfs_file, |
| 2475 | .owner = THIS_MODULE, | 2533 | .owner = THIS_MODULE, |
| @@ -2494,36 +2552,32 @@ int dbg_debugfs_init_fs(struct ubifs_info *c) | |||
| 2494 | struct dentry *dent; | 2552 | struct dentry *dent; |
| 2495 | struct ubifs_debug_info *d = c->dbg; | 2553 | struct ubifs_debug_info *d = c->dbg; |
| 2496 | 2554 | ||
| 2497 | sprintf(d->debugfs_dir_name, "ubi%d_%d", c->vi.ubi_num, c->vi.vol_id); | 2555 | sprintf(d->dfs_dir_name, "ubi%d_%d", c->vi.ubi_num, c->vi.vol_id); |
| 2498 | d->debugfs_dir = debugfs_create_dir(d->debugfs_dir_name, | 2556 | d->dfs_dir = debugfs_create_dir(d->dfs_dir_name, dfs_rootdir); |
| 2499 | debugfs_rootdir); | 2557 | if (IS_ERR(d->dfs_dir)) { |
| 2500 | if (IS_ERR(d->debugfs_dir)) { | 2558 | err = PTR_ERR(d->dfs_dir); |
| 2501 | err = PTR_ERR(d->debugfs_dir); | ||
| 2502 | ubifs_err("cannot create \"%s\" debugfs directory, error %d\n", | 2559 | ubifs_err("cannot create \"%s\" debugfs directory, error %d\n", |
| 2503 | d->debugfs_dir_name, err); | 2560 | d->dfs_dir_name, err); |
| 2504 | goto out; | 2561 | goto out; |
| 2505 | } | 2562 | } |
| 2506 | 2563 | ||
| 2507 | fname = "dump_lprops"; | 2564 | fname = "dump_lprops"; |
| 2508 | dent = debugfs_create_file(fname, S_IWUGO, d->debugfs_dir, c, | 2565 | dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops); |
| 2509 | &debugfs_fops); | ||
| 2510 | if (IS_ERR(dent)) | 2566 | if (IS_ERR(dent)) |
| 2511 | goto out_remove; | 2567 | goto out_remove; |
| 2512 | d->dump_lprops = dent; | 2568 | d->dfs_dump_lprops = dent; |
| 2513 | 2569 | ||
| 2514 | fname = "dump_budg"; | 2570 | fname = "dump_budg"; |
| 2515 | dent = debugfs_create_file(fname, S_IWUGO, d->debugfs_dir, c, | 2571 | dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops); |
| 2516 | &debugfs_fops); | ||
| 2517 | if (IS_ERR(dent)) | 2572 | if (IS_ERR(dent)) |
| 2518 | goto out_remove; | 2573 | goto out_remove; |
| 2519 | d->dump_budg = dent; | 2574 | d->dfs_dump_budg = dent; |
| 2520 | 2575 | ||
| 2521 | fname = "dump_tnc"; | 2576 | fname = "dump_tnc"; |
| 2522 | dent = debugfs_create_file(fname, S_IWUGO, d->debugfs_dir, c, | 2577 | dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops); |
| 2523 | &debugfs_fops); | ||
| 2524 | if (IS_ERR(dent)) | 2578 | if (IS_ERR(dent)) |
| 2525 | goto out_remove; | 2579 | goto out_remove; |
| 2526 | d->dump_tnc = dent; | 2580 | d->dfs_dump_tnc = dent; |
| 2527 | 2581 | ||
| 2528 | return 0; | 2582 | return 0; |
| 2529 | 2583 | ||
| @@ -2531,7 +2585,7 @@ out_remove: | |||
| 2531 | err = PTR_ERR(dent); | 2585 | err = PTR_ERR(dent); |
| 2532 | ubifs_err("cannot create \"%s\" debugfs directory, error %d\n", | 2586 | ubifs_err("cannot create \"%s\" debugfs directory, error %d\n", |
| 2533 | fname, err); | 2587 | fname, err); |
| 2534 | debugfs_remove_recursive(d->debugfs_dir); | 2588 | debugfs_remove_recursive(d->dfs_dir); |
| 2535 | out: | 2589 | out: |
| 2536 | return err; | 2590 | return err; |
| 2537 | } | 2591 | } |
| @@ -2542,7 +2596,7 @@ out: | |||
| 2542 | */ | 2596 | */ |
| 2543 | void dbg_debugfs_exit_fs(struct ubifs_info *c) | 2597 | void dbg_debugfs_exit_fs(struct ubifs_info *c) |
| 2544 | { | 2598 | { |
| 2545 | debugfs_remove_recursive(c->dbg->debugfs_dir); | 2599 | debugfs_remove_recursive(c->dbg->dfs_dir); |
| 2546 | } | 2600 | } |
| 2547 | 2601 | ||
| 2548 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | 2602 | #endif /* CONFIG_UBIFS_FS_DEBUG */ |
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index 9820d6999f7e..c1cd73b2e06e 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h | |||
| @@ -41,15 +41,17 @@ | |||
| 41 | * @chk_lpt_wastage: used by LPT tree size checker | 41 | * @chk_lpt_wastage: used by LPT tree size checker |
| 42 | * @chk_lpt_lebs: used by LPT tree size checker | 42 | * @chk_lpt_lebs: used by LPT tree size checker |
| 43 | * @new_nhead_offs: used by LPT tree size checker | 43 | * @new_nhead_offs: used by LPT tree size checker |
| 44 | * @new_ihead_lnum: used by debugging to check ihead_lnum | 44 | * @new_ihead_lnum: used by debugging to check @c->ihead_lnum |
| 45 | * @new_ihead_offs: used by debugging to check ihead_offs | 45 | * @new_ihead_offs: used by debugging to check @c->ihead_offs |
| 46 | * | 46 | * |
| 47 | * debugfs_dir_name: name of debugfs directory containing this file-system's | 47 | * @saved_lst: saved lprops statistics (used by 'dbg_save_space_info()') |
| 48 | * files | 48 | * @saved_free: saved free space (used by 'dbg_save_space_info()') |
| 49 | * debugfs_dir: direntry object of the file-system debugfs directory | 49 | * |
| 50 | * dump_lprops: "dump lprops" debugfs knob | 50 | * dfs_dir_name: name of debugfs directory containing this file-system's files |
| 51 | * dump_budg: "dump budgeting information" debugfs knob | 51 | * dfs_dir: direntry object of the file-system debugfs directory |
| 52 | * dump_tnc: "dump TNC" debugfs knob | 52 | * dfs_dump_lprops: "dump lprops" debugfs knob |
| 53 | * dfs_dump_budg: "dump budgeting information" debugfs knob | ||
| 54 | * dfs_dump_tnc: "dump TNC" debugfs knob | ||
| 53 | */ | 55 | */ |
| 54 | struct ubifs_debug_info { | 56 | struct ubifs_debug_info { |
| 55 | void *buf; | 57 | void *buf; |
| @@ -69,11 +71,14 @@ struct ubifs_debug_info { | |||
| 69 | int new_ihead_lnum; | 71 | int new_ihead_lnum; |
| 70 | int new_ihead_offs; | 72 | int new_ihead_offs; |
| 71 | 73 | ||
| 72 | char debugfs_dir_name[100]; | 74 | struct ubifs_lp_stats saved_lst; |
| 73 | struct dentry *debugfs_dir; | 75 | long long saved_free; |
| 74 | struct dentry *dump_lprops; | 76 | |
| 75 | struct dentry *dump_budg; | 77 | char dfs_dir_name[100]; |
| 76 | struct dentry *dump_tnc; | 78 | struct dentry *dfs_dir; |
| 79 | struct dentry *dfs_dump_lprops; | ||
| 80 | struct dentry *dfs_dump_budg; | ||
| 81 | struct dentry *dfs_dump_tnc; | ||
| 77 | }; | 82 | }; |
| 78 | 83 | ||
| 79 | #define ubifs_assert(expr) do { \ | 84 | #define ubifs_assert(expr) do { \ |
| @@ -297,7 +302,8 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, | |||
| 297 | dbg_znode_callback znode_cb, void *priv); | 302 | dbg_znode_callback znode_cb, void *priv); |
| 298 | 303 | ||
| 299 | /* Checking functions */ | 304 | /* Checking functions */ |
| 300 | 305 | void dbg_save_space_info(struct ubifs_info *c); | |
| 306 | int dbg_check_space_info(struct ubifs_info *c); | ||
| 301 | int dbg_check_lprops(struct ubifs_info *c); | 307 | int dbg_check_lprops(struct ubifs_info *c); |
| 302 | int dbg_old_index_check_init(struct ubifs_info *c, struct ubifs_zbranch *zroot); | 308 | int dbg_old_index_check_init(struct ubifs_info *c, struct ubifs_zbranch *zroot); |
| 303 | int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot); | 309 | int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot); |
| @@ -439,6 +445,8 @@ void dbg_debugfs_exit_fs(struct ubifs_info *c); | |||
| 439 | 445 | ||
| 440 | #define dbg_walk_index(c, leaf_cb, znode_cb, priv) 0 | 446 | #define dbg_walk_index(c, leaf_cb, znode_cb, priv) 0 |
| 441 | #define dbg_old_index_check_init(c, zroot) 0 | 447 | #define dbg_old_index_check_init(c, zroot) 0 |
| 448 | #define dbg_save_space_info(c) ({}) | ||
| 449 | #define dbg_check_space_info(c) 0 | ||
| 442 | #define dbg_check_old_index(c, zroot) 0 | 450 | #define dbg_check_old_index(c, zroot) 0 |
| 443 | #define dbg_check_cats(c) 0 | 451 | #define dbg_check_cats(c) 0 |
| 444 | #define dbg_check_ltab(c) 0 | 452 | #define dbg_check_ltab(c) 0 |
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index f448ab1f9c38..f55d523c52bb 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
| @@ -482,30 +482,29 @@ static int ubifs_dir_release(struct inode *dir, struct file *file) | |||
| 482 | } | 482 | } |
| 483 | 483 | ||
| 484 | /** | 484 | /** |
| 485 | * lock_2_inodes - lock two UBIFS inodes. | 485 | * lock_2_inodes - a wrapper for locking two UBIFS inodes. |
| 486 | * @inode1: first inode | 486 | * @inode1: first inode |
| 487 | * @inode2: second inode | 487 | * @inode2: second inode |
| 488 | * | ||
| 489 | * We do not implement any tricks to guarantee strict lock ordering, because | ||
| 490 | * VFS has already done it for us on the @i_mutex. So this is just a simple | ||
| 491 | * wrapper function. | ||
| 488 | */ | 492 | */ |
| 489 | static void lock_2_inodes(struct inode *inode1, struct inode *inode2) | 493 | static void lock_2_inodes(struct inode *inode1, struct inode *inode2) |
| 490 | { | 494 | { |
| 491 | if (inode1->i_ino < inode2->i_ino) { | 495 | mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_1); |
| 492 | mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_2); | 496 | mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_2); |
| 493 | mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_3); | ||
| 494 | } else { | ||
| 495 | mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_2); | ||
| 496 | mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_3); | ||
| 497 | } | ||
| 498 | } | 497 | } |
| 499 | 498 | ||
| 500 | /** | 499 | /** |
| 501 | * unlock_2_inodes - unlock two UBIFS inodes inodes. | 500 | * unlock_2_inodes - a wrapper for unlocking two UBIFS inodes. |
| 502 | * @inode1: first inode | 501 | * @inode1: first inode |
| 503 | * @inode2: second inode | 502 | * @inode2: second inode |
| 504 | */ | 503 | */ |
| 505 | static void unlock_2_inodes(struct inode *inode1, struct inode *inode2) | 504 | static void unlock_2_inodes(struct inode *inode1, struct inode *inode2) |
| 506 | { | 505 | { |
| 507 | mutex_unlock(&ubifs_inode(inode1)->ui_mutex); | ||
| 508 | mutex_unlock(&ubifs_inode(inode2)->ui_mutex); | 506 | mutex_unlock(&ubifs_inode(inode2)->ui_mutex); |
| 507 | mutex_unlock(&ubifs_inode(inode1)->ui_mutex); | ||
| 509 | } | 508 | } |
| 510 | 509 | ||
| 511 | static int ubifs_link(struct dentry *old_dentry, struct inode *dir, | 510 | static int ubifs_link(struct dentry *old_dentry, struct inode *dir, |
| @@ -527,6 +526,8 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir, | |||
| 527 | dbg_gen("dent '%.*s' to ino %lu (nlink %d) in dir ino %lu", | 526 | dbg_gen("dent '%.*s' to ino %lu (nlink %d) in dir ino %lu", |
| 528 | dentry->d_name.len, dentry->d_name.name, inode->i_ino, | 527 | dentry->d_name.len, dentry->d_name.name, inode->i_ino, |
| 529 | inode->i_nlink, dir->i_ino); | 528 | inode->i_nlink, dir->i_ino); |
| 529 | ubifs_assert(mutex_is_locked(&dir->i_mutex)); | ||
| 530 | ubifs_assert(mutex_is_locked(&inode->i_mutex)); | ||
| 530 | err = dbg_check_synced_i_size(inode); | 531 | err = dbg_check_synced_i_size(inode); |
| 531 | if (err) | 532 | if (err) |
| 532 | return err; | 533 | return err; |
| @@ -580,6 +581,8 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry) | |||
| 580 | dbg_gen("dent '%.*s' from ino %lu (nlink %d) in dir ino %lu", | 581 | dbg_gen("dent '%.*s' from ino %lu (nlink %d) in dir ino %lu", |
| 581 | dentry->d_name.len, dentry->d_name.name, inode->i_ino, | 582 | dentry->d_name.len, dentry->d_name.name, inode->i_ino, |
| 582 | inode->i_nlink, dir->i_ino); | 583 | inode->i_nlink, dir->i_ino); |
| 584 | ubifs_assert(mutex_is_locked(&dir->i_mutex)); | ||
| 585 | ubifs_assert(mutex_is_locked(&inode->i_mutex)); | ||
| 583 | err = dbg_check_synced_i_size(inode); | 586 | err = dbg_check_synced_i_size(inode); |
| 584 | if (err) | 587 | if (err) |
| 585 | return err; | 588 | return err; |
| @@ -667,7 +670,8 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 667 | 670 | ||
| 668 | dbg_gen("directory '%.*s', ino %lu in dir ino %lu", dentry->d_name.len, | 671 | dbg_gen("directory '%.*s', ino %lu in dir ino %lu", dentry->d_name.len, |
| 669 | dentry->d_name.name, inode->i_ino, dir->i_ino); | 672 | dentry->d_name.name, inode->i_ino, dir->i_ino); |
| 670 | 673 | ubifs_assert(mutex_is_locked(&dir->i_mutex)); | |
| 674 | ubifs_assert(mutex_is_locked(&inode->i_mutex)); | ||
| 671 | err = check_dir_empty(c, dentry->d_inode); | 675 | err = check_dir_empty(c, dentry->d_inode); |
| 672 | if (err) | 676 | if (err) |
| 673 | return err; | 677 | return err; |
| @@ -922,59 +926,30 @@ out_budg: | |||
| 922 | } | 926 | } |
| 923 | 927 | ||
| 924 | /** | 928 | /** |
| 925 | * lock_3_inodes - lock three UBIFS inodes for rename. | 929 | * lock_3_inodes - a wrapper for locking three UBIFS inodes. |
| 926 | * @inode1: first inode | 930 | * @inode1: first inode |
| 927 | * @inode2: second inode | 931 | * @inode2: second inode |
| 928 | * @inode3: third inode | 932 | * @inode3: third inode |
| 929 | * | 933 | * |
| 930 | * For 'ubifs_rename()', @inode1 may be the same as @inode2 whereas @inode3 may | 934 | * This function is used for 'ubifs_rename()' and @inode1 may be the same as |
| 931 | * be null. | 935 | * @inode2 whereas @inode3 may be %NULL. |
| 936 | * | ||
| 937 | * We do not implement any tricks to guarantee strict lock ordering, because | ||
| 938 | * VFS has already done it for us on the @i_mutex. So this is just a simple | ||
| 939 | * wrapper function. | ||
| 932 | */ | 940 | */ |
| 933 | static void lock_3_inodes(struct inode *inode1, struct inode *inode2, | 941 | static void lock_3_inodes(struct inode *inode1, struct inode *inode2, |
| 934 | struct inode *inode3) | 942 | struct inode *inode3) |
| 935 | { | 943 | { |
| 936 | struct inode *i1, *i2, *i3; | 944 | mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_1); |
| 937 | 945 | if (inode2 != inode1) | |
| 938 | if (!inode3) { | 946 | mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_2); |
| 939 | if (inode1 != inode2) { | 947 | if (inode3) |
| 940 | lock_2_inodes(inode1, inode2); | 948 | mutex_lock_nested(&ubifs_inode(inode3)->ui_mutex, WB_MUTEX_3); |
| 941 | return; | ||
| 942 | } | ||
| 943 | mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_1); | ||
| 944 | return; | ||
| 945 | } | ||
| 946 | |||
| 947 | if (inode1 == inode2) { | ||
| 948 | lock_2_inodes(inode1, inode3); | ||
| 949 | return; | ||
| 950 | } | ||
| 951 | |||
| 952 | /* 3 different inodes */ | ||
| 953 | if (inode1 < inode2) { | ||
| 954 | i3 = inode2; | ||
| 955 | if (inode1 < inode3) { | ||
| 956 | i1 = inode1; | ||
| 957 | i2 = inode3; | ||
| 958 | } else { | ||
| 959 | i1 = inode3; | ||
| 960 | i2 = inode1; | ||
| 961 | } | ||
| 962 | } else { | ||
| 963 | i3 = inode1; | ||
| 964 | if (inode2 < inode3) { | ||
| 965 | i1 = inode2; | ||
| 966 | i2 = inode3; | ||
| 967 | } else { | ||
| 968 | i1 = inode3; | ||
| 969 | i2 = inode2; | ||
| 970 | } | ||
| 971 | } | ||
| 972 | mutex_lock_nested(&ubifs_inode(i1)->ui_mutex, WB_MUTEX_1); | ||
| 973 | lock_2_inodes(i2, i3); | ||
| 974 | } | 949 | } |
| 975 | 950 | ||
| 976 | /** | 951 | /** |
| 977 | * unlock_3_inodes - unlock three UBIFS inodes for rename. | 952 | * unlock_3_inodes - a wrapper for unlocking three UBIFS inodes for rename. |
| 978 | * @inode1: first inode | 953 | * @inode1: first inode |
| 979 | * @inode2: second inode | 954 | * @inode2: second inode |
| 980 | * @inode3: third inode | 955 | * @inode3: third inode |
| @@ -982,11 +957,11 @@ static void lock_3_inodes(struct inode *inode1, struct inode *inode2, | |||
| 982 | static void unlock_3_inodes(struct inode *inode1, struct inode *inode2, | 957 | static void unlock_3_inodes(struct inode *inode1, struct inode *inode2, |
| 983 | struct inode *inode3) | 958 | struct inode *inode3) |
| 984 | { | 959 | { |
| 985 | mutex_unlock(&ubifs_inode(inode1)->ui_mutex); | ||
| 986 | if (inode1 != inode2) | ||
| 987 | mutex_unlock(&ubifs_inode(inode2)->ui_mutex); | ||
| 988 | if (inode3) | 960 | if (inode3) |
| 989 | mutex_unlock(&ubifs_inode(inode3)->ui_mutex); | 961 | mutex_unlock(&ubifs_inode(inode3)->ui_mutex); |
| 962 | if (inode1 != inode2) | ||
| 963 | mutex_unlock(&ubifs_inode(inode2)->ui_mutex); | ||
| 964 | mutex_unlock(&ubifs_inode(inode1)->ui_mutex); | ||
| 990 | } | 965 | } |
| 991 | 966 | ||
| 992 | static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, | 967 | static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, |
| @@ -1020,6 +995,11 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 1020 | "dir ino %lu", old_dentry->d_name.len, old_dentry->d_name.name, | 995 | "dir ino %lu", old_dentry->d_name.len, old_dentry->d_name.name, |
| 1021 | old_inode->i_ino, old_dir->i_ino, new_dentry->d_name.len, | 996 | old_inode->i_ino, old_dir->i_ino, new_dentry->d_name.len, |
| 1022 | new_dentry->d_name.name, new_dir->i_ino); | 997 | new_dentry->d_name.name, new_dir->i_ino); |
| 998 | ubifs_assert(mutex_is_locked(&old_dir->i_mutex)); | ||
| 999 | ubifs_assert(mutex_is_locked(&new_dir->i_mutex)); | ||
| 1000 | if (unlink) | ||
| 1001 | ubifs_assert(mutex_is_locked(&new_inode->i_mutex)); | ||
| 1002 | |||
| 1023 | 1003 | ||
| 1024 | if (unlink && is_dir) { | 1004 | if (unlink && is_dir) { |
| 1025 | err = check_dir_empty(c, new_inode); | 1005 | err = check_dir_empty(c, new_inode); |
| @@ -1199,7 +1179,7 @@ int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
| 1199 | return 0; | 1179 | return 0; |
| 1200 | } | 1180 | } |
| 1201 | 1181 | ||
| 1202 | struct inode_operations ubifs_dir_inode_operations = { | 1182 | const struct inode_operations ubifs_dir_inode_operations = { |
| 1203 | .lookup = ubifs_lookup, | 1183 | .lookup = ubifs_lookup, |
| 1204 | .create = ubifs_create, | 1184 | .create = ubifs_create, |
| 1205 | .link = ubifs_link, | 1185 | .link = ubifs_link, |
| @@ -1219,7 +1199,7 @@ struct inode_operations ubifs_dir_inode_operations = { | |||
| 1219 | #endif | 1199 | #endif |
| 1220 | }; | 1200 | }; |
| 1221 | 1201 | ||
| 1222 | struct file_operations ubifs_dir_operations = { | 1202 | const struct file_operations ubifs_dir_operations = { |
| 1223 | .llseek = ubifs_dir_llseek, | 1203 | .llseek = ubifs_dir_llseek, |
| 1224 | .release = ubifs_dir_release, | 1204 | .release = ubifs_dir_release, |
| 1225 | .read = generic_read_dir, | 1205 | .read = generic_read_dir, |
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index bf37374567fa..93b6de51f261 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c | |||
| @@ -432,7 +432,6 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping, | |||
| 432 | int uninitialized_var(err), appending = !!(pos + len > inode->i_size); | 432 | int uninitialized_var(err), appending = !!(pos + len > inode->i_size); |
| 433 | struct page *page; | 433 | struct page *page; |
| 434 | 434 | ||
| 435 | |||
| 436 | ubifs_assert(ubifs_inode(inode)->ui_size == inode->i_size); | 435 | ubifs_assert(ubifs_inode(inode)->ui_size == inode->i_size); |
| 437 | 436 | ||
| 438 | if (unlikely(c->ro_media)) | 437 | if (unlikely(c->ro_media)) |
| @@ -1541,7 +1540,7 @@ static int ubifs_file_mmap(struct file *file, struct vm_area_struct *vma) | |||
| 1541 | return 0; | 1540 | return 0; |
| 1542 | } | 1541 | } |
| 1543 | 1542 | ||
| 1544 | struct address_space_operations ubifs_file_address_operations = { | 1543 | const struct address_space_operations ubifs_file_address_operations = { |
| 1545 | .readpage = ubifs_readpage, | 1544 | .readpage = ubifs_readpage, |
| 1546 | .writepage = ubifs_writepage, | 1545 | .writepage = ubifs_writepage, |
| 1547 | .write_begin = ubifs_write_begin, | 1546 | .write_begin = ubifs_write_begin, |
| @@ -1551,7 +1550,7 @@ struct address_space_operations ubifs_file_address_operations = { | |||
| 1551 | .releasepage = ubifs_releasepage, | 1550 | .releasepage = ubifs_releasepage, |
| 1552 | }; | 1551 | }; |
| 1553 | 1552 | ||
| 1554 | struct inode_operations ubifs_file_inode_operations = { | 1553 | const struct inode_operations ubifs_file_inode_operations = { |
| 1555 | .setattr = ubifs_setattr, | 1554 | .setattr = ubifs_setattr, |
| 1556 | .getattr = ubifs_getattr, | 1555 | .getattr = ubifs_getattr, |
| 1557 | #ifdef CONFIG_UBIFS_FS_XATTR | 1556 | #ifdef CONFIG_UBIFS_FS_XATTR |
| @@ -1562,14 +1561,14 @@ struct inode_operations ubifs_file_inode_operations = { | |||
| 1562 | #endif | 1561 | #endif |
| 1563 | }; | 1562 | }; |
| 1564 | 1563 | ||
| 1565 | struct inode_operations ubifs_symlink_inode_operations = { | 1564 | const struct inode_operations ubifs_symlink_inode_operations = { |
| 1566 | .readlink = generic_readlink, | 1565 | .readlink = generic_readlink, |
| 1567 | .follow_link = ubifs_follow_link, | 1566 | .follow_link = ubifs_follow_link, |
| 1568 | .setattr = ubifs_setattr, | 1567 | .setattr = ubifs_setattr, |
| 1569 | .getattr = ubifs_getattr, | 1568 | .getattr = ubifs_getattr, |
| 1570 | }; | 1569 | }; |
| 1571 | 1570 | ||
| 1572 | struct file_operations ubifs_file_operations = { | 1571 | const struct file_operations ubifs_file_operations = { |
| 1573 | .llseek = generic_file_llseek, | 1572 | .llseek = generic_file_llseek, |
| 1574 | .read = do_sync_read, | 1573 | .read = do_sync_read, |
| 1575 | .write = do_sync_write, | 1574 | .write = do_sync_write, |
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index 9832f9abe28e..a711d33b3d3e 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c | |||
| @@ -31,6 +31,26 @@ | |||
| 31 | * to be reused. Garbage collection will cause the number of dirty index nodes | 31 | * to be reused. Garbage collection will cause the number of dirty index nodes |
| 32 | * to grow, however sufficient space is reserved for the index to ensure the | 32 | * to grow, however sufficient space is reserved for the index to ensure the |
| 33 | * commit will never run out of space. | 33 | * commit will never run out of space. |
| 34 | * | ||
| 35 | * Notes about dead watermark. At current UBIFS implementation we assume that | ||
| 36 | * LEBs which have less than @c->dead_wm bytes of free + dirty space are full | ||
| 37 | * and not worth garbage-collecting. The dead watermark is one min. I/O unit | ||
| 38 | * size, or min. UBIFS node size, depending on what is greater. Indeed, UBIFS | ||
| 39 | * Garbage Collector has to synchronize the GC head's write buffer before | ||
| 40 | * returning, so this is about wasting one min. I/O unit. However, UBIFS GC can | ||
| 41 | * actually reclaim even very small pieces of dirty space by garbage collecting | ||
| 42 | * enough dirty LEBs, but we do not bother doing this at this implementation. | ||
| 43 | * | ||
| 44 | * Notes about dark watermark. The results of GC work depends on how big are | ||
| 45 | * the UBIFS nodes GC deals with. Large nodes make GC waste more space. Indeed, | ||
| 46 | * if GC move data from LEB A to LEB B and nodes in LEB A are large, GC would | ||
| 47 | * have to waste large pieces of free space at the end of LEB B, because nodes | ||
| 48 | * from LEB A would not fit. And the worst situation is when all nodes are of | ||
| 49 | * maximum size. So dark watermark is the amount of free + dirty space in LEB | ||
| 50 | * which are guaranteed to be reclaimable. If LEB has less space, the GC migh | ||
| 51 | * be unable to reclaim it. So, LEBs with free + dirty greater than dark | ||
| 52 | * watermark are "good" LEBs from GC's point of few. The other LEBs are not so | ||
| 53 | * good, and GC takes extra care when moving them. | ||
| 34 | */ | 54 | */ |
| 35 | 55 | ||
| 36 | #include <linux/pagemap.h> | 56 | #include <linux/pagemap.h> |
| @@ -381,7 +401,7 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp) | |||
| 381 | 401 | ||
| 382 | /* | 402 | /* |
| 383 | * Don't release the LEB until after the next commit, because | 403 | * Don't release the LEB until after the next commit, because |
| 384 | * it may contain date which is needed for recovery. So | 404 | * it may contain data which is needed for recovery. So |
| 385 | * although we freed this LEB, it will become usable only after | 405 | * although we freed this LEB, it will become usable only after |
| 386 | * the commit. | 406 | * the commit. |
| 387 | */ | 407 | */ |
| @@ -810,8 +830,9 @@ out: | |||
| 810 | * ubifs_destroy_idx_gc - destroy idx_gc list. | 830 | * ubifs_destroy_idx_gc - destroy idx_gc list. |
| 811 | * @c: UBIFS file-system description object | 831 | * @c: UBIFS file-system description object |
| 812 | * | 832 | * |
| 813 | * This function destroys the idx_gc list. It is called when unmounting or | 833 | * This function destroys the @c->idx_gc list. It is called when unmounting |
| 814 | * remounting read-only so locks are not needed. | 834 | * so locks are not needed. Returns zero in case of success and a negative |
| 835 | * error code in case of failure. | ||
| 815 | */ | 836 | */ |
| 816 | void ubifs_destroy_idx_gc(struct ubifs_info *c) | 837 | void ubifs_destroy_idx_gc(struct ubifs_info *c) |
| 817 | { | 838 | { |
| @@ -824,7 +845,6 @@ void ubifs_destroy_idx_gc(struct ubifs_info *c) | |||
| 824 | list_del(&idx_gc->list); | 845 | list_del(&idx_gc->list); |
| 825 | kfree(idx_gc); | 846 | kfree(idx_gc); |
| 826 | } | 847 | } |
| 827 | |||
| 828 | } | 848 | } |
| 829 | 849 | ||
| 830 | /** | 850 | /** |
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c index 01682713af69..e8e632a1dcdf 100644 --- a/fs/ubifs/io.c +++ b/fs/ubifs/io.c | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | * would have been wasted for padding to the nearest minimal I/O unit boundary. | 29 | * would have been wasted for padding to the nearest minimal I/O unit boundary. |
| 30 | * Instead, data first goes to the write-buffer and is flushed when the | 30 | * Instead, data first goes to the write-buffer and is flushed when the |
| 31 | * buffer is full or when it is not used for some time (by timer). This is | 31 | * buffer is full or when it is not used for some time (by timer). This is |
| 32 | * similarto the mechanism is used by JFFS2. | 32 | * similar to the mechanism is used by JFFS2. |
| 33 | * | 33 | * |
| 34 | * Write-buffers are defined by 'struct ubifs_wbuf' objects and protected by | 34 | * Write-buffers are defined by 'struct ubifs_wbuf' objects and protected by |
| 35 | * mutexes defined inside these objects. Since sometimes upper-level code | 35 | * mutexes defined inside these objects. Since sometimes upper-level code |
| @@ -75,7 +75,7 @@ void ubifs_ro_mode(struct ubifs_info *c, int err) | |||
| 75 | * @lnum: logical eraseblock number | 75 | * @lnum: logical eraseblock number |
| 76 | * @offs: offset within the logical eraseblock | 76 | * @offs: offset within the logical eraseblock |
| 77 | * @quiet: print no messages | 77 | * @quiet: print no messages |
| 78 | * @chk_crc: indicates whether to always check the CRC | 78 | * @must_chk_crc: indicates whether to always check the CRC |
| 79 | * | 79 | * |
| 80 | * This function checks node magic number and CRC checksum. This function also | 80 | * This function checks node magic number and CRC checksum. This function also |
| 81 | * validates node length to prevent UBIFS from becoming crazy when an attacker | 81 | * validates node length to prevent UBIFS from becoming crazy when an attacker |
| @@ -83,11 +83,17 @@ void ubifs_ro_mode(struct ubifs_info *c, int err) | |||
| 83 | * node length in the common header could cause UBIFS to read memory outside of | 83 | * node length in the common header could cause UBIFS to read memory outside of |
| 84 | * allocated buffer when checking the CRC checksum. | 84 | * allocated buffer when checking the CRC checksum. |
| 85 | * | 85 | * |
| 86 | * This function returns zero in case of success %-EUCLEAN in case of bad CRC | 86 | * This function may skip data nodes CRC checking if @c->no_chk_data_crc is |
| 87 | * or magic. | 87 | * true, which is controlled by corresponding UBIFS mount option. However, if |
| 88 | * @must_chk_crc is true, then @c->no_chk_data_crc is ignored and CRC is | ||
| 89 | * checked. Similarly, if @c->always_chk_crc is true, @c->no_chk_data_crc is | ||
| 90 | * ignored and CRC is checked. | ||
| 91 | * | ||
| 92 | * This function returns zero in case of success and %-EUCLEAN in case of bad | ||
| 93 | * CRC or magic. | ||
| 88 | */ | 94 | */ |
| 89 | int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, | 95 | int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, |
| 90 | int offs, int quiet, int chk_crc) | 96 | int offs, int quiet, int must_chk_crc) |
| 91 | { | 97 | { |
| 92 | int err = -EINVAL, type, node_len; | 98 | int err = -EINVAL, type, node_len; |
| 93 | uint32_t crc, node_crc, magic; | 99 | uint32_t crc, node_crc, magic; |
| @@ -123,9 +129,9 @@ int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, | |||
| 123 | node_len > c->ranges[type].max_len) | 129 | node_len > c->ranges[type].max_len) |
| 124 | goto out_len; | 130 | goto out_len; |
| 125 | 131 | ||
| 126 | if (!chk_crc && type == UBIFS_DATA_NODE && !c->always_chk_crc) | 132 | if (!must_chk_crc && type == UBIFS_DATA_NODE && !c->always_chk_crc && |
| 127 | if (c->no_chk_data_crc) | 133 | c->no_chk_data_crc) |
| 128 | return 0; | 134 | return 0; |
| 129 | 135 | ||
| 130 | crc = crc32(UBIFS_CRC32_INIT, buf + 8, node_len - 8); | 136 | crc = crc32(UBIFS_CRC32_INIT, buf + 8, node_len - 8); |
| 131 | node_crc = le32_to_cpu(ch->crc); | 137 | node_crc = le32_to_cpu(ch->crc); |
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index 9b7c54e0cd2a..a11ca0958a23 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c | |||
| @@ -208,7 +208,7 @@ again: | |||
| 208 | offs = 0; | 208 | offs = 0; |
| 209 | 209 | ||
| 210 | out: | 210 | out: |
| 211 | err = ubifs_wbuf_seek_nolock(wbuf, lnum, offs, UBI_SHORTTERM); | 211 | err = ubifs_wbuf_seek_nolock(wbuf, lnum, offs, wbuf->dtype); |
| 212 | if (err) | 212 | if (err) |
| 213 | goto out_unlock; | 213 | goto out_unlock; |
| 214 | 214 | ||
diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c index dfd2bcece27a..4cdd284dea56 100644 --- a/fs/ubifs/lprops.c +++ b/fs/ubifs/lprops.c | |||
| @@ -635,10 +635,10 @@ const struct ubifs_lprops *ubifs_change_lp(struct ubifs_info *c, | |||
| 635 | * @c: UBIFS file-system description object | 635 | * @c: UBIFS file-system description object |
| 636 | * @st: return statistics | 636 | * @st: return statistics |
| 637 | */ | 637 | */ |
| 638 | void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *st) | 638 | void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *lst) |
| 639 | { | 639 | { |
| 640 | spin_lock(&c->space_lock); | 640 | spin_lock(&c->space_lock); |
| 641 | memcpy(st, &c->lst, sizeof(struct ubifs_lp_stats)); | 641 | memcpy(lst, &c->lst, sizeof(struct ubifs_lp_stats)); |
| 642 | spin_unlock(&c->space_lock); | 642 | spin_unlock(&c->space_lock); |
| 643 | } | 643 | } |
| 644 | 644 | ||
| @@ -678,6 +678,9 @@ int ubifs_change_one_lp(struct ubifs_info *c, int lnum, int free, int dirty, | |||
| 678 | 678 | ||
| 679 | out: | 679 | out: |
| 680 | ubifs_release_lprops(c); | 680 | ubifs_release_lprops(c); |
| 681 | if (err) | ||
| 682 | ubifs_err("cannot change properties of LEB %d, error %d", | ||
| 683 | lnum, err); | ||
| 681 | return err; | 684 | return err; |
| 682 | } | 685 | } |
| 683 | 686 | ||
| @@ -714,6 +717,9 @@ int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int free, int dirty, | |||
| 714 | 717 | ||
| 715 | out: | 718 | out: |
| 716 | ubifs_release_lprops(c); | 719 | ubifs_release_lprops(c); |
| 720 | if (err) | ||
| 721 | ubifs_err("cannot update properties of LEB %d, error %d", | ||
| 722 | lnum, err); | ||
| 717 | return err; | 723 | return err; |
| 718 | } | 724 | } |
| 719 | 725 | ||
| @@ -737,6 +743,8 @@ int ubifs_read_one_lp(struct ubifs_info *c, int lnum, struct ubifs_lprops *lp) | |||
| 737 | lpp = ubifs_lpt_lookup(c, lnum); | 743 | lpp = ubifs_lpt_lookup(c, lnum); |
| 738 | if (IS_ERR(lpp)) { | 744 | if (IS_ERR(lpp)) { |
| 739 | err = PTR_ERR(lpp); | 745 | err = PTR_ERR(lpp); |
| 746 | ubifs_err("cannot read properties of LEB %d, error %d", | ||
| 747 | lnum, err); | ||
| 740 | goto out; | 748 | goto out; |
| 741 | } | 749 | } |
| 742 | 750 | ||
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index 96ca95707175..3216a1f277f8 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c | |||
| @@ -556,23 +556,23 @@ no_space: | |||
| 556 | } | 556 | } |
| 557 | 557 | ||
| 558 | /** | 558 | /** |
| 559 | * next_pnode - find next pnode. | 559 | * next_pnode_to_dirty - find next pnode to dirty. |
| 560 | * @c: UBIFS file-system description object | 560 | * @c: UBIFS file-system description object |
| 561 | * @pnode: pnode | 561 | * @pnode: pnode |
| 562 | * | 562 | * |
| 563 | * This function returns the next pnode or %NULL if there are no more pnodes. | 563 | * This function returns the next pnode to dirty or %NULL if there are no more |
| 564 | * pnodes. Note that pnodes that have never been written (lnum == 0) are | ||
| 565 | * skipped. | ||
| 564 | */ | 566 | */ |
| 565 | static struct ubifs_pnode *next_pnode(struct ubifs_info *c, | 567 | static struct ubifs_pnode *next_pnode_to_dirty(struct ubifs_info *c, |
| 566 | struct ubifs_pnode *pnode) | 568 | struct ubifs_pnode *pnode) |
| 567 | { | 569 | { |
| 568 | struct ubifs_nnode *nnode; | 570 | struct ubifs_nnode *nnode; |
| 569 | int iip; | 571 | int iip; |
| 570 | 572 | ||
| 571 | /* Try to go right */ | 573 | /* Try to go right */ |
| 572 | nnode = pnode->parent; | 574 | nnode = pnode->parent; |
| 573 | iip = pnode->iip + 1; | 575 | for (iip = pnode->iip + 1; iip < UBIFS_LPT_FANOUT; iip++) { |
| 574 | if (iip < UBIFS_LPT_FANOUT) { | ||
| 575 | /* We assume here that LEB zero is never an LPT LEB */ | ||
| 576 | if (nnode->nbranch[iip].lnum) | 576 | if (nnode->nbranch[iip].lnum) |
| 577 | return ubifs_get_pnode(c, nnode, iip); | 577 | return ubifs_get_pnode(c, nnode, iip); |
| 578 | } | 578 | } |
| @@ -583,8 +583,11 @@ static struct ubifs_pnode *next_pnode(struct ubifs_info *c, | |||
| 583 | nnode = nnode->parent; | 583 | nnode = nnode->parent; |
| 584 | if (!nnode) | 584 | if (!nnode) |
| 585 | return NULL; | 585 | return NULL; |
| 586 | /* We assume here that LEB zero is never an LPT LEB */ | 586 | for (; iip < UBIFS_LPT_FANOUT; iip++) { |
| 587 | } while (iip >= UBIFS_LPT_FANOUT || !nnode->nbranch[iip].lnum); | 587 | if (nnode->nbranch[iip].lnum) |
| 588 | break; | ||
| 589 | } | ||
| 590 | } while (iip >= UBIFS_LPT_FANOUT); | ||
| 588 | 591 | ||
| 589 | /* Go right */ | 592 | /* Go right */ |
| 590 | nnode = ubifs_get_nnode(c, nnode, iip); | 593 | nnode = ubifs_get_nnode(c, nnode, iip); |
| @@ -593,12 +596,29 @@ static struct ubifs_pnode *next_pnode(struct ubifs_info *c, | |||
| 593 | 596 | ||
| 594 | /* Go down to level 1 */ | 597 | /* Go down to level 1 */ |
| 595 | while (nnode->level > 1) { | 598 | while (nnode->level > 1) { |
| 596 | nnode = ubifs_get_nnode(c, nnode, 0); | 599 | for (iip = 0; iip < UBIFS_LPT_FANOUT; iip++) { |
| 600 | if (nnode->nbranch[iip].lnum) | ||
| 601 | break; | ||
| 602 | } | ||
| 603 | if (iip >= UBIFS_LPT_FANOUT) { | ||
| 604 | /* | ||
| 605 | * Should not happen, but we need to keep going | ||
| 606 | * if it does. | ||
| 607 | */ | ||
| 608 | iip = 0; | ||
| 609 | } | ||
| 610 | nnode = ubifs_get_nnode(c, nnode, iip); | ||
| 597 | if (IS_ERR(nnode)) | 611 | if (IS_ERR(nnode)) |
| 598 | return (void *)nnode; | 612 | return (void *)nnode; |
| 599 | } | 613 | } |
| 600 | 614 | ||
| 601 | return ubifs_get_pnode(c, nnode, 0); | 615 | for (iip = 0; iip < UBIFS_LPT_FANOUT; iip++) |
| 616 | if (nnode->nbranch[iip].lnum) | ||
| 617 | break; | ||
| 618 | if (iip >= UBIFS_LPT_FANOUT) | ||
| 619 | /* Should not happen, but we need to keep going if it does */ | ||
| 620 | iip = 0; | ||
| 621 | return ubifs_get_pnode(c, nnode, iip); | ||
| 602 | } | 622 | } |
| 603 | 623 | ||
| 604 | /** | 624 | /** |
| @@ -688,7 +708,7 @@ static int make_tree_dirty(struct ubifs_info *c) | |||
| 688 | pnode = pnode_lookup(c, 0); | 708 | pnode = pnode_lookup(c, 0); |
| 689 | while (pnode) { | 709 | while (pnode) { |
| 690 | do_make_pnode_dirty(c, pnode); | 710 | do_make_pnode_dirty(c, pnode); |
| 691 | pnode = next_pnode(c, pnode); | 711 | pnode = next_pnode_to_dirty(c, pnode); |
| 692 | if (IS_ERR(pnode)) | 712 | if (IS_ERR(pnode)) |
| 693 | return PTR_ERR(pnode); | 713 | return PTR_ERR(pnode); |
| 694 | } | 714 | } |
diff --git a/fs/ubifs/master.c b/fs/ubifs/master.c index 71d5493bf565..a88f33801b98 100644 --- a/fs/ubifs/master.c +++ b/fs/ubifs/master.c | |||
| @@ -354,7 +354,7 @@ int ubifs_write_master(struct ubifs_info *c) | |||
| 354 | int err, lnum, offs, len; | 354 | int err, lnum, offs, len; |
| 355 | 355 | ||
| 356 | if (c->ro_media) | 356 | if (c->ro_media) |
| 357 | return -EINVAL; | 357 | return -EROFS; |
| 358 | 358 | ||
| 359 | lnum = UBIFS_MST_LNUM; | 359 | lnum = UBIFS_MST_LNUM; |
| 360 | offs = c->mst_offs + c->mst_node_alsz; | 360 | offs = c->mst_offs + c->mst_node_alsz; |
diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c index 9e6f403f170e..152a7b34a141 100644 --- a/fs/ubifs/orphan.c +++ b/fs/ubifs/orphan.c | |||
| @@ -46,7 +46,7 @@ | |||
| 46 | * Orphans are accumulated in a rb-tree. When an inode's link count drops to | 46 | * Orphans are accumulated in a rb-tree. When an inode's link count drops to |
| 47 | * zero, the inode number is added to the rb-tree. It is removed from the tree | 47 | * zero, the inode number is added to the rb-tree. It is removed from the tree |
| 48 | * when the inode is deleted. Any new orphans that are in the orphan tree when | 48 | * when the inode is deleted. Any new orphans that are in the orphan tree when |
| 49 | * the commit is run, are written to the orphan area in 1 or more orph nodes. | 49 | * the commit is run, are written to the orphan area in 1 or more orphan nodes. |
| 50 | * If the orphan area is full, it is consolidated to make space. There is | 50 | * If the orphan area is full, it is consolidated to make space. There is |
| 51 | * always enough space because validation prevents the user from creating more | 51 | * always enough space because validation prevents the user from creating more |
| 52 | * than the maximum number of orphans allowed. | 52 | * than the maximum number of orphans allowed. |
| @@ -231,7 +231,7 @@ static int tot_avail_orphs(struct ubifs_info *c) | |||
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | /** | 233 | /** |
| 234 | * do_write_orph_node - write a node | 234 | * do_write_orph_node - write a node to the orphan head. |
| 235 | * @c: UBIFS file-system description object | 235 | * @c: UBIFS file-system description object |
| 236 | * @len: length of node | 236 | * @len: length of node |
| 237 | * @atomic: write atomically | 237 | * @atomic: write atomically |
| @@ -264,11 +264,11 @@ static int do_write_orph_node(struct ubifs_info *c, int len, int atomic) | |||
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | /** | 266 | /** |
| 267 | * write_orph_node - write an orph node | 267 | * write_orph_node - write an orphan node. |
| 268 | * @c: UBIFS file-system description object | 268 | * @c: UBIFS file-system description object |
| 269 | * @atomic: write atomically | 269 | * @atomic: write atomically |
| 270 | * | 270 | * |
| 271 | * This function builds an orph node from the cnext list and writes it to the | 271 | * This function builds an orphan node from the cnext list and writes it to the |
| 272 | * orphan head. On success, %0 is returned, otherwise a negative error code | 272 | * orphan head. On success, %0 is returned, otherwise a negative error code |
| 273 | * is returned. | 273 | * is returned. |
| 274 | */ | 274 | */ |
| @@ -326,11 +326,11 @@ static int write_orph_node(struct ubifs_info *c, int atomic) | |||
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | /** | 328 | /** |
| 329 | * write_orph_nodes - write orph nodes until there are no more to commit | 329 | * write_orph_nodes - write orphan nodes until there are no more to commit. |
| 330 | * @c: UBIFS file-system description object | 330 | * @c: UBIFS file-system description object |
| 331 | * @atomic: write atomically | 331 | * @atomic: write atomically |
| 332 | * | 332 | * |
| 333 | * This function writes orph nodes for all the orphans to commit. On success, | 333 | * This function writes orphan nodes for all the orphans to commit. On success, |
| 334 | * %0 is returned, otherwise a negative error code is returned. | 334 | * %0 is returned, otherwise a negative error code is returned. |
| 335 | */ | 335 | */ |
| 336 | static int write_orph_nodes(struct ubifs_info *c, int atomic) | 336 | static int write_orph_nodes(struct ubifs_info *c, int atomic) |
| @@ -478,14 +478,14 @@ int ubifs_orphan_end_commit(struct ubifs_info *c) | |||
| 478 | } | 478 | } |
| 479 | 479 | ||
| 480 | /** | 480 | /** |
| 481 | * clear_orphans - erase all LEBs used for orphans. | 481 | * ubifs_clear_orphans - erase all LEBs used for orphans. |
| 482 | * @c: UBIFS file-system description object | 482 | * @c: UBIFS file-system description object |
| 483 | * | 483 | * |
| 484 | * If recovery is not required, then the orphans from the previous session | 484 | * If recovery is not required, then the orphans from the previous session |
| 485 | * are not needed. This function locates the LEBs used to record | 485 | * are not needed. This function locates the LEBs used to record |
| 486 | * orphans, and un-maps them. | 486 | * orphans, and un-maps them. |
| 487 | */ | 487 | */ |
| 488 | static int clear_orphans(struct ubifs_info *c) | 488 | int ubifs_clear_orphans(struct ubifs_info *c) |
| 489 | { | 489 | { |
| 490 | int lnum, err; | 490 | int lnum, err; |
| 491 | 491 | ||
| @@ -547,9 +547,9 @@ static int insert_dead_orphan(struct ubifs_info *c, ino_t inum) | |||
| 547 | * do_kill_orphans - remove orphan inodes from the index. | 547 | * do_kill_orphans - remove orphan inodes from the index. |
| 548 | * @c: UBIFS file-system description object | 548 | * @c: UBIFS file-system description object |
| 549 | * @sleb: scanned LEB | 549 | * @sleb: scanned LEB |
| 550 | * @last_cmt_no: cmt_no of last orph node read is passed and returned here | 550 | * @last_cmt_no: cmt_no of last orphan node read is passed and returned here |
| 551 | * @outofdate: whether the LEB is out of date is returned here | 551 | * @outofdate: whether the LEB is out of date is returned here |
| 552 | * @last_flagged: whether the end orph node is encountered | 552 | * @last_flagged: whether the end orphan node is encountered |
| 553 | * | 553 | * |
| 554 | * This function is a helper to the 'kill_orphans()' function. It goes through | 554 | * This function is a helper to the 'kill_orphans()' function. It goes through |
| 555 | * every orphan node in a LEB and for every inode number recorded, removes | 555 | * every orphan node in a LEB and for every inode number recorded, removes |
| @@ -580,8 +580,8 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb, | |||
| 580 | /* | 580 | /* |
| 581 | * The commit number on the master node may be less, because | 581 | * The commit number on the master node may be less, because |
| 582 | * of a failed commit. If there are several failed commits in a | 582 | * of a failed commit. If there are several failed commits in a |
| 583 | * row, the commit number written on orph nodes will continue to | 583 | * row, the commit number written on orphan nodes will continue |
| 584 | * increase (because the commit number is adjusted here) even | 584 | * to increase (because the commit number is adjusted here) even |
| 585 | * though the commit number on the master node stays the same | 585 | * though the commit number on the master node stays the same |
| 586 | * because the master node has not been re-written. | 586 | * because the master node has not been re-written. |
| 587 | */ | 587 | */ |
| @@ -589,9 +589,9 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb, | |||
| 589 | c->cmt_no = cmt_no; | 589 | c->cmt_no = cmt_no; |
| 590 | if (cmt_no < *last_cmt_no && *last_flagged) { | 590 | if (cmt_no < *last_cmt_no && *last_flagged) { |
| 591 | /* | 591 | /* |
| 592 | * The last orph node had a higher commit number and was | 592 | * The last orphan node had a higher commit number and |
| 593 | * flagged as the last written for that commit number. | 593 | * was flagged as the last written for that commit |
| 594 | * That makes this orph node, out of date. | 594 | * number. That makes this orphan node, out of date. |
| 595 | */ | 595 | */ |
| 596 | if (!first) { | 596 | if (!first) { |
| 597 | ubifs_err("out of order commit number %llu in " | 597 | ubifs_err("out of order commit number %llu in " |
| @@ -658,10 +658,10 @@ static int kill_orphans(struct ubifs_info *c) | |||
| 658 | /* | 658 | /* |
| 659 | * Orph nodes always start at c->orph_first and are written to each | 659 | * Orph nodes always start at c->orph_first and are written to each |
| 660 | * successive LEB in turn. Generally unused LEBs will have been unmapped | 660 | * successive LEB in turn. Generally unused LEBs will have been unmapped |
| 661 | * but may contain out of date orph nodes if the unmap didn't go | 661 | * but may contain out of date orphan nodes if the unmap didn't go |
| 662 | * through. In addition, the last orph node written for each commit is | 662 | * through. In addition, the last orphan node written for each commit is |
| 663 | * marked (top bit of orph->cmt_no is set to 1). It is possible that | 663 | * marked (top bit of orph->cmt_no is set to 1). It is possible that |
| 664 | * there are orph nodes from the next commit (i.e. the commit did not | 664 | * there are orphan nodes from the next commit (i.e. the commit did not |
| 665 | * complete successfully). In that case, no orphans will have been lost | 665 | * complete successfully). In that case, no orphans will have been lost |
| 666 | * due to the way that orphans are written, and any orphans added will | 666 | * due to the way that orphans are written, and any orphans added will |
| 667 | * be valid orphans anyway and so can be deleted. | 667 | * be valid orphans anyway and so can be deleted. |
| @@ -718,7 +718,7 @@ int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only) | |||
| 718 | if (unclean) | 718 | if (unclean) |
| 719 | err = kill_orphans(c); | 719 | err = kill_orphans(c); |
| 720 | else if (!read_only) | 720 | else if (!read_only) |
| 721 | err = clear_orphans(c); | 721 | err = ubifs_clear_orphans(c); |
| 722 | 722 | ||
| 723 | return err; | 723 | return err; |
| 724 | } | 724 | } |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 89556ee72518..1182b66a5491 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
| @@ -397,6 +397,7 @@ static int ubifs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
| 397 | buf->f_namelen = UBIFS_MAX_NLEN; | 397 | buf->f_namelen = UBIFS_MAX_NLEN; |
| 398 | buf->f_fsid.val[0] = le32_to_cpu(uuid[0]) ^ le32_to_cpu(uuid[2]); | 398 | buf->f_fsid.val[0] = le32_to_cpu(uuid[0]) ^ le32_to_cpu(uuid[2]); |
| 399 | buf->f_fsid.val[1] = le32_to_cpu(uuid[1]) ^ le32_to_cpu(uuid[3]); | 399 | buf->f_fsid.val[1] = le32_to_cpu(uuid[1]) ^ le32_to_cpu(uuid[3]); |
| 400 | ubifs_assert(buf->f_bfree <= c->block_cnt); | ||
| 400 | return 0; | 401 | return 0; |
| 401 | } | 402 | } |
| 402 | 403 | ||
| @@ -432,33 +433,24 @@ static int ubifs_sync_fs(struct super_block *sb, int wait) | |||
| 432 | int i, err; | 433 | int i, err; |
| 433 | struct ubifs_info *c = sb->s_fs_info; | 434 | struct ubifs_info *c = sb->s_fs_info; |
| 434 | struct writeback_control wbc = { | 435 | struct writeback_control wbc = { |
| 435 | .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_NONE, | 436 | .sync_mode = WB_SYNC_ALL, |
| 436 | .range_start = 0, | 437 | .range_start = 0, |
| 437 | .range_end = LLONG_MAX, | 438 | .range_end = LLONG_MAX, |
| 438 | .nr_to_write = LONG_MAX, | 439 | .nr_to_write = LONG_MAX, |
| 439 | }; | 440 | }; |
| 440 | 441 | ||
| 441 | /* | 442 | /* |
| 442 | * Note by akpm about WB_SYNC_NONE used above: zero @wait is just an | 443 | * Zero @wait is just an advisory thing to help the file system shove |
| 443 | * advisory thing to help the file system shove lots of data into the | 444 | * lots of data into the queues, and there will be the second |
| 444 | * queues. If some gets missed then it'll be picked up on the second | ||
| 445 | * '->sync_fs()' call, with non-zero @wait. | 445 | * '->sync_fs()' call, with non-zero @wait. |
| 446 | */ | 446 | */ |
| 447 | if (!wait) | ||
| 448 | return 0; | ||
| 447 | 449 | ||
| 448 | if (sb->s_flags & MS_RDONLY) | 450 | if (sb->s_flags & MS_RDONLY) |
| 449 | return 0; | 451 | return 0; |
| 450 | 452 | ||
| 451 | /* | 453 | /* |
| 452 | * Synchronize write buffers, because 'ubifs_run_commit()' does not | ||
| 453 | * do this if it waits for an already running commit. | ||
| 454 | */ | ||
| 455 | for (i = 0; i < c->jhead_cnt; i++) { | ||
| 456 | err = ubifs_wbuf_sync(&c->jheads[i].wbuf); | ||
| 457 | if (err) | ||
| 458 | return err; | ||
| 459 | } | ||
| 460 | |||
| 461 | /* | ||
| 462 | * VFS calls '->sync_fs()' before synchronizing all dirty inodes and | 454 | * VFS calls '->sync_fs()' before synchronizing all dirty inodes and |
| 463 | * pages, so synchronize them first, then commit the journal. Strictly | 455 | * pages, so synchronize them first, then commit the journal. Strictly |
| 464 | * speaking, it is not necessary to commit the journal here, | 456 | * speaking, it is not necessary to commit the journal here, |
| @@ -469,6 +461,16 @@ static int ubifs_sync_fs(struct super_block *sb, int wait) | |||
| 469 | */ | 461 | */ |
| 470 | generic_sync_sb_inodes(sb, &wbc); | 462 | generic_sync_sb_inodes(sb, &wbc); |
| 471 | 463 | ||
| 464 | /* | ||
| 465 | * Synchronize write buffers, because 'ubifs_run_commit()' does not | ||
| 466 | * do this if it waits for an already running commit. | ||
| 467 | */ | ||
| 468 | for (i = 0; i < c->jhead_cnt; i++) { | ||
| 469 | err = ubifs_wbuf_sync(&c->jheads[i].wbuf); | ||
| 470 | if (err) | ||
| 471 | return err; | ||
| 472 | } | ||
| 473 | |||
| 472 | err = ubifs_run_commit(c); | 474 | err = ubifs_run_commit(c); |
| 473 | if (err) | 475 | if (err) |
| 474 | return err; | 476 | return err; |
| @@ -572,15 +574,8 @@ static int init_constants_early(struct ubifs_info *c) | |||
| 572 | c->ranges[UBIFS_IDX_NODE].max_len = INT_MAX; | 574 | c->ranges[UBIFS_IDX_NODE].max_len = INT_MAX; |
| 573 | 575 | ||
| 574 | /* | 576 | /* |
| 575 | * Initialize dead and dark LEB space watermarks. | 577 | * Initialize dead and dark LEB space watermarks. See gc.c for comments |
| 576 | * | 578 | * about these values. |
| 577 | * Dead space is the space which cannot be used. Its watermark is | ||
| 578 | * equivalent to min. I/O unit or minimum node size if it is greater | ||
| 579 | * then min. I/O unit. | ||
| 580 | * | ||
| 581 | * Dark space is the space which might be used, or might not, depending | ||
| 582 | * on which node should be written to the LEB. Its watermark is | ||
| 583 | * equivalent to maximum UBIFS node size. | ||
| 584 | */ | 579 | */ |
| 585 | c->dead_wm = ALIGN(MIN_WRITE_SZ, c->min_io_size); | 580 | c->dead_wm = ALIGN(MIN_WRITE_SZ, c->min_io_size); |
| 586 | c->dark_wm = ALIGN(UBIFS_MAX_NODE_SZ, c->min_io_size); | 581 | c->dark_wm = ALIGN(UBIFS_MAX_NODE_SZ, c->min_io_size); |
| @@ -741,12 +736,12 @@ static void init_constants_master(struct ubifs_info *c) | |||
| 741 | * take_gc_lnum - reserve GC LEB. | 736 | * take_gc_lnum - reserve GC LEB. |
| 742 | * @c: UBIFS file-system description object | 737 | * @c: UBIFS file-system description object |
| 743 | * | 738 | * |
| 744 | * This function ensures that the LEB reserved for garbage collection is | 739 | * This function ensures that the LEB reserved for garbage collection is marked |
| 745 | * unmapped and is marked as "taken" in lprops. We also have to set free space | 740 | * as "taken" in lprops. We also have to set free space to LEB size and dirty |
| 746 | * to LEB size and dirty space to zero, because lprops may contain out-of-date | 741 | * space to zero, because lprops may contain out-of-date information if the |
| 747 | * information if the file-system was un-mounted before it has been committed. | 742 | * file-system was un-mounted before it has been committed. This function |
| 748 | * This function returns zero in case of success and a negative error code in | 743 | * returns zero in case of success and a negative error code in case of |
| 749 | * case of failure. | 744 | * failure. |
| 750 | */ | 745 | */ |
| 751 | static int take_gc_lnum(struct ubifs_info *c) | 746 | static int take_gc_lnum(struct ubifs_info *c) |
| 752 | { | 747 | { |
| @@ -757,10 +752,6 @@ static int take_gc_lnum(struct ubifs_info *c) | |||
| 757 | return -EINVAL; | 752 | return -EINVAL; |
| 758 | } | 753 | } |
| 759 | 754 | ||
| 760 | err = ubifs_leb_unmap(c, c->gc_lnum); | ||
| 761 | if (err) | ||
| 762 | return err; | ||
| 763 | |||
| 764 | /* And we have to tell lprops that this LEB is taken */ | 755 | /* And we have to tell lprops that this LEB is taken */ |
| 765 | err = ubifs_change_one_lp(c, c->gc_lnum, c->leb_size, 0, | 756 | err = ubifs_change_one_lp(c, c->gc_lnum, c->leb_size, 0, |
| 766 | LPROPS_TAKEN, 0, 0); | 757 | LPROPS_TAKEN, 0, 0); |
| @@ -966,13 +957,16 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options, | |||
| 966 | 957 | ||
| 967 | token = match_token(p, tokens, args); | 958 | token = match_token(p, tokens, args); |
| 968 | switch (token) { | 959 | switch (token) { |
| 960 | /* | ||
| 961 | * %Opt_fast_unmount and %Opt_norm_unmount options are ignored. | ||
| 962 | * We accepte them in order to be backware-compatible. But this | ||
| 963 | * should be removed at some point. | ||
| 964 | */ | ||
| 969 | case Opt_fast_unmount: | 965 | case Opt_fast_unmount: |
| 970 | c->mount_opts.unmount_mode = 2; | 966 | c->mount_opts.unmount_mode = 2; |
| 971 | c->fast_unmount = 1; | ||
| 972 | break; | 967 | break; |
| 973 | case Opt_norm_unmount: | 968 | case Opt_norm_unmount: |
| 974 | c->mount_opts.unmount_mode = 1; | 969 | c->mount_opts.unmount_mode = 1; |
| 975 | c->fast_unmount = 0; | ||
| 976 | break; | 970 | break; |
| 977 | case Opt_bulk_read: | 971 | case Opt_bulk_read: |
| 978 | c->mount_opts.bulk_read = 2; | 972 | c->mount_opts.bulk_read = 2; |
| @@ -1094,12 +1088,7 @@ static int check_free_space(struct ubifs_info *c) | |||
| 1094 | ubifs_err("insufficient free space to mount in read/write mode"); | 1088 | ubifs_err("insufficient free space to mount in read/write mode"); |
| 1095 | dbg_dump_budg(c); | 1089 | dbg_dump_budg(c); |
| 1096 | dbg_dump_lprops(c); | 1090 | dbg_dump_lprops(c); |
| 1097 | /* | 1091 | return -ENOSPC; |
| 1098 | * We return %-EINVAL instead of %-ENOSPC because it seems to | ||
| 1099 | * be the closest error code mentioned in the mount function | ||
| 1100 | * documentation. | ||
| 1101 | */ | ||
| 1102 | return -EINVAL; | ||
| 1103 | } | 1092 | } |
| 1104 | return 0; | 1093 | return 0; |
| 1105 | } | 1094 | } |
| @@ -1286,10 +1275,19 @@ static int mount_ubifs(struct ubifs_info *c) | |||
| 1286 | if (err) | 1275 | if (err) |
| 1287 | goto out_orphans; | 1276 | goto out_orphans; |
| 1288 | err = ubifs_rcvry_gc_commit(c); | 1277 | err = ubifs_rcvry_gc_commit(c); |
| 1289 | } else | 1278 | } else { |
| 1290 | err = take_gc_lnum(c); | 1279 | err = take_gc_lnum(c); |
| 1291 | if (err) | 1280 | if (err) |
| 1292 | goto out_orphans; | 1281 | goto out_orphans; |
| 1282 | |||
| 1283 | /* | ||
| 1284 | * GC LEB may contain garbage if there was an unclean | ||
| 1285 | * reboot, and it should be un-mapped. | ||
| 1286 | */ | ||
| 1287 | err = ubifs_leb_unmap(c, c->gc_lnum); | ||
| 1288 | if (err) | ||
| 1289 | return err; | ||
| 1290 | } | ||
| 1293 | 1291 | ||
| 1294 | err = dbg_check_lprops(c); | 1292 | err = dbg_check_lprops(c); |
| 1295 | if (err) | 1293 | if (err) |
| @@ -1298,6 +1296,16 @@ static int mount_ubifs(struct ubifs_info *c) | |||
| 1298 | err = ubifs_recover_size(c); | 1296 | err = ubifs_recover_size(c); |
| 1299 | if (err) | 1297 | if (err) |
| 1300 | goto out_orphans; | 1298 | goto out_orphans; |
| 1299 | } else { | ||
| 1300 | /* | ||
| 1301 | * Even if we mount read-only, we have to set space in GC LEB | ||
| 1302 | * to proper value because this affects UBIFS free space | ||
| 1303 | * reporting. We do not want to have a situation when | ||
| 1304 | * re-mounting from R/O to R/W changes amount of free space. | ||
| 1305 | */ | ||
| 1306 | err = take_gc_lnum(c); | ||
| 1307 | if (err) | ||
| 1308 | goto out_orphans; | ||
| 1301 | } | 1309 | } |
| 1302 | 1310 | ||
| 1303 | spin_lock(&ubifs_infos_lock); | 1311 | spin_lock(&ubifs_infos_lock); |
| @@ -1310,14 +1318,17 @@ static int mount_ubifs(struct ubifs_info *c) | |||
| 1310 | else { | 1318 | else { |
| 1311 | c->need_recovery = 0; | 1319 | c->need_recovery = 0; |
| 1312 | ubifs_msg("recovery completed"); | 1320 | ubifs_msg("recovery completed"); |
| 1321 | /* GC LEB has to be empty and taken at this point */ | ||
| 1322 | ubifs_assert(c->lst.taken_empty_lebs == 1); | ||
| 1313 | } | 1323 | } |
| 1314 | } | 1324 | } else |
| 1325 | ubifs_assert(c->lst.taken_empty_lebs == 1); | ||
| 1315 | 1326 | ||
| 1316 | err = dbg_debugfs_init_fs(c); | 1327 | err = dbg_check_filesystem(c); |
| 1317 | if (err) | 1328 | if (err) |
| 1318 | goto out_infos; | 1329 | goto out_infos; |
| 1319 | 1330 | ||
| 1320 | err = dbg_check_filesystem(c); | 1331 | err = dbg_debugfs_init_fs(c); |
| 1321 | if (err) | 1332 | if (err) |
| 1322 | goto out_infos; | 1333 | goto out_infos; |
| 1323 | 1334 | ||
| @@ -1351,7 +1362,6 @@ static int mount_ubifs(struct ubifs_info *c) | |||
| 1351 | c->uuid[4], c->uuid[5], c->uuid[6], c->uuid[7], | 1362 | c->uuid[4], c->uuid[5], c->uuid[6], c->uuid[7], |
| 1352 | c->uuid[8], c->uuid[9], c->uuid[10], c->uuid[11], | 1363 | c->uuid[8], c->uuid[9], c->uuid[10], c->uuid[11], |
| 1353 | c->uuid[12], c->uuid[13], c->uuid[14], c->uuid[15]); | 1364 | c->uuid[12], c->uuid[13], c->uuid[14], c->uuid[15]); |
| 1354 | dbg_msg("fast unmount: %d", c->fast_unmount); | ||
| 1355 | dbg_msg("big_lpt %d", c->big_lpt); | 1365 | dbg_msg("big_lpt %d", c->big_lpt); |
| 1356 | dbg_msg("log LEBs: %d (%d - %d)", | 1366 | dbg_msg("log LEBs: %d (%d - %d)", |
| 1357 | c->log_lebs, UBIFS_LOG_LNUM, c->log_last); | 1367 | c->log_lebs, UBIFS_LOG_LNUM, c->log_last); |
| @@ -1475,10 +1485,8 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
| 1475 | { | 1485 | { |
| 1476 | int err, lnum; | 1486 | int err, lnum; |
| 1477 | 1487 | ||
| 1478 | if (c->ro_media) | ||
| 1479 | return -EINVAL; | ||
| 1480 | |||
| 1481 | mutex_lock(&c->umount_mutex); | 1488 | mutex_lock(&c->umount_mutex); |
| 1489 | dbg_save_space_info(c); | ||
| 1482 | c->remounting_rw = 1; | 1490 | c->remounting_rw = 1; |
| 1483 | c->always_chk_crc = 1; | 1491 | c->always_chk_crc = 1; |
| 1484 | 1492 | ||
| @@ -1514,6 +1522,12 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
| 1514 | err = ubifs_recover_inl_heads(c, c->sbuf); | 1522 | err = ubifs_recover_inl_heads(c, c->sbuf); |
| 1515 | if (err) | 1523 | if (err) |
| 1516 | goto out; | 1524 | goto out; |
| 1525 | } else { | ||
| 1526 | /* A readonly mount is not allowed to have orphans */ | ||
| 1527 | ubifs_assert(c->tot_orphans == 0); | ||
| 1528 | err = ubifs_clear_orphans(c); | ||
| 1529 | if (err) | ||
| 1530 | goto out; | ||
| 1517 | } | 1531 | } |
| 1518 | 1532 | ||
| 1519 | if (!(c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY))) { | 1533 | if (!(c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY))) { |
| @@ -1569,7 +1583,7 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
| 1569 | if (c->need_recovery) | 1583 | if (c->need_recovery) |
| 1570 | err = ubifs_rcvry_gc_commit(c); | 1584 | err = ubifs_rcvry_gc_commit(c); |
| 1571 | else | 1585 | else |
| 1572 | err = take_gc_lnum(c); | 1586 | err = ubifs_leb_unmap(c, c->gc_lnum); |
| 1573 | if (err) | 1587 | if (err) |
| 1574 | goto out; | 1588 | goto out; |
| 1575 | 1589 | ||
| @@ -1582,8 +1596,9 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
| 1582 | c->vfs_sb->s_flags &= ~MS_RDONLY; | 1596 | c->vfs_sb->s_flags &= ~MS_RDONLY; |
| 1583 | c->remounting_rw = 0; | 1597 | c->remounting_rw = 0; |
| 1584 | c->always_chk_crc = 0; | 1598 | c->always_chk_crc = 0; |
| 1599 | err = dbg_check_space_info(c); | ||
| 1585 | mutex_unlock(&c->umount_mutex); | 1600 | mutex_unlock(&c->umount_mutex); |
| 1586 | return 0; | 1601 | return err; |
| 1587 | 1602 | ||
| 1588 | out: | 1603 | out: |
| 1589 | vfree(c->orph_buf); | 1604 | vfree(c->orph_buf); |
| @@ -1603,43 +1618,18 @@ out: | |||
| 1603 | } | 1618 | } |
| 1604 | 1619 | ||
| 1605 | /** | 1620 | /** |
| 1606 | * commit_on_unmount - commit the journal when un-mounting. | ||
| 1607 | * @c: UBIFS file-system description object | ||
| 1608 | * | ||
| 1609 | * This function is called during un-mounting and re-mounting, and it commits | ||
| 1610 | * the journal unless the "fast unmount" mode is enabled. | ||
| 1611 | */ | ||
| 1612 | static void commit_on_unmount(struct ubifs_info *c) | ||
| 1613 | { | ||
| 1614 | struct super_block *sb = c->vfs_sb; | ||
| 1615 | long long bud_bytes; | ||
| 1616 | |||
| 1617 | /* | ||
| 1618 | * This function is called before the background thread is stopped, so | ||
| 1619 | * we may race with ongoing commit, which means we have to take | ||
| 1620 | * @c->bud_lock to access @c->bud_bytes. | ||
| 1621 | */ | ||
| 1622 | spin_lock(&c->buds_lock); | ||
| 1623 | bud_bytes = c->bud_bytes; | ||
| 1624 | spin_unlock(&c->buds_lock); | ||
| 1625 | |||
| 1626 | if (!c->fast_unmount && !(sb->s_flags & MS_RDONLY) && bud_bytes) | ||
| 1627 | ubifs_run_commit(c); | ||
| 1628 | } | ||
| 1629 | |||
| 1630 | /** | ||
| 1631 | * ubifs_remount_ro - re-mount in read-only mode. | 1621 | * ubifs_remount_ro - re-mount in read-only mode. |
| 1632 | * @c: UBIFS file-system description object | 1622 | * @c: UBIFS file-system description object |
| 1633 | * | 1623 | * |
| 1634 | * We rely on VFS to have stopped writing. Possibly the background thread could | 1624 | * We assume VFS has stopped writing. Possibly the background thread could be |
| 1635 | * be running a commit, however kthread_stop will wait in that case. | 1625 | * running a commit, however kthread_stop will wait in that case. |
| 1636 | */ | 1626 | */ |
| 1637 | static void ubifs_remount_ro(struct ubifs_info *c) | 1627 | static void ubifs_remount_ro(struct ubifs_info *c) |
| 1638 | { | 1628 | { |
| 1639 | int i, err; | 1629 | int i, err; |
| 1640 | 1630 | ||
| 1641 | ubifs_assert(!c->need_recovery); | 1631 | ubifs_assert(!c->need_recovery); |
| 1642 | commit_on_unmount(c); | 1632 | ubifs_assert(!(c->vfs_sb->s_flags & MS_RDONLY)); |
| 1643 | 1633 | ||
| 1644 | mutex_lock(&c->umount_mutex); | 1634 | mutex_lock(&c->umount_mutex); |
| 1645 | if (c->bgt) { | 1635 | if (c->bgt) { |
| @@ -1647,27 +1637,29 @@ static void ubifs_remount_ro(struct ubifs_info *c) | |||
| 1647 | c->bgt = NULL; | 1637 | c->bgt = NULL; |
| 1648 | } | 1638 | } |
| 1649 | 1639 | ||
| 1640 | dbg_save_space_info(c); | ||
| 1641 | |||
| 1650 | for (i = 0; i < c->jhead_cnt; i++) { | 1642 | for (i = 0; i < c->jhead_cnt; i++) { |
| 1651 | ubifs_wbuf_sync(&c->jheads[i].wbuf); | 1643 | ubifs_wbuf_sync(&c->jheads[i].wbuf); |
| 1652 | del_timer_sync(&c->jheads[i].wbuf.timer); | 1644 | del_timer_sync(&c->jheads[i].wbuf.timer); |
| 1653 | } | 1645 | } |
| 1654 | 1646 | ||
| 1655 | if (!c->ro_media) { | 1647 | c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_DIRTY); |
| 1656 | c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_DIRTY); | 1648 | c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS); |
| 1657 | c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS); | 1649 | c->mst_node->gc_lnum = cpu_to_le32(c->gc_lnum); |
| 1658 | c->mst_node->gc_lnum = cpu_to_le32(c->gc_lnum); | 1650 | err = ubifs_write_master(c); |
| 1659 | err = ubifs_write_master(c); | 1651 | if (err) |
| 1660 | if (err) | 1652 | ubifs_ro_mode(c, err); |
| 1661 | ubifs_ro_mode(c, err); | ||
| 1662 | } | ||
| 1663 | 1653 | ||
| 1664 | ubifs_destroy_idx_gc(c); | ||
| 1665 | free_wbufs(c); | 1654 | free_wbufs(c); |
| 1666 | vfree(c->orph_buf); | 1655 | vfree(c->orph_buf); |
| 1667 | c->orph_buf = NULL; | 1656 | c->orph_buf = NULL; |
| 1668 | vfree(c->ileb_buf); | 1657 | vfree(c->ileb_buf); |
| 1669 | c->ileb_buf = NULL; | 1658 | c->ileb_buf = NULL; |
| 1670 | ubifs_lpt_free(c, 1); | 1659 | ubifs_lpt_free(c, 1); |
| 1660 | err = dbg_check_space_info(c); | ||
| 1661 | if (err) | ||
| 1662 | ubifs_ro_mode(c, err); | ||
| 1671 | mutex_unlock(&c->umount_mutex); | 1663 | mutex_unlock(&c->umount_mutex); |
| 1672 | } | 1664 | } |
| 1673 | 1665 | ||
| @@ -1760,11 +1752,20 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) | |||
| 1760 | } | 1752 | } |
| 1761 | 1753 | ||
| 1762 | if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { | 1754 | if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { |
| 1755 | if (c->ro_media) { | ||
| 1756 | ubifs_msg("cannot re-mount due to prior errors"); | ||
| 1757 | return -EROFS; | ||
| 1758 | } | ||
| 1763 | err = ubifs_remount_rw(c); | 1759 | err = ubifs_remount_rw(c); |
| 1764 | if (err) | 1760 | if (err) |
| 1765 | return err; | 1761 | return err; |
| 1766 | } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) | 1762 | } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) { |
| 1763 | if (c->ro_media) { | ||
| 1764 | ubifs_msg("cannot re-mount due to prior errors"); | ||
| 1765 | return -EROFS; | ||
| 1766 | } | ||
| 1767 | ubifs_remount_ro(c); | 1767 | ubifs_remount_ro(c); |
| 1768 | } | ||
| 1768 | 1769 | ||
| 1769 | if (c->bulk_read == 1) | 1770 | if (c->bulk_read == 1) |
| 1770 | bu_init(c); | 1771 | bu_init(c); |
| @@ -1774,10 +1775,11 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) | |||
| 1774 | c->bu.buf = NULL; | 1775 | c->bu.buf = NULL; |
| 1775 | } | 1776 | } |
| 1776 | 1777 | ||
| 1778 | ubifs_assert(c->lst.taken_empty_lebs == 1); | ||
| 1777 | return 0; | 1779 | return 0; |
| 1778 | } | 1780 | } |
| 1779 | 1781 | ||
| 1780 | struct super_operations ubifs_super_operations = { | 1782 | const struct super_operations ubifs_super_operations = { |
| 1781 | .alloc_inode = ubifs_alloc_inode, | 1783 | .alloc_inode = ubifs_alloc_inode, |
| 1782 | .destroy_inode = ubifs_destroy_inode, | 1784 | .destroy_inode = ubifs_destroy_inode, |
| 1783 | .put_super = ubifs_put_super, | 1785 | .put_super = ubifs_put_super, |
| @@ -2044,15 +2046,6 @@ out_close: | |||
| 2044 | 2046 | ||
| 2045 | static void ubifs_kill_sb(struct super_block *sb) | 2047 | static void ubifs_kill_sb(struct super_block *sb) |
| 2046 | { | 2048 | { |
| 2047 | struct ubifs_info *c = sb->s_fs_info; | ||
| 2048 | |||
| 2049 | /* | ||
| 2050 | * We do 'commit_on_unmount()' here instead of 'ubifs_put_super()' | ||
| 2051 | * in order to be outside BKL. | ||
| 2052 | */ | ||
| 2053 | if (sb->s_root) | ||
| 2054 | commit_on_unmount(c); | ||
| 2055 | /* The un-mount routine is actually done in put_super() */ | ||
| 2056 | generic_shutdown_super(sb); | 2049 | generic_shutdown_super(sb); |
| 2057 | } | 2050 | } |
| 2058 | 2051 | ||
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index f7e36f545527..fa28a84c6a1b 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c | |||
| @@ -443,6 +443,11 @@ static int tnc_read_node_nm(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
| 443 | * This function performs that same function as ubifs_read_node except that | 443 | * This function performs that same function as ubifs_read_node except that |
| 444 | * it does not require that there is actually a node present and instead | 444 | * it does not require that there is actually a node present and instead |
| 445 | * the return code indicates if a node was read. | 445 | * the return code indicates if a node was read. |
| 446 | * | ||
| 447 | * Note, this function does not check CRC of data nodes if @c->no_chk_data_crc | ||
| 448 | * is true (it is controlled by corresponding mount option). However, if | ||
| 449 | * @c->always_chk_crc is true, @c->no_chk_data_crc is ignored and CRC is always | ||
| 450 | * checked. | ||
| 446 | */ | 451 | */ |
| 447 | static int try_read_node(const struct ubifs_info *c, void *buf, int type, | 452 | static int try_read_node(const struct ubifs_info *c, void *buf, int type, |
| 448 | int len, int lnum, int offs) | 453 | int len, int lnum, int offs) |
| @@ -470,9 +475,8 @@ static int try_read_node(const struct ubifs_info *c, void *buf, int type, | |||
| 470 | if (node_len != len) | 475 | if (node_len != len) |
| 471 | return 0; | 476 | return 0; |
| 472 | 477 | ||
| 473 | if (type == UBIFS_DATA_NODE && !c->always_chk_crc) | 478 | if (type == UBIFS_DATA_NODE && !c->always_chk_crc && c->no_chk_data_crc) |
| 474 | if (c->no_chk_data_crc) | 479 | return 1; |
| 475 | return 0; | ||
| 476 | 480 | ||
| 477 | crc = crc32(UBIFS_CRC32_INIT, buf + 8, node_len - 8); | 481 | crc = crc32(UBIFS_CRC32_INIT, buf + 8, node_len - 8); |
| 478 | node_crc = le32_to_cpu(ch->crc); | 482 | node_crc = le32_to_cpu(ch->crc); |
| @@ -1506,7 +1510,7 @@ out: | |||
| 1506 | * | 1510 | * |
| 1507 | * Note, if the bulk-read buffer length (@bu->buf_len) is known, this function | 1511 | * Note, if the bulk-read buffer length (@bu->buf_len) is known, this function |
| 1508 | * makes sure bulk-read nodes fit the buffer. Otherwise, this function prepares | 1512 | * makes sure bulk-read nodes fit the buffer. Otherwise, this function prepares |
| 1509 | * maxumum possible amount of nodes for bulk-read. | 1513 | * maximum possible amount of nodes for bulk-read. |
| 1510 | */ | 1514 | */ |
| 1511 | int ubifs_tnc_get_bu_keys(struct ubifs_info *c, struct bu_info *bu) | 1515 | int ubifs_tnc_get_bu_keys(struct ubifs_info *c, struct bu_info *bu) |
| 1512 | { | 1516 | { |
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index fc2a4cc66d03..039a68bee29a 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
| @@ -426,9 +426,9 @@ struct ubifs_unclean_leb { | |||
| 426 | * LEB properties flags. | 426 | * LEB properties flags. |
| 427 | * | 427 | * |
| 428 | * LPROPS_UNCAT: not categorized | 428 | * LPROPS_UNCAT: not categorized |
| 429 | * LPROPS_DIRTY: dirty > 0, not index | 429 | * LPROPS_DIRTY: dirty > free, dirty >= @c->dead_wm, not index |
| 430 | * LPROPS_DIRTY_IDX: dirty + free > @c->min_idx_node_sze and index | 430 | * LPROPS_DIRTY_IDX: dirty + free > @c->min_idx_node_sze and index |
| 431 | * LPROPS_FREE: free > 0, not empty, not index | 431 | * LPROPS_FREE: free > 0, dirty < @c->dead_wm, not empty, not index |
| 432 | * LPROPS_HEAP_CNT: number of heaps used for storing categorized LEBs | 432 | * LPROPS_HEAP_CNT: number of heaps used for storing categorized LEBs |
| 433 | * LPROPS_EMPTY: LEB is empty, not taken | 433 | * LPROPS_EMPTY: LEB is empty, not taken |
| 434 | * LPROPS_FREEABLE: free + dirty == leb_size, not index, not taken | 434 | * LPROPS_FREEABLE: free + dirty == leb_size, not index, not taken |
| @@ -961,7 +961,6 @@ struct ubifs_debug_info; | |||
| 961 | * @cs_lock: commit state lock | 961 | * @cs_lock: commit state lock |
| 962 | * @cmt_wq: wait queue to sleep on if the log is full and a commit is running | 962 | * @cmt_wq: wait queue to sleep on if the log is full and a commit is running |
| 963 | * | 963 | * |
| 964 | * @fast_unmount: do not run journal commit before un-mounting | ||
| 965 | * @big_lpt: flag that LPT is too big to write whole during commit | 964 | * @big_lpt: flag that LPT is too big to write whole during commit |
| 966 | * @no_chk_data_crc: do not check CRCs when reading data nodes (except during | 965 | * @no_chk_data_crc: do not check CRCs when reading data nodes (except during |
| 967 | * recovery) | 966 | * recovery) |
| @@ -1202,7 +1201,6 @@ struct ubifs_info { | |||
| 1202 | spinlock_t cs_lock; | 1201 | spinlock_t cs_lock; |
| 1203 | wait_queue_head_t cmt_wq; | 1202 | wait_queue_head_t cmt_wq; |
| 1204 | 1203 | ||
| 1205 | unsigned int fast_unmount:1; | ||
| 1206 | unsigned int big_lpt:1; | 1204 | unsigned int big_lpt:1; |
| 1207 | unsigned int no_chk_data_crc:1; | 1205 | unsigned int no_chk_data_crc:1; |
| 1208 | unsigned int bulk_read:1; | 1206 | unsigned int bulk_read:1; |
| @@ -1405,13 +1403,13 @@ extern struct list_head ubifs_infos; | |||
| 1405 | extern spinlock_t ubifs_infos_lock; | 1403 | extern spinlock_t ubifs_infos_lock; |
| 1406 | extern atomic_long_t ubifs_clean_zn_cnt; | 1404 | extern atomic_long_t ubifs_clean_zn_cnt; |
| 1407 | extern struct kmem_cache *ubifs_inode_slab; | 1405 | extern struct kmem_cache *ubifs_inode_slab; |
| 1408 | extern struct super_operations ubifs_super_operations; | 1406 | extern const struct super_operations ubifs_super_operations; |
| 1409 | extern struct address_space_operations ubifs_file_address_operations; | 1407 | extern const struct address_space_operations ubifs_file_address_operations; |
| 1410 | extern struct file_operations ubifs_file_operations; | 1408 | extern const struct file_operations ubifs_file_operations; |
| 1411 | extern struct inode_operations ubifs_file_inode_operations; | 1409 | extern const struct inode_operations ubifs_file_inode_operations; |
| 1412 | extern struct file_operations ubifs_dir_operations; | 1410 | extern const struct file_operations ubifs_dir_operations; |
| 1413 | extern struct inode_operations ubifs_dir_inode_operations; | 1411 | extern const struct inode_operations ubifs_dir_inode_operations; |
| 1414 | extern struct inode_operations ubifs_symlink_inode_operations; | 1412 | extern const struct inode_operations ubifs_symlink_inode_operations; |
| 1415 | extern struct backing_dev_info ubifs_backing_dev_info; | 1413 | extern struct backing_dev_info ubifs_backing_dev_info; |
| 1416 | extern struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT]; | 1414 | extern struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT]; |
| 1417 | 1415 | ||
| @@ -1428,7 +1426,7 @@ int ubifs_read_node_wbuf(struct ubifs_wbuf *wbuf, void *buf, int type, int len, | |||
| 1428 | int ubifs_write_node(struct ubifs_info *c, void *node, int len, int lnum, | 1426 | int ubifs_write_node(struct ubifs_info *c, void *node, int len, int lnum, |
| 1429 | int offs, int dtype); | 1427 | int offs, int dtype); |
| 1430 | int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, | 1428 | int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, |
| 1431 | int offs, int quiet, int chk_crc); | 1429 | int offs, int quiet, int must_chk_crc); |
| 1432 | void ubifs_prepare_node(struct ubifs_info *c, void *buf, int len, int pad); | 1430 | void ubifs_prepare_node(struct ubifs_info *c, void *buf, int len, int pad); |
| 1433 | void ubifs_prep_grp_node(struct ubifs_info *c, void *node, int len, int last); | 1431 | void ubifs_prep_grp_node(struct ubifs_info *c, void *node, int len, int last); |
| 1434 | int ubifs_io_init(struct ubifs_info *c); | 1432 | int ubifs_io_init(struct ubifs_info *c); |
| @@ -1495,6 +1493,7 @@ void ubifs_release_ino_dirty(struct ubifs_info *c, struct inode *inode, | |||
| 1495 | void ubifs_cancel_ino_op(struct ubifs_info *c, struct inode *inode, | 1493 | void ubifs_cancel_ino_op(struct ubifs_info *c, struct inode *inode, |
| 1496 | struct ubifs_budget_req *req); | 1494 | struct ubifs_budget_req *req); |
| 1497 | long long ubifs_get_free_space(struct ubifs_info *c); | 1495 | long long ubifs_get_free_space(struct ubifs_info *c); |
| 1496 | long long ubifs_get_free_space_nolock(struct ubifs_info *c); | ||
| 1498 | int ubifs_calc_min_idx_lebs(struct ubifs_info *c); | 1497 | int ubifs_calc_min_idx_lebs(struct ubifs_info *c); |
| 1499 | void ubifs_convert_page_budget(struct ubifs_info *c); | 1498 | void ubifs_convert_page_budget(struct ubifs_info *c); |
| 1500 | long long ubifs_reported_space(const struct ubifs_info *c, long long free); | 1499 | long long ubifs_reported_space(const struct ubifs_info *c, long long free); |
| @@ -1603,6 +1602,7 @@ void ubifs_delete_orphan(struct ubifs_info *c, ino_t inum); | |||
| 1603 | int ubifs_orphan_start_commit(struct ubifs_info *c); | 1602 | int ubifs_orphan_start_commit(struct ubifs_info *c); |
| 1604 | int ubifs_orphan_end_commit(struct ubifs_info *c); | 1603 | int ubifs_orphan_end_commit(struct ubifs_info *c); |
| 1605 | int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only); | 1604 | int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only); |
| 1605 | int ubifs_clear_orphans(struct ubifs_info *c); | ||
| 1606 | 1606 | ||
| 1607 | /* lpt.c */ | 1607 | /* lpt.c */ |
| 1608 | int ubifs_calc_lpt_geom(struct ubifs_info *c); | 1608 | int ubifs_calc_lpt_geom(struct ubifs_info *c); |
| @@ -1646,7 +1646,7 @@ const struct ubifs_lprops *ubifs_change_lp(struct ubifs_info *c, | |||
| 1646 | const struct ubifs_lprops *lp, | 1646 | const struct ubifs_lprops *lp, |
| 1647 | int free, int dirty, int flags, | 1647 | int free, int dirty, int flags, |
| 1648 | int idx_gc_cnt); | 1648 | int idx_gc_cnt); |
| 1649 | void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *stats); | 1649 | void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *lst); |
| 1650 | void ubifs_add_to_cat(struct ubifs_info *c, struct ubifs_lprops *lprops, | 1650 | void ubifs_add_to_cat(struct ubifs_info *c, struct ubifs_lprops *lprops, |
| 1651 | int cat); | 1651 | int cat); |
| 1652 | void ubifs_replace_cat(struct ubifs_info *c, struct ubifs_lprops *old_lprops, | 1652 | void ubifs_replace_cat(struct ubifs_info *c, struct ubifs_lprops *old_lprops, |
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index 2ed035354c26..a608e72fa405 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
| @@ -371,7 +371,11 @@ xfs_quiesce_attr( | |||
| 371 | /* flush inodes and push all remaining buffers out to disk */ | 371 | /* flush inodes and push all remaining buffers out to disk */ |
| 372 | xfs_quiesce_fs(mp); | 372 | xfs_quiesce_fs(mp); |
| 373 | 373 | ||
| 374 | ASSERT_ALWAYS(atomic_read(&mp->m_active_trans) == 0); | 374 | /* |
| 375 | * Just warn here till VFS can correctly support | ||
| 376 | * read-only remount without racing. | ||
| 377 | */ | ||
| 378 | WARN_ON(atomic_read(&mp->m_active_trans) != 0); | ||
| 375 | 379 | ||
| 376 | /* Push the superblock and write an unmount record */ | 380 | /* Push the superblock and write an unmount record */ |
| 377 | error = xfs_log_sbcount(mp, 1); | 381 | error = xfs_log_sbcount(mp, 1); |
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c index b4c1ee713492..f8278cfcc1d3 100644 --- a/fs/xfs/xfs_dfrag.c +++ b/fs/xfs/xfs_dfrag.c | |||
| @@ -55,17 +55,11 @@ xfs_swapext( | |||
| 55 | struct file *file, *target_file; | 55 | struct file *file, *target_file; |
| 56 | int error = 0; | 56 | int error = 0; |
| 57 | 57 | ||
| 58 | sxp = kmem_alloc(sizeof(xfs_swapext_t), KM_MAYFAIL); | ||
| 59 | if (!sxp) { | ||
| 60 | error = XFS_ERROR(ENOMEM); | ||
| 61 | goto out; | ||
| 62 | } | ||
| 63 | |||
| 64 | /* Pull information for the target fd */ | 58 | /* Pull information for the target fd */ |
| 65 | file = fget((int)sxp->sx_fdtarget); | 59 | file = fget((int)sxp->sx_fdtarget); |
| 66 | if (!file) { | 60 | if (!file) { |
| 67 | error = XFS_ERROR(EINVAL); | 61 | error = XFS_ERROR(EINVAL); |
| 68 | goto out_free_sxp; | 62 | goto out; |
| 69 | } | 63 | } |
| 70 | 64 | ||
| 71 | if (!(file->f_mode & FMODE_WRITE) || (file->f_flags & O_APPEND)) { | 65 | if (!(file->f_mode & FMODE_WRITE) || (file->f_flags & O_APPEND)) { |
| @@ -109,8 +103,6 @@ xfs_swapext( | |||
| 109 | fput(target_file); | 103 | fput(target_file); |
| 110 | out_put_file: | 104 | out_put_file: |
| 111 | fput(file); | 105 | fput(file); |
| 112 | out_free_sxp: | ||
| 113 | kmem_free(sxp); | ||
| 114 | out: | 106 | out: |
| 115 | return error; | 107 | return error; |
| 116 | } | 108 | } |
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 35cca98bd94c..b1047de2fffd 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
| @@ -70,16 +70,21 @@ STATIC void xlog_recover_check_summary(xlog_t *); | |||
| 70 | xfs_buf_t * | 70 | xfs_buf_t * |
| 71 | xlog_get_bp( | 71 | xlog_get_bp( |
| 72 | xlog_t *log, | 72 | xlog_t *log, |
| 73 | int num_bblks) | 73 | int nbblks) |
| 74 | { | 74 | { |
| 75 | ASSERT(num_bblks > 0); | 75 | if (nbblks <= 0 || nbblks > log->l_logBBsize) { |
| 76 | xlog_warn("XFS: Invalid block length (0x%x) given for buffer", nbblks); | ||
| 77 | XFS_ERROR_REPORT("xlog_get_bp(1)", | ||
| 78 | XFS_ERRLEVEL_HIGH, log->l_mp); | ||
| 79 | return NULL; | ||
| 80 | } | ||
| 76 | 81 | ||
| 77 | if (log->l_sectbb_log) { | 82 | if (log->l_sectbb_log) { |
| 78 | if (num_bblks > 1) | 83 | if (nbblks > 1) |
| 79 | num_bblks += XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1); | 84 | nbblks += XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1); |
| 80 | num_bblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, num_bblks); | 85 | nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks); |
| 81 | } | 86 | } |
| 82 | return xfs_buf_get_noaddr(BBTOB(num_bblks), log->l_mp->m_logdev_targp); | 87 | return xfs_buf_get_noaddr(BBTOB(nbblks), log->l_mp->m_logdev_targp); |
| 83 | } | 88 | } |
| 84 | 89 | ||
| 85 | void | 90 | void |
| @@ -102,6 +107,13 @@ xlog_bread( | |||
| 102 | { | 107 | { |
| 103 | int error; | 108 | int error; |
| 104 | 109 | ||
| 110 | if (nbblks <= 0 || nbblks > log->l_logBBsize) { | ||
| 111 | xlog_warn("XFS: Invalid block length (0x%x) given for buffer", nbblks); | ||
| 112 | XFS_ERROR_REPORT("xlog_bread(1)", | ||
| 113 | XFS_ERRLEVEL_HIGH, log->l_mp); | ||
| 114 | return EFSCORRUPTED; | ||
| 115 | } | ||
| 116 | |||
| 105 | if (log->l_sectbb_log) { | 117 | if (log->l_sectbb_log) { |
| 106 | blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no); | 118 | blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no); |
| 107 | nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks); | 119 | nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks); |
| @@ -139,6 +151,13 @@ xlog_bwrite( | |||
| 139 | { | 151 | { |
| 140 | int error; | 152 | int error; |
| 141 | 153 | ||
| 154 | if (nbblks <= 0 || nbblks > log->l_logBBsize) { | ||
| 155 | xlog_warn("XFS: Invalid block length (0x%x) given for buffer", nbblks); | ||
| 156 | XFS_ERROR_REPORT("xlog_bwrite(1)", | ||
| 157 | XFS_ERRLEVEL_HIGH, log->l_mp); | ||
| 158 | return EFSCORRUPTED; | ||
| 159 | } | ||
| 160 | |||
| 142 | if (log->l_sectbb_log) { | 161 | if (log->l_sectbb_log) { |
| 143 | blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no); | 162 | blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no); |
| 144 | nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks); | 163 | nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks); |
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 2124c063a7ef..b97cdc516a8f 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
| @@ -90,7 +90,6 @@ header-y += if_ppp.h | |||
| 90 | header-y += if_slip.h | 90 | header-y += if_slip.h |
| 91 | header-y += if_strip.h | 91 | header-y += if_strip.h |
| 92 | header-y += if_tun.h | 92 | header-y += if_tun.h |
| 93 | header-y += if_tunnel.h | ||
| 94 | header-y += in_route.h | 93 | header-y += in_route.h |
| 95 | header-y += ioctl.h | 94 | header-y += ioctl.h |
| 96 | header-y += ip6_tunnel.h | 95 | header-y += ip6_tunnel.h |
| @@ -236,6 +235,7 @@ unifdef-y += if_phonet.h | |||
| 236 | unifdef-y += if_pppol2tp.h | 235 | unifdef-y += if_pppol2tp.h |
| 237 | unifdef-y += if_pppox.h | 236 | unifdef-y += if_pppox.h |
| 238 | unifdef-y += if_tr.h | 237 | unifdef-y += if_tr.h |
| 238 | unifdef-y += if_tunnel.h | ||
| 239 | unifdef-y += if_vlan.h | 239 | unifdef-y += if_vlan.h |
| 240 | unifdef-y += igmp.h | 240 | unifdef-y += igmp.h |
| 241 | unifdef-y += inet_diag.h | 241 | unifdef-y += inet_diag.h |
diff --git a/include/linux/ata.h b/include/linux/ata.h index a53318b8cbd0..08a86d5cdf1b 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
| @@ -731,12 +731,17 @@ static inline int ata_id_current_chs_valid(const u16 *id) | |||
| 731 | 731 | ||
| 732 | static inline int ata_id_is_cfa(const u16 *id) | 732 | static inline int ata_id_is_cfa(const u16 *id) |
| 733 | { | 733 | { |
| 734 | if (id[ATA_ID_CONFIG] == 0x848A) /* Standard CF */ | 734 | if (id[ATA_ID_CONFIG] == 0x848A) /* Traditional CF */ |
| 735 | return 1; | 735 | return 1; |
| 736 | /* Could be CF hiding as standard ATA */ | 736 | /* |
| 737 | if (ata_id_major_version(id) >= 3 && | 737 | * CF specs don't require specific value in the word 0 anymore and yet |
| 738 | id[ATA_ID_COMMAND_SET_1] != 0xFFFF && | 738 | * they forbid to report the ATA version in the word 80 and require the |
| 739 | (id[ATA_ID_COMMAND_SET_1] & (1 << 2))) | 739 | * CFA feature set support to be indicated in the word 83 in this case. |
| 740 | * Unfortunately, some cards only follow either of this requirements, | ||
| 741 | * and while those that don't indicate CFA feature support need some | ||
| 742 | * sort of quirk list, it seems impractical for the ones that do... | ||
| 743 | */ | ||
| 744 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC004) == 0x4004) | ||
| 740 | return 1; | 745 | return 1; |
| 741 | return 0; | 746 | return 0; |
| 742 | } | 747 | } |
diff --git a/include/linux/fb.h b/include/linux/fb.h index 818fe21257e8..31527e17076b 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
| @@ -960,6 +960,21 @@ extern struct fb_info *registered_fb[FB_MAX]; | |||
| 960 | extern int num_registered_fb; | 960 | extern int num_registered_fb; |
| 961 | extern struct class *fb_class; | 961 | extern struct class *fb_class; |
| 962 | 962 | ||
| 963 | static inline int lock_fb_info(struct fb_info *info) | ||
| 964 | { | ||
| 965 | mutex_lock(&info->lock); | ||
| 966 | if (!info->fbops) { | ||
| 967 | mutex_unlock(&info->lock); | ||
| 968 | return 0; | ||
| 969 | } | ||
| 970 | return 1; | ||
| 971 | } | ||
| 972 | |||
| 973 | static inline void unlock_fb_info(struct fb_info *info) | ||
| 974 | { | ||
| 975 | mutex_unlock(&info->lock); | ||
| 976 | } | ||
| 977 | |||
| 963 | static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, | 978 | static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, |
| 964 | u8 *src, u32 s_pitch, u32 height) | 979 | u8 *src, u32 s_pitch, u32 height) |
| 965 | { | 980 | { |
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h index aeab2cb32a9c..82c43624c067 100644 --- a/include/linux/if_tunnel.h +++ b/include/linux/if_tunnel.h | |||
| @@ -2,7 +2,10 @@ | |||
| 2 | #define _IF_TUNNEL_H_ | 2 | #define _IF_TUNNEL_H_ |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | |||
| 6 | #ifdef __KERNEL__ | ||
| 5 | #include <linux/ip.h> | 7 | #include <linux/ip.h> |
| 8 | #endif | ||
| 6 | 9 | ||
| 7 | #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) | 10 | #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) |
| 8 | #define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) | 11 | #define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 343df9ef2412..7fa371898e3e 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -480,7 +480,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
| 480 | /* | 480 | /* |
| 481 | * swap - swap value of @a and @b | 481 | * swap - swap value of @a and @b |
| 482 | */ | 482 | */ |
| 483 | #define swap(a, b) ({ typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; }) | 483 | #define swap(a, b) \ |
| 484 | do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) | ||
| 484 | 485 | ||
| 485 | /** | 486 | /** |
| 486 | * container_of - cast a member of a structure out to the containing structure | 487 | * container_of - cast a member of a structure out to the containing structure |
diff --git a/include/linux/libata.h b/include/linux/libata.h index bca3ba25f52a..5d87bc09a1f5 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -380,6 +380,7 @@ enum { | |||
| 380 | ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands | 380 | ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands |
| 381 | not multiple of 16 bytes */ | 381 | not multiple of 16 bytes */ |
| 382 | ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firwmare update warning */ | 382 | ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firwmare update warning */ |
| 383 | ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */ | ||
| 383 | 384 | ||
| 384 | /* DMA mask for user DMA control: User visible values; DO NOT | 385 | /* DMA mask for user DMA control: User visible values; DO NOT |
| 385 | renumber */ | 386 | renumber */ |
| @@ -580,7 +581,7 @@ struct ata_device { | |||
| 580 | acpi_handle acpi_handle; | 581 | acpi_handle acpi_handle; |
| 581 | union acpi_object *gtf_cache; | 582 | union acpi_object *gtf_cache; |
| 582 | #endif | 583 | #endif |
| 583 | /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ | 584 | /* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */ |
| 584 | u64 n_sectors; /* size of device, if ATA */ | 585 | u64 n_sectors; /* size of device, if ATA */ |
| 585 | unsigned int class; /* ATA_DEV_xxx */ | 586 | unsigned int class; /* ATA_DEV_xxx */ |
| 586 | unsigned long unpark_deadline; | 587 | unsigned long unpark_deadline; |
| @@ -605,20 +606,22 @@ struct ata_device { | |||
| 605 | u16 heads; /* Number of heads */ | 606 | u16 heads; /* Number of heads */ |
| 606 | u16 sectors; /* Number of sectors per track */ | 607 | u16 sectors; /* Number of sectors per track */ |
| 607 | 608 | ||
| 608 | /* error history */ | ||
| 609 | int spdn_cnt; | ||
| 610 | struct ata_ering ering; | ||
| 611 | |||
| 612 | union { | 609 | union { |
| 613 | u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */ | 610 | u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */ |
| 614 | u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */ | 611 | u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */ |
| 615 | }; | 612 | }; |
| 613 | |||
| 614 | /* error history */ | ||
| 615 | int spdn_cnt; | ||
| 616 | /* ering is CLEAR_END, read comment above CLEAR_END */ | ||
| 617 | struct ata_ering ering; | ||
| 616 | }; | 618 | }; |
| 617 | 619 | ||
| 618 | /* Offset into struct ata_device. Fields above it are maintained | 620 | /* Fields between ATA_DEVICE_CLEAR_BEGIN and ATA_DEVICE_CLEAR_END are |
| 619 | * acress device init. Fields below are zeroed. | 621 | * cleared to zero on ata_dev_init(). |
| 620 | */ | 622 | */ |
| 621 | #define ATA_DEVICE_CLEAR_OFFSET offsetof(struct ata_device, n_sectors) | 623 | #define ATA_DEVICE_CLEAR_BEGIN offsetof(struct ata_device, n_sectors) |
| 624 | #define ATA_DEVICE_CLEAR_END offsetof(struct ata_device, ering) | ||
| 622 | 625 | ||
| 623 | struct ata_eh_info { | 626 | struct ata_eh_info { |
| 624 | struct ata_device *dev; /* offending device */ | 627 | struct ata_device *dev; /* offending device */ |
diff --git a/include/linux/wait.h b/include/linux/wait.h index ef609f842fac..a210ede73b56 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
| @@ -132,6 +132,8 @@ static inline void __remove_wait_queue(wait_queue_head_t *head, | |||
| 132 | list_del(&old->task_list); | 132 | list_del(&old->task_list); |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | void __wake_up_common(wait_queue_head_t *q, unsigned int mode, | ||
| 136 | int nr_exclusive, int sync, void *key); | ||
| 135 | void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); | 137 | void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); |
| 136 | extern void __wake_up_locked(wait_queue_head_t *q, unsigned int mode); | 138 | extern void __wake_up_locked(wait_queue_head_t *q, unsigned int mode); |
| 137 | extern void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); | 139 | extern void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); |
| @@ -333,16 +335,19 @@ do { \ | |||
| 333 | for (;;) { \ | 335 | for (;;) { \ |
| 334 | prepare_to_wait_exclusive(&wq, &__wait, \ | 336 | prepare_to_wait_exclusive(&wq, &__wait, \ |
| 335 | TASK_INTERRUPTIBLE); \ | 337 | TASK_INTERRUPTIBLE); \ |
| 336 | if (condition) \ | 338 | if (condition) { \ |
| 339 | finish_wait(&wq, &__wait); \ | ||
| 337 | break; \ | 340 | break; \ |
| 341 | } \ | ||
| 338 | if (!signal_pending(current)) { \ | 342 | if (!signal_pending(current)) { \ |
| 339 | schedule(); \ | 343 | schedule(); \ |
| 340 | continue; \ | 344 | continue; \ |
| 341 | } \ | 345 | } \ |
| 342 | ret = -ERESTARTSYS; \ | 346 | ret = -ERESTARTSYS; \ |
| 347 | abort_exclusive_wait(&wq, &__wait, \ | ||
| 348 | TASK_INTERRUPTIBLE, NULL); \ | ||
| 343 | break; \ | 349 | break; \ |
| 344 | } \ | 350 | } \ |
| 345 | finish_wait(&wq, &__wait); \ | ||
| 346 | } while (0) | 351 | } while (0) |
| 347 | 352 | ||
| 348 | #define wait_event_interruptible_exclusive(wq, condition) \ | 353 | #define wait_event_interruptible_exclusive(wq, condition) \ |
| @@ -431,6 +436,8 @@ extern long interruptible_sleep_on_timeout(wait_queue_head_t *q, | |||
| 431 | void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state); | 436 | void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state); |
| 432 | void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state); | 437 | void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state); |
| 433 | void finish_wait(wait_queue_head_t *q, wait_queue_t *wait); | 438 | void finish_wait(wait_queue_head_t *q, wait_queue_t *wait); |
| 439 | void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait, | ||
| 440 | unsigned int mode, void *key); | ||
| 434 | int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); | 441 | int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); |
| 435 | int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); | 442 | int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); |
| 436 | 443 | ||
diff --git a/include/video/aty128.h b/include/video/aty128.h index 7079beb005e8..51ac69f05bdc 100644 --- a/include/video/aty128.h +++ b/include/video/aty128.h | |||
| @@ -21,9 +21,9 @@ | |||
| 21 | #define I2C_CNTL_1 0x0094 | 21 | #define I2C_CNTL_1 0x0094 |
| 22 | #define PALETTE_INDEX 0x00b0 | 22 | #define PALETTE_INDEX 0x00b0 |
| 23 | #define PALETTE_DATA 0x00b4 | 23 | #define PALETTE_DATA 0x00b4 |
| 24 | #define CONFIG_CNTL 0x00e0 | 24 | #define CNFG_CNTL 0x00e0 |
| 25 | #define GEN_RESET_CNTL 0x00f0 | 25 | #define GEN_RESET_CNTL 0x00f0 |
| 26 | #define CONFIG_MEMSIZE 0x00f8 | 26 | #define CNFG_MEMSIZE 0x00f8 |
| 27 | #define MEM_CNTL 0x0140 | 27 | #define MEM_CNTL 0x0140 |
| 28 | #define MEM_POWER_MISC 0x015c | 28 | #define MEM_POWER_MISC 0x015c |
| 29 | #define AGP_BASE 0x0170 | 29 | #define AGP_BASE 0x0170 |
diff --git a/include/video/mach64.h b/include/video/mach64.h index a8332e528ec1..89e91c0cb737 100644 --- a/include/video/mach64.h +++ b/include/video/mach64.h | |||
| @@ -103,7 +103,7 @@ | |||
| 103 | #define CUR_HORZ_VERT_OFF 0x0070 /* Dword offset 0_1C */ | 103 | #define CUR_HORZ_VERT_OFF 0x0070 /* Dword offset 0_1C */ |
| 104 | #define CUR2_HORZ_VERT_OFF 0x0070 /* Dword offset 0_1C */ | 104 | #define CUR2_HORZ_VERT_OFF 0x0070 /* Dword offset 0_1C */ |
| 105 | 105 | ||
| 106 | #define CONFIG_PANEL_LG 0x0074 /* Dword offset 0_1D (LG) */ | 106 | #define CNFG_PANEL_LG 0x0074 /* Dword offset 0_1D (LG) */ |
| 107 | 107 | ||
| 108 | /* General I/O Control */ | 108 | /* General I/O Control */ |
| 109 | #define GP_IO 0x0078 /* Dword offset 0_1E */ | 109 | #define GP_IO 0x0078 /* Dword offset 0_1E */ |
| @@ -146,8 +146,8 @@ | |||
| 146 | #define CLOCK_SEL_CNTL 0x0090 /* Dword offset 0_24 */ | 146 | #define CLOCK_SEL_CNTL 0x0090 /* Dword offset 0_24 */ |
| 147 | 147 | ||
| 148 | /* Configuration */ | 148 | /* Configuration */ |
| 149 | #define CONFIG_STAT1 0x0094 /* Dword offset 0_25 */ | 149 | #define CNFG_STAT1 0x0094 /* Dword offset 0_25 */ |
| 150 | #define CONFIG_STAT2 0x0098 /* Dword offset 0_26 */ | 150 | #define CNFG_STAT2 0x0098 /* Dword offset 0_26 */ |
| 151 | 151 | ||
| 152 | /* Bus Control */ | 152 | /* Bus Control */ |
| 153 | #define BUS_CNTL 0x00A0 /* Dword offset 0_28 */ | 153 | #define BUS_CNTL 0x00A0 /* Dword offset 0_28 */ |
| @@ -190,9 +190,9 @@ | |||
| 190 | #define POWER_MANAGEMENT_LG 0x00D8 /* Dword offset 0_36 (LG) */ | 190 | #define POWER_MANAGEMENT_LG 0x00D8 /* Dword offset 0_36 (LG) */ |
| 191 | 191 | ||
| 192 | /* Configuration */ | 192 | /* Configuration */ |
| 193 | #define CONFIG_CNTL 0x00DC /* Dword offset 0_37 (CT, ET, VT) */ | 193 | #define CNFG_CNTL 0x00DC /* Dword offset 0_37 (CT, ET, VT) */ |
| 194 | #define CONFIG_CHIP_ID 0x00E0 /* Dword offset 0_38 */ | 194 | #define CNFG_CHIP_ID 0x00E0 /* Dword offset 0_38 */ |
| 195 | #define CONFIG_STAT0 0x00E4 /* Dword offset 0_39 */ | 195 | #define CNFG_STAT0 0x00E4 /* Dword offset 0_39 */ |
| 196 | 196 | ||
| 197 | /* Test and Debug */ | 197 | /* Test and Debug */ |
| 198 | #define CRC_SIG 0x00E8 /* Dword offset 0_3A */ | 198 | #define CRC_SIG 0x00E8 /* Dword offset 0_3A */ |
| @@ -851,17 +851,17 @@ | |||
| 851 | #define PLL_YCLK_CNTL 0x29 | 851 | #define PLL_YCLK_CNTL 0x29 |
| 852 | #define PM_DYN_CLK_CNTL 0x2A | 852 | #define PM_DYN_CLK_CNTL 0x2A |
| 853 | 853 | ||
| 854 | /* CONFIG_CNTL register constants */ | 854 | /* CNFG_CNTL register constants */ |
| 855 | #define APERTURE_4M_ENABLE 1 | 855 | #define APERTURE_4M_ENABLE 1 |
| 856 | #define APERTURE_8M_ENABLE 2 | 856 | #define APERTURE_8M_ENABLE 2 |
| 857 | #define VGA_APERTURE_ENABLE 4 | 857 | #define VGA_APERTURE_ENABLE 4 |
| 858 | 858 | ||
| 859 | /* CONFIG_STAT0 register constants (GX, CX) */ | 859 | /* CNFG_STAT0 register constants (GX, CX) */ |
| 860 | #define CFG_BUS_TYPE 0x00000007 | 860 | #define CFG_BUS_TYPE 0x00000007 |
| 861 | #define CFG_MEM_TYPE 0x00000038 | 861 | #define CFG_MEM_TYPE 0x00000038 |
| 862 | #define CFG_INIT_DAC_TYPE 0x00000e00 | 862 | #define CFG_INIT_DAC_TYPE 0x00000e00 |
| 863 | 863 | ||
| 864 | /* CONFIG_STAT0 register constants (CT, ET, VT) */ | 864 | /* CNFG_STAT0 register constants (CT, ET, VT) */ |
| 865 | #define CFG_MEM_TYPE_xT 0x00000007 | 865 | #define CFG_MEM_TYPE_xT 0x00000007 |
| 866 | 866 | ||
| 867 | #define ISA 0 | 867 | #define ISA 0 |
| @@ -942,7 +942,7 @@ | |||
| 942 | #define PCI_ATI_VENDOR_ID 0x1002 | 942 | #define PCI_ATI_VENDOR_ID 0x1002 |
| 943 | 943 | ||
| 944 | 944 | ||
| 945 | /* CONFIG_CHIP_ID register constants */ | 945 | /* CNFG_CHIP_ID register constants */ |
| 946 | #define CFG_CHIP_TYPE 0x0000FFFF | 946 | #define CFG_CHIP_TYPE 0x0000FFFF |
| 947 | #define CFG_CHIP_CLASS 0x00FF0000 | 947 | #define CFG_CHIP_CLASS 0x00FF0000 |
| 948 | #define CFG_CHIP_REV 0xFF000000 | 948 | #define CFG_CHIP_REV 0xFF000000 |
| @@ -951,7 +951,7 @@ | |||
| 951 | #define CFG_CHIP_MINOR 0xC0000000 | 951 | #define CFG_CHIP_MINOR 0xC0000000 |
| 952 | 952 | ||
| 953 | 953 | ||
| 954 | /* Chip IDs read from CONFIG_CHIP_ID */ | 954 | /* Chip IDs read from CNFG_CHIP_ID */ |
| 955 | 955 | ||
| 956 | /* mach64GX family */ | 956 | /* mach64GX family */ |
| 957 | #define GX_CHIP_ID 0xD7 /* mach64GX (ATI888GX00) */ | 957 | #define GX_CHIP_ID 0xD7 /* mach64GX (ATI888GX00) */ |
| @@ -1254,7 +1254,7 @@ | |||
| 1254 | #define CRTC2_DISPLAY_DIS 0x00000400 | 1254 | #define CRTC2_DISPLAY_DIS 0x00000400 |
| 1255 | 1255 | ||
| 1256 | /* LCD register indices */ | 1256 | /* LCD register indices */ |
| 1257 | #define CONFIG_PANEL 0x00 | 1257 | #define CNFG_PANEL 0x00 |
| 1258 | #define LCD_GEN_CNTL 0x01 | 1258 | #define LCD_GEN_CNTL 0x01 |
| 1259 | #define DSTN_CONTROL 0x02 | 1259 | #define DSTN_CONTROL 0x02 |
| 1260 | #define HFB_PITCH_ADDR 0x03 | 1260 | #define HFB_PITCH_ADDR 0x03 |
diff --git a/include/video/radeon.h b/include/video/radeon.h index 1cd09cc5b169..e072b16b39ab 100644 --- a/include/video/radeon.h +++ b/include/video/radeon.h | |||
| @@ -11,13 +11,13 @@ | |||
| 11 | #define HI_STAT 0x004C | 11 | #define HI_STAT 0x004C |
| 12 | #define BUS_CNTL1 0x0034 | 12 | #define BUS_CNTL1 0x0034 |
| 13 | #define I2C_CNTL_1 0x0094 | 13 | #define I2C_CNTL_1 0x0094 |
| 14 | #define CONFIG_CNTL 0x00E0 | 14 | #define CNFG_CNTL 0x00E0 |
| 15 | #define CONFIG_MEMSIZE 0x00F8 | 15 | #define CNFG_MEMSIZE 0x00F8 |
| 16 | #define CONFIG_APER_0_BASE 0x0100 | 16 | #define CNFG_APER_0_BASE 0x0100 |
| 17 | #define CONFIG_APER_1_BASE 0x0104 | 17 | #define CNFG_APER_1_BASE 0x0104 |
| 18 | #define CONFIG_APER_SIZE 0x0108 | 18 | #define CNFG_APER_SIZE 0x0108 |
| 19 | #define CONFIG_REG_1_BASE 0x010C | 19 | #define CNFG_REG_1_BASE 0x010C |
| 20 | #define CONFIG_REG_APER_SIZE 0x0110 | 20 | #define CNFG_REG_APER_SIZE 0x0110 |
| 21 | #define PAD_AGPINPUT_DELAY 0x0164 | 21 | #define PAD_AGPINPUT_DELAY 0x0164 |
| 22 | #define PAD_CTLR_STRENGTH 0x0168 | 22 | #define PAD_CTLR_STRENGTH 0x0168 |
| 23 | #define PAD_CTLR_UPDATE 0x016C | 23 | #define PAD_CTLR_UPDATE 0x016C |
| @@ -509,7 +509,7 @@ | |||
| 509 | /* CLOCK_CNTL_INDEX bit constants */ | 509 | /* CLOCK_CNTL_INDEX bit constants */ |
| 510 | #define PLL_WR_EN 0x00000080 | 510 | #define PLL_WR_EN 0x00000080 |
| 511 | 511 | ||
| 512 | /* CONFIG_CNTL bit constants */ | 512 | /* CNFG_CNTL bit constants */ |
| 513 | #define CFG_VGA_RAM_EN 0x00000100 | 513 | #define CFG_VGA_RAM_EN 0x00000100 |
| 514 | #define CFG_ATI_REV_ID_MASK (0xf << 16) | 514 | #define CFG_ATI_REV_ID_MASK (0xf << 16) |
| 515 | #define CFG_ATI_REV_A11 (0 << 16) | 515 | #define CFG_ATI_REV_A11 (0 << 16) |
| @@ -980,7 +980,7 @@ | |||
| 980 | 980 | ||
| 981 | /* masks */ | 981 | /* masks */ |
| 982 | 982 | ||
| 983 | #define CONFIG_MEMSIZE_MASK 0x1f000000 | 983 | #define CNFG_MEMSIZE_MASK 0x1f000000 |
| 984 | #define MEM_CFG_TYPE 0x40000000 | 984 | #define MEM_CFG_TYPE 0x40000000 |
| 985 | #define DST_OFFSET_MASK 0x003fffff | 985 | #define DST_OFFSET_MASK 0x003fffff |
| 986 | #define DST_PITCH_MASK 0x3fc00000 | 986 | #define DST_PITCH_MASK 0x3fc00000 |
| @@ -565,11 +565,15 @@ static void shm_get_stat(struct ipc_namespace *ns, unsigned long *rss, | |||
| 565 | struct hstate *h = hstate_file(shp->shm_file); | 565 | struct hstate *h = hstate_file(shp->shm_file); |
| 566 | *rss += pages_per_huge_page(h) * mapping->nrpages; | 566 | *rss += pages_per_huge_page(h) * mapping->nrpages; |
| 567 | } else { | 567 | } else { |
| 568 | #ifdef CONFIG_SHMEM | ||
| 568 | struct shmem_inode_info *info = SHMEM_I(inode); | 569 | struct shmem_inode_info *info = SHMEM_I(inode); |
| 569 | spin_lock(&info->lock); | 570 | spin_lock(&info->lock); |
| 570 | *rss += inode->i_mapping->nrpages; | 571 | *rss += inode->i_mapping->nrpages; |
| 571 | *swp += info->swapped; | 572 | *swp += info->swapped; |
| 572 | spin_unlock(&info->lock); | 573 | spin_unlock(&info->lock); |
| 574 | #else | ||
| 575 | *rss += inode->i_mapping->nrpages; | ||
| 576 | #endif | ||
| 573 | } | 577 | } |
| 574 | 578 | ||
| 575 | total++; | 579 | total++; |
diff --git a/kernel/async.c b/kernel/async.c index 608b32b42812..67a2be71f517 100644 --- a/kernel/async.c +++ b/kernel/async.c | |||
| @@ -138,15 +138,18 @@ static void run_one_entry(void) | |||
| 138 | 138 | ||
| 139 | /* 3) run it (and print duration)*/ | 139 | /* 3) run it (and print duration)*/ |
| 140 | if (initcall_debug && system_state == SYSTEM_BOOTING) { | 140 | if (initcall_debug && system_state == SYSTEM_BOOTING) { |
| 141 | printk("calling %lli_%pF @ %i\n", entry->cookie, entry->func, task_pid_nr(current)); | 141 | printk("calling %lli_%pF @ %i\n", (long long)entry->cookie, |
| 142 | entry->func, task_pid_nr(current)); | ||
| 142 | calltime = ktime_get(); | 143 | calltime = ktime_get(); |
| 143 | } | 144 | } |
| 144 | entry->func(entry->data, entry->cookie); | 145 | entry->func(entry->data, entry->cookie); |
| 145 | if (initcall_debug && system_state == SYSTEM_BOOTING) { | 146 | if (initcall_debug && system_state == SYSTEM_BOOTING) { |
| 146 | rettime = ktime_get(); | 147 | rettime = ktime_get(); |
| 147 | delta = ktime_sub(rettime, calltime); | 148 | delta = ktime_sub(rettime, calltime); |
| 148 | printk("initcall %lli_%pF returned 0 after %lld usecs\n", entry->cookie, | 149 | printk("initcall %lli_%pF returned 0 after %lld usecs\n", |
| 149 | entry->func, ktime_to_ns(delta) >> 10); | 150 | (long long)entry->cookie, |
| 151 | entry->func, | ||
| 152 | (long long)ktime_to_ns(delta) >> 10); | ||
| 150 | } | 153 | } |
| 151 | 154 | ||
| 152 | /* 4) remove it from the running queue */ | 155 | /* 4) remove it from the running queue */ |
| @@ -247,7 +250,8 @@ void async_synchronize_cookie_special(async_cookie_t cookie, struct list_head *r | |||
| 247 | delta = ktime_sub(endtime, starttime); | 250 | delta = ktime_sub(endtime, starttime); |
| 248 | 251 | ||
| 249 | printk("async_continuing @ %i after %lli usec\n", | 252 | printk("async_continuing @ %i after %lli usec\n", |
| 250 | task_pid_nr(current), ktime_to_ns(delta) >> 10); | 253 | task_pid_nr(current), |
| 254 | (long long)ktime_to_ns(delta) >> 10); | ||
| 251 | } | 255 | } |
| 252 | } | 256 | } |
| 253 | EXPORT_SYMBOL_GPL(async_synchronize_cookie_special); | 257 | EXPORT_SYMBOL_GPL(async_synchronize_cookie_special); |
diff --git a/kernel/fork.c b/kernel/fork.c index e8e854a04ad2..bb5fe56a7a9c 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -1006,6 +1006,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
| 1006 | * triggers too late. This doesn't hurt, the check is only there | 1006 | * triggers too late. This doesn't hurt, the check is only there |
| 1007 | * to stop root fork bombs. | 1007 | * to stop root fork bombs. |
| 1008 | */ | 1008 | */ |
| 1009 | retval = -EAGAIN; | ||
| 1009 | if (nr_threads >= max_threads) | 1010 | if (nr_threads >= max_threads) |
| 1010 | goto bad_fork_cleanup_count; | 1011 | goto bad_fork_cleanup_count; |
| 1011 | 1012 | ||
diff --git a/kernel/irq/numa_migrate.c b/kernel/irq/numa_migrate.c index ecf765c6a77a..acd88356ac76 100644 --- a/kernel/irq/numa_migrate.c +++ b/kernel/irq/numa_migrate.c | |||
| @@ -71,7 +71,7 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc, | |||
| 71 | desc = irq_desc_ptrs[irq]; | 71 | desc = irq_desc_ptrs[irq]; |
| 72 | 72 | ||
| 73 | if (desc && old_desc != desc) | 73 | if (desc && old_desc != desc) |
| 74 | goto out_unlock; | 74 | goto out_unlock; |
| 75 | 75 | ||
| 76 | node = cpu_to_node(cpu); | 76 | node = cpu_to_node(cpu); |
| 77 | desc = kzalloc_node(sizeof(*desc), GFP_ATOMIC, node); | 77 | desc = kzalloc_node(sizeof(*desc), GFP_ATOMIC, node); |
| @@ -84,10 +84,15 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc, | |||
| 84 | init_copy_one_irq_desc(irq, old_desc, desc, cpu); | 84 | init_copy_one_irq_desc(irq, old_desc, desc, cpu); |
| 85 | 85 | ||
| 86 | irq_desc_ptrs[irq] = desc; | 86 | irq_desc_ptrs[irq] = desc; |
| 87 | spin_unlock_irqrestore(&sparse_irq_lock, flags); | ||
| 87 | 88 | ||
| 88 | /* free the old one */ | 89 | /* free the old one */ |
| 89 | free_one_irq_desc(old_desc, desc); | 90 | free_one_irq_desc(old_desc, desc); |
| 91 | spin_unlock(&old_desc->lock); | ||
| 90 | kfree(old_desc); | 92 | kfree(old_desc); |
| 93 | spin_lock(&desc->lock); | ||
| 94 | |||
| 95 | return desc; | ||
| 91 | 96 | ||
| 92 | out_unlock: | 97 | out_unlock: |
| 93 | spin_unlock_irqrestore(&sparse_irq_lock, flags); | 98 | spin_unlock_irqrestore(&sparse_irq_lock, flags); |
diff --git a/kernel/sched.c b/kernel/sched.c index e1fc67d0674c..e72485033c48 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -4702,8 +4702,8 @@ EXPORT_SYMBOL(default_wake_function); | |||
| 4702 | * started to run but is not in state TASK_RUNNING. try_to_wake_up() returns | 4702 | * started to run but is not in state TASK_RUNNING. try_to_wake_up() returns |
| 4703 | * zero in this (rare) case, and we handle it by continuing to scan the queue. | 4703 | * zero in this (rare) case, and we handle it by continuing to scan the queue. |
| 4704 | */ | 4704 | */ |
| 4705 | static void __wake_up_common(wait_queue_head_t *q, unsigned int mode, | 4705 | void __wake_up_common(wait_queue_head_t *q, unsigned int mode, |
| 4706 | int nr_exclusive, int sync, void *key) | 4706 | int nr_exclusive, int sync, void *key) |
| 4707 | { | 4707 | { |
| 4708 | wait_queue_t *curr, *next; | 4708 | wait_queue_t *curr, *next; |
| 4709 | 4709 | ||
diff --git a/kernel/sys.c b/kernel/sys.c index e7dc0e10a485..f145c415bc16 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
| @@ -1525,22 +1525,14 @@ SYSCALL_DEFINE2(setrlimit, unsigned int, resource, struct rlimit __user *, rlim) | |||
| 1525 | return -EINVAL; | 1525 | return -EINVAL; |
| 1526 | if (copy_from_user(&new_rlim, rlim, sizeof(*rlim))) | 1526 | if (copy_from_user(&new_rlim, rlim, sizeof(*rlim))) |
| 1527 | return -EFAULT; | 1527 | return -EFAULT; |
| 1528 | if (new_rlim.rlim_cur > new_rlim.rlim_max) | ||
| 1529 | return -EINVAL; | ||
| 1528 | old_rlim = current->signal->rlim + resource; | 1530 | old_rlim = current->signal->rlim + resource; |
| 1529 | if ((new_rlim.rlim_max > old_rlim->rlim_max) && | 1531 | if ((new_rlim.rlim_max > old_rlim->rlim_max) && |
| 1530 | !capable(CAP_SYS_RESOURCE)) | 1532 | !capable(CAP_SYS_RESOURCE)) |
| 1531 | return -EPERM; | 1533 | return -EPERM; |
| 1532 | 1534 | if (resource == RLIMIT_NOFILE && new_rlim.rlim_max > sysctl_nr_open) | |
| 1533 | if (resource == RLIMIT_NOFILE) { | 1535 | return -EPERM; |
| 1534 | if (new_rlim.rlim_max == RLIM_INFINITY) | ||
| 1535 | new_rlim.rlim_max = sysctl_nr_open; | ||
| 1536 | if (new_rlim.rlim_cur == RLIM_INFINITY) | ||
| 1537 | new_rlim.rlim_cur = sysctl_nr_open; | ||
| 1538 | if (new_rlim.rlim_max > sysctl_nr_open) | ||
| 1539 | return -EPERM; | ||
| 1540 | } | ||
| 1541 | |||
| 1542 | if (new_rlim.rlim_cur > new_rlim.rlim_max) | ||
| 1543 | return -EINVAL; | ||
| 1544 | 1536 | ||
| 1545 | retval = security_task_setrlimit(resource, &new_rlim); | 1537 | retval = security_task_setrlimit(resource, &new_rlim); |
| 1546 | if (retval) | 1538 | if (retval) |
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index ea2f48af83cf..d13be216a790 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c | |||
| @@ -68,6 +68,17 @@ void clockevents_set_mode(struct clock_event_device *dev, | |||
| 68 | if (dev->mode != mode) { | 68 | if (dev->mode != mode) { |
| 69 | dev->set_mode(mode, dev); | 69 | dev->set_mode(mode, dev); |
| 70 | dev->mode = mode; | 70 | dev->mode = mode; |
| 71 | |||
| 72 | /* | ||
| 73 | * A nsec2cyc multiplicator of 0 is invalid and we'd crash | ||
| 74 | * on it, so fix it up and emit a warning: | ||
| 75 | */ | ||
| 76 | if (mode == CLOCK_EVT_MODE_ONESHOT) { | ||
| 77 | if (unlikely(!dev->mult)) { | ||
| 78 | dev->mult = 1; | ||
| 79 | WARN_ON(1); | ||
| 80 | } | ||
| 81 | } | ||
| 71 | } | 82 | } |
| 72 | } | 83 | } |
| 73 | 84 | ||
| @@ -168,15 +179,6 @@ void clockevents_register_device(struct clock_event_device *dev) | |||
| 168 | BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED); | 179 | BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED); |
| 169 | BUG_ON(!dev->cpumask); | 180 | BUG_ON(!dev->cpumask); |
| 170 | 181 | ||
| 171 | /* | ||
| 172 | * A nsec2cyc multiplicator of 0 is invalid and we'd crash | ||
| 173 | * on it, so fix it up and emit a warning: | ||
| 174 | */ | ||
| 175 | if (unlikely(!dev->mult)) { | ||
| 176 | dev->mult = 1; | ||
| 177 | WARN_ON(1); | ||
| 178 | } | ||
| 179 | |||
| 180 | spin_lock(&clockevents_lock); | 182 | spin_lock(&clockevents_lock); |
| 181 | 183 | ||
| 182 | list_add(&dev->list, &clockevent_devices); | 184 | list_add(&dev->list, &clockevent_devices); |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 7dcf6e9f2b04..9a236ffe2aa4 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
| @@ -1737,9 +1737,12 @@ static void clear_ftrace_pid(struct pid *pid) | |||
| 1737 | { | 1737 | { |
| 1738 | struct task_struct *p; | 1738 | struct task_struct *p; |
| 1739 | 1739 | ||
| 1740 | rcu_read_lock(); | ||
| 1740 | do_each_pid_task(pid, PIDTYPE_PID, p) { | 1741 | do_each_pid_task(pid, PIDTYPE_PID, p) { |
| 1741 | clear_tsk_trace_trace(p); | 1742 | clear_tsk_trace_trace(p); |
| 1742 | } while_each_pid_task(pid, PIDTYPE_PID, p); | 1743 | } while_each_pid_task(pid, PIDTYPE_PID, p); |
| 1744 | rcu_read_unlock(); | ||
| 1745 | |||
| 1743 | put_pid(pid); | 1746 | put_pid(pid); |
| 1744 | } | 1747 | } |
| 1745 | 1748 | ||
| @@ -1747,9 +1750,11 @@ static void set_ftrace_pid(struct pid *pid) | |||
| 1747 | { | 1750 | { |
| 1748 | struct task_struct *p; | 1751 | struct task_struct *p; |
| 1749 | 1752 | ||
| 1753 | rcu_read_lock(); | ||
| 1750 | do_each_pid_task(pid, PIDTYPE_PID, p) { | 1754 | do_each_pid_task(pid, PIDTYPE_PID, p) { |
| 1751 | set_tsk_trace_trace(p); | 1755 | set_tsk_trace_trace(p); |
| 1752 | } while_each_pid_task(pid, PIDTYPE_PID, p); | 1756 | } while_each_pid_task(pid, PIDTYPE_PID, p); |
| 1757 | rcu_read_unlock(); | ||
| 1753 | } | 1758 | } |
| 1754 | 1759 | ||
| 1755 | static void clear_ftrace_pid_task(struct pid **pid) | 1760 | static void clear_ftrace_pid_task(struct pid **pid) |
diff --git a/kernel/wait.c b/kernel/wait.c index cd87131f2fc2..42a2dbc181c8 100644 --- a/kernel/wait.c +++ b/kernel/wait.c | |||
| @@ -91,6 +91,15 @@ prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state) | |||
| 91 | } | 91 | } |
| 92 | EXPORT_SYMBOL(prepare_to_wait_exclusive); | 92 | EXPORT_SYMBOL(prepare_to_wait_exclusive); |
| 93 | 93 | ||
| 94 | /* | ||
| 95 | * finish_wait - clean up after waiting in a queue | ||
| 96 | * @q: waitqueue waited on | ||
| 97 | * @wait: wait descriptor | ||
| 98 | * | ||
| 99 | * Sets current thread back to running state and removes | ||
| 100 | * the wait descriptor from the given waitqueue if still | ||
| 101 | * queued. | ||
| 102 | */ | ||
| 94 | void finish_wait(wait_queue_head_t *q, wait_queue_t *wait) | 103 | void finish_wait(wait_queue_head_t *q, wait_queue_t *wait) |
| 95 | { | 104 | { |
| 96 | unsigned long flags; | 105 | unsigned long flags; |
| @@ -117,6 +126,39 @@ void finish_wait(wait_queue_head_t *q, wait_queue_t *wait) | |||
| 117 | } | 126 | } |
| 118 | EXPORT_SYMBOL(finish_wait); | 127 | EXPORT_SYMBOL(finish_wait); |
| 119 | 128 | ||
| 129 | /* | ||
| 130 | * abort_exclusive_wait - abort exclusive waiting in a queue | ||
| 131 | * @q: waitqueue waited on | ||
| 132 | * @wait: wait descriptor | ||
| 133 | * @state: runstate of the waiter to be woken | ||
| 134 | * @key: key to identify a wait bit queue or %NULL | ||
| 135 | * | ||
| 136 | * Sets current thread back to running state and removes | ||
| 137 | * the wait descriptor from the given waitqueue if still | ||
| 138 | * queued. | ||
| 139 | * | ||
| 140 | * Wakes up the next waiter if the caller is concurrently | ||
| 141 | * woken up through the queue. | ||
| 142 | * | ||
| 143 | * This prevents waiter starvation where an exclusive waiter | ||
| 144 | * aborts and is woken up concurrently and noone wakes up | ||
| 145 | * the next waiter. | ||
| 146 | */ | ||
| 147 | void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait, | ||
| 148 | unsigned int mode, void *key) | ||
| 149 | { | ||
| 150 | unsigned long flags; | ||
| 151 | |||
| 152 | __set_current_state(TASK_RUNNING); | ||
| 153 | spin_lock_irqsave(&q->lock, flags); | ||
| 154 | if (!list_empty(&wait->task_list)) | ||
| 155 | list_del_init(&wait->task_list); | ||
| 156 | else if (waitqueue_active(q)) | ||
| 157 | __wake_up_common(q, mode, 1, 0, key); | ||
| 158 | spin_unlock_irqrestore(&q->lock, flags); | ||
| 159 | } | ||
| 160 | EXPORT_SYMBOL(abort_exclusive_wait); | ||
| 161 | |||
| 120 | int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key) | 162 | int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key) |
| 121 | { | 163 | { |
| 122 | int ret = default_wake_function(wait, mode, sync, key); | 164 | int ret = default_wake_function(wait, mode, sync, key); |
| @@ -177,17 +219,20 @@ int __sched | |||
| 177 | __wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q, | 219 | __wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q, |
| 178 | int (*action)(void *), unsigned mode) | 220 | int (*action)(void *), unsigned mode) |
| 179 | { | 221 | { |
| 180 | int ret = 0; | ||
| 181 | |||
| 182 | do { | 222 | do { |
| 223 | int ret; | ||
| 224 | |||
| 183 | prepare_to_wait_exclusive(wq, &q->wait, mode); | 225 | prepare_to_wait_exclusive(wq, &q->wait, mode); |
| 184 | if (test_bit(q->key.bit_nr, q->key.flags)) { | 226 | if (!test_bit(q->key.bit_nr, q->key.flags)) |
| 185 | if ((ret = (*action)(q->key.flags))) | 227 | continue; |
| 186 | break; | 228 | ret = action(q->key.flags); |
| 187 | } | 229 | if (!ret) |
| 230 | continue; | ||
| 231 | abort_exclusive_wait(wq, &q->wait, mode, &q->key); | ||
| 232 | return ret; | ||
| 188 | } while (test_and_set_bit(q->key.bit_nr, q->key.flags)); | 233 | } while (test_and_set_bit(q->key.bit_nr, q->key.flags)); |
| 189 | finish_wait(wq, &q->wait); | 234 | finish_wait(wq, &q->wait); |
| 190 | return ret; | 235 | return 0; |
| 191 | } | 236 | } |
| 192 | EXPORT_SYMBOL(__wait_on_bit_lock); | 237 | EXPORT_SYMBOL(__wait_on_bit_lock); |
| 193 | 238 | ||
diff --git a/mm/memory.c b/mm/memory.c index 22bfa7a47a0b..baa999e87cd2 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
| @@ -1999,7 +1999,7 @@ gotten: | |||
| 1999 | * Don't let another task, with possibly unlocked vma, | 1999 | * Don't let another task, with possibly unlocked vma, |
| 2000 | * keep the mlocked page. | 2000 | * keep the mlocked page. |
| 2001 | */ | 2001 | */ |
| 2002 | if (vma->vm_flags & VM_LOCKED) { | 2002 | if ((vma->vm_flags & VM_LOCKED) && old_page) { |
| 2003 | lock_page(old_page); /* for LRU manipulation */ | 2003 | lock_page(old_page); /* for LRU manipulation */ |
| 2004 | clear_page_mlock(old_page); | 2004 | clear_page_mlock(old_page); |
| 2005 | unlock_page(old_page); | 2005 | unlock_page(old_page); |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index b493db7841dc..dc32dae01e5f 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
| @@ -1051,13 +1051,22 @@ continue_unlock: | |||
| 1051 | } | 1051 | } |
| 1052 | } | 1052 | } |
| 1053 | 1053 | ||
| 1054 | if (wbc->sync_mode == WB_SYNC_NONE) { | 1054 | if (nr_to_write > 0) |
| 1055 | wbc->nr_to_write--; | 1055 | nr_to_write--; |
| 1056 | if (wbc->nr_to_write <= 0) { | 1056 | else if (wbc->sync_mode == WB_SYNC_NONE) { |
| 1057 | done = 1; | 1057 | /* |
| 1058 | break; | 1058 | * We stop writing back only if we are not |
| 1059 | } | 1059 | * doing integrity sync. In case of integrity |
| 1060 | * sync we have to keep going because someone | ||
| 1061 | * may be concurrently dirtying pages, and we | ||
| 1062 | * might have synced a lot of newly appeared | ||
| 1063 | * dirty pages, but have not synced all of the | ||
| 1064 | * old dirty pages. | ||
| 1065 | */ | ||
| 1066 | done = 1; | ||
| 1067 | break; | ||
| 1060 | } | 1068 | } |
| 1069 | |||
| 1061 | if (wbc->nonblocking && bdi_write_congested(bdi)) { | 1070 | if (wbc->nonblocking && bdi_write_congested(bdi)) { |
| 1062 | wbc->encountered_congestion = 1; | 1071 | wbc->encountered_congestion = 1; |
| 1063 | done = 1; | 1072 | done = 1; |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 557fe16cbfb0..dda42f0bd7a3 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
| @@ -663,14 +663,10 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
| 663 | th->urg_ptr = 0; | 663 | th->urg_ptr = 0; |
| 664 | 664 | ||
| 665 | /* The urg_mode check is necessary during a below snd_una win probe */ | 665 | /* The urg_mode check is necessary during a below snd_una win probe */ |
| 666 | if (unlikely(tcp_urg_mode(tp))) { | 666 | if (unlikely(tcp_urg_mode(tp) && |
| 667 | if (between(tp->snd_up, tcb->seq + 1, tcb->seq + 0xFFFF)) { | 667 | between(tp->snd_up, tcb->seq + 1, tcb->seq + 0xFFFF))) { |
| 668 | th->urg_ptr = htons(tp->snd_up - tcb->seq); | 668 | th->urg_ptr = htons(tp->snd_up - tcb->seq); |
| 669 | th->urg = 1; | 669 | th->urg = 1; |
| 670 | } else if (after(tcb->seq + 0xFFFF, tp->snd_nxt)) { | ||
| 671 | th->urg_ptr = 0xFFFF; | ||
| 672 | th->urg = 1; | ||
| 673 | } | ||
| 674 | } | 670 | } |
| 675 | 671 | ||
| 676 | tcp_options_write((__be32 *)(th + 1), tp, &opts, &md5_hash_location); | 672 | tcp_options_write((__be32 *)(th + 1), tp, &opts, &md5_hash_location); |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index b7faffe5c029..cc3a0a06c004 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
| @@ -1015,9 +1015,11 @@ static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
| 1015 | 1015 | ||
| 1016 | if ((rc = sock_queue_rcv_skb(sk, skb)) < 0) { | 1016 | if ((rc = sock_queue_rcv_skb(sk, skb)) < 0) { |
| 1017 | /* Note that an ENOMEM error is charged twice */ | 1017 | /* Note that an ENOMEM error is charged twice */ |
| 1018 | if (rc == -ENOMEM) | 1018 | if (rc == -ENOMEM) { |
| 1019 | UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS, | 1019 | UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS, |
| 1020 | is_udplite); | 1020 | is_udplite); |
| 1021 | atomic_inc(&sk->sk_drops); | ||
| 1022 | } | ||
| 1021 | goto drop; | 1023 | goto drop; |
| 1022 | } | 1024 | } |
| 1023 | 1025 | ||
| @@ -1229,7 +1231,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, | |||
| 1229 | int proto) | 1231 | int proto) |
| 1230 | { | 1232 | { |
| 1231 | struct sock *sk; | 1233 | struct sock *sk; |
| 1232 | struct udphdr *uh = udp_hdr(skb); | 1234 | struct udphdr *uh; |
| 1233 | unsigned short ulen; | 1235 | unsigned short ulen; |
| 1234 | struct rtable *rt = (struct rtable*)skb->dst; | 1236 | struct rtable *rt = (struct rtable*)skb->dst; |
| 1235 | __be32 saddr = ip_hdr(skb)->saddr; | 1237 | __be32 saddr = ip_hdr(skb)->saddr; |
| @@ -1242,6 +1244,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, | |||
| 1242 | if (!pskb_may_pull(skb, sizeof(struct udphdr))) | 1244 | if (!pskb_may_pull(skb, sizeof(struct udphdr))) |
| 1243 | goto drop; /* No space for header. */ | 1245 | goto drop; /* No space for header. */ |
| 1244 | 1246 | ||
| 1247 | uh = udp_hdr(skb); | ||
| 1245 | ulen = ntohs(uh->len); | 1248 | ulen = ntohs(uh->len); |
| 1246 | if (ulen > skb->len) | 1249 | if (ulen > skb->len) |
| 1247 | goto short_packet; | 1250 | goto short_packet; |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 4b15938bef4d..9fb49c3b518a 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
| @@ -1105,6 +1105,18 @@ static inline int ip6_ufo_append_data(struct sock *sk, | |||
| 1105 | return err; | 1105 | return err; |
| 1106 | } | 1106 | } |
| 1107 | 1107 | ||
| 1108 | static inline struct ipv6_opt_hdr *ip6_opt_dup(struct ipv6_opt_hdr *src, | ||
| 1109 | gfp_t gfp) | ||
| 1110 | { | ||
| 1111 | return src ? kmemdup(src, (src->hdrlen + 1) * 8, gfp) : NULL; | ||
| 1112 | } | ||
| 1113 | |||
| 1114 | static inline struct ipv6_rt_hdr *ip6_rthdr_dup(struct ipv6_rt_hdr *src, | ||
| 1115 | gfp_t gfp) | ||
| 1116 | { | ||
| 1117 | return src ? kmemdup(src, (src->hdrlen + 1) * 8, gfp) : NULL; | ||
| 1118 | } | ||
| 1119 | |||
| 1108 | int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, | 1120 | int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, |
| 1109 | int offset, int len, int odd, struct sk_buff *skb), | 1121 | int offset, int len, int odd, struct sk_buff *skb), |
| 1110 | void *from, int length, int transhdrlen, | 1122 | void *from, int length, int transhdrlen, |
| @@ -1130,17 +1142,37 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, | |||
| 1130 | * setup for corking | 1142 | * setup for corking |
| 1131 | */ | 1143 | */ |
| 1132 | if (opt) { | 1144 | if (opt) { |
| 1133 | if (np->cork.opt == NULL) { | 1145 | if (WARN_ON(np->cork.opt)) |
| 1134 | np->cork.opt = kmalloc(opt->tot_len, | ||
| 1135 | sk->sk_allocation); | ||
| 1136 | if (unlikely(np->cork.opt == NULL)) | ||
| 1137 | return -ENOBUFS; | ||
| 1138 | } else if (np->cork.opt->tot_len < opt->tot_len) { | ||
| 1139 | printk(KERN_DEBUG "ip6_append_data: invalid option length\n"); | ||
| 1140 | return -EINVAL; | 1146 | return -EINVAL; |
| 1141 | } | 1147 | |
| 1142 | memcpy(np->cork.opt, opt, opt->tot_len); | 1148 | np->cork.opt = kmalloc(opt->tot_len, sk->sk_allocation); |
| 1143 | inet->cork.flags |= IPCORK_OPT; | 1149 | if (unlikely(np->cork.opt == NULL)) |
| 1150 | return -ENOBUFS; | ||
| 1151 | |||
| 1152 | np->cork.opt->tot_len = opt->tot_len; | ||
| 1153 | np->cork.opt->opt_flen = opt->opt_flen; | ||
| 1154 | np->cork.opt->opt_nflen = opt->opt_nflen; | ||
| 1155 | |||
| 1156 | np->cork.opt->dst0opt = ip6_opt_dup(opt->dst0opt, | ||
| 1157 | sk->sk_allocation); | ||
| 1158 | if (opt->dst0opt && !np->cork.opt->dst0opt) | ||
| 1159 | return -ENOBUFS; | ||
| 1160 | |||
| 1161 | np->cork.opt->dst1opt = ip6_opt_dup(opt->dst1opt, | ||
| 1162 | sk->sk_allocation); | ||
| 1163 | if (opt->dst1opt && !np->cork.opt->dst1opt) | ||
| 1164 | return -ENOBUFS; | ||
| 1165 | |||
| 1166 | np->cork.opt->hopopt = ip6_opt_dup(opt->hopopt, | ||
| 1167 | sk->sk_allocation); | ||
| 1168 | if (opt->hopopt && !np->cork.opt->hopopt) | ||
| 1169 | return -ENOBUFS; | ||
| 1170 | |||
| 1171 | np->cork.opt->srcrt = ip6_rthdr_dup(opt->srcrt, | ||
| 1172 | sk->sk_allocation); | ||
| 1173 | if (opt->srcrt && !np->cork.opt->srcrt) | ||
| 1174 | return -ENOBUFS; | ||
| 1175 | |||
| 1144 | /* need source address above miyazawa*/ | 1176 | /* need source address above miyazawa*/ |
| 1145 | } | 1177 | } |
| 1146 | dst_hold(&rt->u.dst); | 1178 | dst_hold(&rt->u.dst); |
| @@ -1167,8 +1199,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, | |||
| 1167 | } else { | 1199 | } else { |
| 1168 | rt = (struct rt6_info *)inet->cork.dst; | 1200 | rt = (struct rt6_info *)inet->cork.dst; |
| 1169 | fl = &inet->cork.fl; | 1201 | fl = &inet->cork.fl; |
| 1170 | if (inet->cork.flags & IPCORK_OPT) | 1202 | opt = np->cork.opt; |
| 1171 | opt = np->cork.opt; | ||
| 1172 | transhdrlen = 0; | 1203 | transhdrlen = 0; |
| 1173 | exthdrlen = 0; | 1204 | exthdrlen = 0; |
| 1174 | mtu = inet->cork.fragsize; | 1205 | mtu = inet->cork.fragsize; |
| @@ -1407,9 +1438,15 @@ error: | |||
| 1407 | 1438 | ||
| 1408 | static void ip6_cork_release(struct inet_sock *inet, struct ipv6_pinfo *np) | 1439 | static void ip6_cork_release(struct inet_sock *inet, struct ipv6_pinfo *np) |
| 1409 | { | 1440 | { |
| 1410 | inet->cork.flags &= ~IPCORK_OPT; | 1441 | if (np->cork.opt) { |
| 1411 | kfree(np->cork.opt); | 1442 | kfree(np->cork.opt->dst0opt); |
| 1412 | np->cork.opt = NULL; | 1443 | kfree(np->cork.opt->dst1opt); |
| 1444 | kfree(np->cork.opt->hopopt); | ||
| 1445 | kfree(np->cork.opt->srcrt); | ||
| 1446 | kfree(np->cork.opt); | ||
| 1447 | np->cork.opt = NULL; | ||
| 1448 | } | ||
| 1449 | |||
| 1413 | if (inet->cork.dst) { | 1450 | if (inet->cork.dst) { |
| 1414 | dst_release(inet->cork.dst); | 1451 | dst_release(inet->cork.dst); |
| 1415 | inet->cork.dst = NULL; | 1452 | inet->cork.dst = NULL; |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 9454d4ae46df..1fc4a7885c41 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
| @@ -222,13 +222,13 @@ static void *packet_lookup_frame(struct packet_sock *po, unsigned int position, | |||
| 222 | h.raw = po->pg_vec[pg_vec_pos] + (frame_offset * po->frame_size); | 222 | h.raw = po->pg_vec[pg_vec_pos] + (frame_offset * po->frame_size); |
| 223 | switch (po->tp_version) { | 223 | switch (po->tp_version) { |
| 224 | case TPACKET_V1: | 224 | case TPACKET_V1: |
| 225 | if (status != h.h1->tp_status ? TP_STATUS_USER : | 225 | if (status != (h.h1->tp_status ? TP_STATUS_USER : |
| 226 | TP_STATUS_KERNEL) | 226 | TP_STATUS_KERNEL)) |
| 227 | return NULL; | 227 | return NULL; |
| 228 | break; | 228 | break; |
| 229 | case TPACKET_V2: | 229 | case TPACKET_V2: |
| 230 | if (status != h.h2->tp_status ? TP_STATUS_USER : | 230 | if (status != (h.h2->tp_status ? TP_STATUS_USER : |
| 231 | TP_STATUS_KERNEL) | 231 | TP_STATUS_KERNEL)) |
| 232 | return NULL; | 232 | return NULL; |
| 233 | break; | 233 | break; |
| 234 | } | 234 | } |
diff --git a/net/sunrpc/Kconfig b/net/sunrpc/Kconfig index dcef600d0bf5..5592883e1e4a 100644 --- a/net/sunrpc/Kconfig +++ b/net/sunrpc/Kconfig | |||
| @@ -6,7 +6,7 @@ config SUNRPC_GSS | |||
| 6 | 6 | ||
| 7 | config SUNRPC_XPRT_RDMA | 7 | config SUNRPC_XPRT_RDMA |
| 8 | tristate | 8 | tristate |
| 9 | depends on SUNRPC && INFINIBAND && EXPERIMENTAL | 9 | depends on SUNRPC && INFINIBAND && INFINIBAND_ADDR_TRANS && EXPERIMENTAL |
| 10 | default SUNRPC && INFINIBAND | 10 | default SUNRPC && INFINIBAND |
| 11 | help | 11 | help |
| 12 | This option allows the NFS client and server to support | 12 | This option allows the NFS client and server to support |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index e17836680f49..0a1798eafb0b 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
| @@ -1767,7 +1767,7 @@ static int snd_pcm_oss_get_formats(struct snd_pcm_oss_file *pcm_oss_file) | |||
| 1767 | AFMT_S8 | AFMT_U16_LE | | 1767 | AFMT_S8 | AFMT_U16_LE | |
| 1768 | AFMT_U16_BE | | 1768 | AFMT_U16_BE | |
| 1769 | AFMT_S32_LE | AFMT_S32_BE | | 1769 | AFMT_S32_LE | AFMT_S32_BE | |
| 1770 | AFMT_S24_LE | AFMT_S24_LE | | 1770 | AFMT_S24_LE | AFMT_S24_BE | |
| 1771 | AFMT_S24_PACKED; | 1771 | AFMT_S24_PACKED; |
| 1772 | params = kmalloc(sizeof(*params), GFP_KERNEL); | 1772 | params = kmalloc(sizeof(*params), GFP_KERNEL); |
| 1773 | if (!params) | 1773 | if (!params) |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index b7bba7dc7cf1..0b708134d12f 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
| @@ -487,7 +487,6 @@ int /*__devinit*/ snd_hda_bus_new(struct snd_card *card, | |||
| 487 | { | 487 | { |
| 488 | struct hda_bus *bus; | 488 | struct hda_bus *bus; |
| 489 | int err; | 489 | int err; |
| 490 | char qname[8]; | ||
| 491 | static struct snd_device_ops dev_ops = { | 490 | static struct snd_device_ops dev_ops = { |
| 492 | .dev_register = snd_hda_bus_dev_register, | 491 | .dev_register = snd_hda_bus_dev_register, |
| 493 | .dev_free = snd_hda_bus_dev_free, | 492 | .dev_free = snd_hda_bus_dev_free, |
| @@ -517,10 +516,12 @@ int /*__devinit*/ snd_hda_bus_new(struct snd_card *card, | |||
| 517 | mutex_init(&bus->cmd_mutex); | 516 | mutex_init(&bus->cmd_mutex); |
| 518 | INIT_LIST_HEAD(&bus->codec_list); | 517 | INIT_LIST_HEAD(&bus->codec_list); |
| 519 | 518 | ||
| 520 | snprintf(qname, sizeof(qname), "hda%d", card->number); | 519 | snprintf(bus->workq_name, sizeof(bus->workq_name), |
| 521 | bus->workq = create_workqueue(qname); | 520 | "hd-audio%d", card->number); |
| 521 | bus->workq = create_singlethread_workqueue(bus->workq_name); | ||
| 522 | if (!bus->workq) { | 522 | if (!bus->workq) { |
| 523 | snd_printk(KERN_ERR "cannot create workqueue %s\n", qname); | 523 | snd_printk(KERN_ERR "cannot create workqueue %s\n", |
| 524 | bus->workq_name); | ||
| 524 | kfree(bus); | 525 | kfree(bus); |
| 525 | return -ENOMEM; | 526 | return -ENOMEM; |
| 526 | } | 527 | } |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 5810ef588402..09a332ada0c6 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
| @@ -614,6 +614,7 @@ struct hda_bus { | |||
| 614 | 614 | ||
| 615 | /* unsolicited event queue */ | 615 | /* unsolicited event queue */ |
| 616 | struct hda_bus_unsolicited *unsol; | 616 | struct hda_bus_unsolicited *unsol; |
| 617 | char workq_name[16]; | ||
| 617 | struct workqueue_struct *workq; /* common workqueue for codecs */ | 618 | struct workqueue_struct *workq; /* common workqueue for codecs */ |
| 618 | 619 | ||
| 619 | /* assigned PCMs */ | 620 | /* assigned PCMs */ |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 7ca66d654148..144b85276d5a 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
| @@ -399,7 +399,8 @@ static void print_conn_list(struct snd_info_buffer *buffer, | |||
| 399 | { | 399 | { |
| 400 | int c, curr = -1; | 400 | int c, curr = -1; |
| 401 | 401 | ||
| 402 | if (conn_len > 1 && wid_type != AC_WID_AUD_MIX) | 402 | if (conn_len > 1 && wid_type != AC_WID_AUD_MIX && |
| 403 | wid_type != AC_WID_VOL_KNB) | ||
| 403 | curr = snd_hda_codec_read(codec, nid, 0, | 404 | curr = snd_hda_codec_read(codec, nid, 0, |
| 404 | AC_VERB_GET_CONNECT_SEL, 0); | 405 | AC_VERB_GET_CONNECT_SEL, 0); |
| 405 | snd_iprintf(buffer, " Connection: %d\n", conn_len); | 406 | snd_iprintf(buffer, " Connection: %d\n", conn_len); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 7884a4e07061..ae5c8a0d1479 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -1037,6 +1037,7 @@ do_sku: | |||
| 1037 | case 0x10ec0267: | 1037 | case 0x10ec0267: |
| 1038 | case 0x10ec0268: | 1038 | case 0x10ec0268: |
| 1039 | case 0x10ec0269: | 1039 | case 0x10ec0269: |
| 1040 | case 0x10ec0272: | ||
| 1040 | case 0x10ec0660: | 1041 | case 0x10ec0660: |
| 1041 | case 0x10ec0662: | 1042 | case 0x10ec0662: |
| 1042 | case 0x10ec0663: | 1043 | case 0x10ec0663: |
| @@ -1065,6 +1066,7 @@ do_sku: | |||
| 1065 | case 0x10ec0882: | 1066 | case 0x10ec0882: |
| 1066 | case 0x10ec0883: | 1067 | case 0x10ec0883: |
| 1067 | case 0x10ec0885: | 1068 | case 0x10ec0885: |
| 1069 | case 0x10ec0887: | ||
| 1068 | case 0x10ec0889: | 1070 | case 0x10ec0889: |
| 1069 | snd_hda_codec_write(codec, 0x20, 0, | 1071 | snd_hda_codec_write(codec, 0x20, 0, |
| 1070 | AC_VERB_SET_COEF_INDEX, 7); | 1072 | AC_VERB_SET_COEF_INDEX, 7); |
| @@ -7012,6 +7014,7 @@ static int patch_alc882(struct hda_codec *codec) | |||
| 7012 | break; | 7014 | break; |
| 7013 | case 0x106b1000: /* iMac 24 */ | 7015 | case 0x106b1000: /* iMac 24 */ |
| 7014 | case 0x106b2800: /* AppleTV */ | 7016 | case 0x106b2800: /* AppleTV */ |
| 7017 | case 0x106b3e00: /* iMac 24 Aluminium */ | ||
| 7015 | board_config = ALC885_IMAC24; | 7018 | board_config = ALC885_IMAC24; |
| 7016 | break; | 7019 | break; |
| 7017 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ | 7020 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
| @@ -8514,6 +8517,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
| 8514 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), | 8517 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
| 8515 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), | 8518 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
| 8516 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), | 8519 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
| 8520 | SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550", | ||
| 8521 | ALC883_FUJITSU_PI2515), | ||
| 8517 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), | 8522 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
| 8518 | SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530", | 8523 | SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530", |
| 8519 | ALC888_FUJITSU_XA3530), | 8524 | ALC888_FUJITSU_XA3530), |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index b787b3cc096f..38428e22428f 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
| @@ -1804,6 +1804,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { | |||
| 1804 | "HP dv4", STAC_HP_DV5), | 1804 | "HP dv4", STAC_HP_DV5), |
| 1805 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, | 1805 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, |
| 1806 | "HP dv7", STAC_HP_M4), | 1806 | "HP dv7", STAC_HP_M4), |
| 1807 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3600, | ||
| 1808 | "HP dv5", STAC_HP_DV5), | ||
| 1807 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603, | 1809 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603, |
| 1808 | "HP dv5", STAC_HP_DV5), | 1810 | "HP dv5", STAC_HP_DV5), |
| 1809 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, | 1811 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 19d3391e229f..e900cdc84849 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
| @@ -617,7 +617,7 @@ static int snd_intel8x0_ali_codec_semaphore(struct intel8x0 *chip) | |||
| 617 | int time = 100; | 617 | int time = 100; |
| 618 | if (chip->buggy_semaphore) | 618 | if (chip->buggy_semaphore) |
| 619 | return 0; /* just ignore ... */ | 619 | return 0; /* just ignore ... */ |
| 620 | while (time-- && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY)) | 620 | while (--time && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY)) |
| 621 | udelay(1); | 621 | udelay(1); |
| 622 | if (! time && ! chip->in_ac97_init) | 622 | if (! time && ! chip->in_ac97_init) |
| 623 | snd_printk(KERN_WARNING "ali_codec_semaphore timeout\n"); | 623 | snd_printk(KERN_WARNING "ali_codec_semaphore timeout\n"); |
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index c5d67900d666..ff0054b76502 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | * Based on at91-ssc.c by | 10 | * Based on at91-ssc.c by |
| 11 | * Frank Mandarino <fmandarino@endrelia.com> | 11 | * Frank Mandarino <fmandarino@endrelia.com> |
| 12 | * Based on pxa2xx Platform drivers by | 12 | * Based on pxa2xx Platform drivers by |
| 13 | * Liam Girdwood <liam.girdwood@wolfsonmicro.com> | 13 | * Liam Girdwood <lrg@slimlogic.co.uk> |
| 14 | * | 14 | * |
| 15 | * This program is free software; you can redistribute it and/or modify | 15 | * This program is free software; you can redistribute it and/or modify |
| 16 | * it under the terms of the GNU General Public License as published by | 16 | * it under the terms of the GNU General Public License as published by |
diff --git a/sound/soc/atmel/atmel_ssc_dai.h b/sound/soc/atmel/atmel_ssc_dai.h index a828746e8a2f..391135f9c6c1 100644 --- a/sound/soc/atmel/atmel_ssc_dai.h +++ b/sound/soc/atmel/atmel_ssc_dai.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | * Based on at91-ssc.c by | 10 | * Based on at91-ssc.c by |
| 11 | * Frank Mandarino <fmandarino@endrelia.com> | 11 | * Frank Mandarino <fmandarino@endrelia.com> |
| 12 | * Based on pxa2xx Platform drivers by | 12 | * Based on pxa2xx Platform drivers by |
| 13 | * Liam Girdwood <liam.girdwood@wolfsonmicro.com> | 13 | * Liam Girdwood <lrg@slimlogic.co.uk> |
| 14 | * | 14 | * |
| 15 | * This program is free software; you can redistribute it and/or modify | 15 | * This program is free software; you can redistribute it and/or modify |
| 16 | * it under the terms of the GNU General Public License as published by | 16 | * it under the terms of the GNU General Public License as published by |
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index e3989d406f54..35d99750c383 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. | 4 | * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. |
| 5 | * | 5 | * |
| 6 | * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 6 | * Author: Liam Girdwood <lrg@slimlogic.co.uk> |
| 7 | * | 7 | * |
| 8 | * 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 |
| 9 | * 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 |
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index 5b5afc144478..1cbb7b9b51ce 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c | |||
| @@ -2,8 +2,7 @@ | |||
| 2 | * wm8990.c -- WM8990 ALSA Soc Audio driver | 2 | * wm8990.c -- WM8990 ALSA Soc Audio driver |
| 3 | * | 3 | * |
| 4 | * Copyright 2008 Wolfson Microelectronics PLC. | 4 | * Copyright 2008 Wolfson Microelectronics PLC. |
| 5 | * Author: Liam Girdwood | 5 | * Author: Liam Girdwood <lrg@slimlogic.co.uk> |
| 6 | * lg@opensource.wolfsonmicro.com or linux@wolfsonmicro.com | ||
| 7 | * | 6 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License as published by the | 8 | * under the terms of the GNU General Public License as published by the |
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c index b0362dfd5b71..dd3bb2933762 100644 --- a/sound/soc/omap/omap-pcm.c +++ b/sound/soc/omap/omap-pcm.c | |||
| @@ -175,9 +175,10 @@ static int omap_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
| 175 | { | 175 | { |
| 176 | struct snd_pcm_runtime *runtime = substream->runtime; | 176 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 177 | struct omap_runtime_data *prtd = runtime->private_data; | 177 | struct omap_runtime_data *prtd = runtime->private_data; |
| 178 | unsigned long flags; | ||
| 178 | int ret = 0; | 179 | int ret = 0; |
| 179 | 180 | ||
| 180 | spin_lock_irq(&prtd->lock); | 181 | spin_lock_irqsave(&prtd->lock, flags); |
| 181 | switch (cmd) { | 182 | switch (cmd) { |
| 182 | case SNDRV_PCM_TRIGGER_START: | 183 | case SNDRV_PCM_TRIGGER_START: |
| 183 | case SNDRV_PCM_TRIGGER_RESUME: | 184 | case SNDRV_PCM_TRIGGER_RESUME: |
| @@ -195,7 +196,7 @@ static int omap_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
| 195 | default: | 196 | default: |
| 196 | ret = -EINVAL; | 197 | ret = -EINVAL; |
| 197 | } | 198 | } |
| 198 | spin_unlock_irq(&prtd->lock); | 199 | spin_unlock_irqrestore(&prtd->lock, flags); |
| 199 | 200 | ||
| 200 | return ret; | 201 | return ret; |
| 201 | } | 202 | } |
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c709b9563226..2ab83129d9b0 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
| @@ -2966,6 +2966,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, | |||
| 2966 | return -EINVAL; | 2966 | return -EINVAL; |
| 2967 | } | 2967 | } |
| 2968 | alts = &iface->altsetting[fp->altset_idx]; | 2968 | alts = &iface->altsetting[fp->altset_idx]; |
| 2969 | fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); | ||
| 2969 | usb_set_interface(chip->dev, fp->iface, 0); | 2970 | usb_set_interface(chip->dev, fp->iface, 0); |
| 2970 | init_usb_pitch(chip->dev, fp->iface, alts, fp); | 2971 | init_usb_pitch(chip->dev, fp->iface, alts, fp); |
| 2971 | init_usb_sample_rate(chip->dev, fp->iface, alts, fp, fp->rate_max); | 2972 | init_usb_sample_rate(chip->dev, fp->iface, alts, fp, fp->rate_max); |
