mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 13:48:06 +00:00
linux: remove 3.7 support
It is not used by any target. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 37469
This commit is contained in:
parent
c8933c968f
commit
a9de3a851a
File diff suppressed because it is too large
Load Diff
@ -1,13 +0,0 @@
|
||||
--- a/drivers/mtd/devices/m25p80.c
|
||||
+++ b/drivers/mtd/devices/m25p80.c
|
||||
@@ -645,6 +645,10 @@ static const struct spi_device_id m25p_i
|
||||
/* Everspin */
|
||||
{ "mr25h256", CAT25_INFO( 32 * 1024, 1, 256, 2) },
|
||||
|
||||
+ /* GigaDevice */
|
||||
+ { "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) },
|
||||
+ { "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) },
|
||||
+
|
||||
/* Intel/Numonyx -- xxxs33b */
|
||||
{ "160s33b", INFO(0x898911, 0, 64 * 1024, 32, 0) },
|
||||
{ "320s33b", INFO(0x898912, 0, 64 * 1024, 64, 0) },
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,36 +0,0 @@
|
||||
--- a/drivers/net/usb/hso.c
|
||||
+++ b/drivers/net/usb/hso.c
|
||||
@@ -468,8 +468,10 @@ static const struct usb_device_id hso_id
|
||||
{USB_DEVICE(0x0af0, 0x8400)},
|
||||
{USB_DEVICE(0x0af0, 0x8600)},
|
||||
{USB_DEVICE(0x0af0, 0x8800)},
|
||||
- {USB_DEVICE(0x0af0, 0x8900)},
|
||||
- {USB_DEVICE(0x0af0, 0x9000)},
|
||||
+ {USB_DEVICE(0x0af0, 0x8900)}, /* GTM 67xx */
|
||||
+ {USB_DEVICE(0x0af0, 0x9000)}, /* GTM 66xx */
|
||||
+ {USB_DEVICE(0x0af0, 0x9200)}, /* GTM 67xxWFS */
|
||||
+ {USB_DEVICE(0x0af0, 0x9300)}, /* GTM 66xxWFS */
|
||||
{USB_DEVICE(0x0af0, 0xd035)},
|
||||
{USB_DEVICE(0x0af0, 0xd055)},
|
||||
{USB_DEVICE(0x0af0, 0xd155)},
|
||||
--- a/drivers/usb/storage/unusual_devs.h
|
||||
+++ b/drivers/usb/storage/unusual_devs.h
|
||||
@@ -1237,6 +1237,18 @@ UNUSUAL_DEV( 0x0af0, 0x8304, 0x0000, 0x0
|
||||
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
|
||||
0 ),
|
||||
|
||||
+UNUSUAL_DEV( 0x0af0, 0x9200, 0x0000, 0x0000,
|
||||
+ "Option",
|
||||
+ "Globetrotter 67xxWFS SD-Card",
|
||||
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
|
||||
+ 0 ),
|
||||
+
|
||||
+UNUSUAL_DEV( 0x0af0, 0x9300, 0x0000, 0x0000,
|
||||
+ "Option",
|
||||
+ "Globetrotter 66xxWFS SD-Card",
|
||||
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
|
||||
+ 0 ),
|
||||
+
|
||||
UNUSUAL_DEV( 0x0af0, 0xc100, 0x0000, 0x0000,
|
||||
"Option",
|
||||
"GI 070x SD-Card",
|
@ -1,10 +0,0 @@
|
||||
--- a/arch/arm/boot/compressed/decompress.c
|
||||
+++ b/arch/arm/boot/compressed/decompress.c
|
||||
@@ -50,6 +50,7 @@ extern char * strstr(const char * s1, co
|
||||
#ifdef CONFIG_KERNEL_XZ
|
||||
#define memmove memmove
|
||||
#define memcpy memcpy
|
||||
+extern char * strstr(const char *, const char *);
|
||||
#include "../../../../lib/decompress_unxz.c"
|
||||
#endif
|
||||
|
@ -1,66 +0,0 @@
|
||||
From 0db3db45f5bd6df4bdc03bbd5dec672e16164c4e Mon Sep 17 00:00:00 2001
|
||||
From: Florian Fainelli <florian@openwrt.org>
|
||||
Date: Mon, 12 Nov 2012 12:31:55 +0100
|
||||
Subject: [PATCH] MIPS: decompressor: fix build failure on memcpy() in
|
||||
decompress.c
|
||||
|
||||
The decompress.c file includes linux/kernel.h which causes the following
|
||||
inclusion chain to be pulled:
|
||||
linux/kernel.h ->
|
||||
linux/dynamic_debug.h ->
|
||||
linux/string.h ->
|
||||
asm/string.h
|
||||
|
||||
We end up having a the GCC builtin + architecture specific memcpy() expanding
|
||||
into this:
|
||||
|
||||
void *({ size_t __len = (size_t n); void *__ret; if
|
||||
(__builtin_constant_p(size_t n) && __len >= 64) __ret = memcpy((void *dest),
|
||||
(const void *src), __len); else __ret = __builtin_memcpy((void *dest), (const
|
||||
void *src), __len); __ret; })
|
||||
{
|
||||
[memcpy implementation in decompress.c starts here]
|
||||
int i;
|
||||
const char *s = src;
|
||||
char *d = dest;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
d[i] = s[i];
|
||||
return dest;
|
||||
}
|
||||
|
||||
raising the following compilation error:
|
||||
arch/mips/boot/compressed/decompress.c:46:8: error: expected identifier or '('
|
||||
before '{' token
|
||||
|
||||
There are at least three possibilities to fix this issue:
|
||||
|
||||
1) define _LINUX_STRING_H_ at the beginning of decompress.c to prevent
|
||||
further linux/string.h definitions and declarations from being used, and add
|
||||
an explicit strstr() declaration for linux/dynamic_debug.h
|
||||
|
||||
2) remove the inclusion of linux/kernel.h because we actually use no definition
|
||||
or declaration from this header file
|
||||
|
||||
3) undefine memcpy or re-define memcpy to memcpy thus resulting in picking up
|
||||
the local memcpy() implementation to this compilation unit
|
||||
|
||||
This patch uses the second option which is the less intrusive one.
|
||||
|
||||
Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
||||
---
|
||||
arch/mips/boot/compressed/decompress.c | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
--- a/arch/mips/boot/compressed/decompress.c
|
||||
+++ b/arch/mips/boot/compressed/decompress.c
|
||||
@@ -10,9 +10,7 @@
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*/
|
||||
-
|
||||
#include <linux/types.h>
|
||||
-#include <linux/kernel.h>
|
||||
|
||||
#include <asm/addrspace.h>
|
||||
|
@ -1,187 +0,0 @@
|
||||
commit 01ffc0a7f1c1801a2354719dedbc32aff45b987d
|
||||
Author: David Woodhouse <dwmw2@infradead.org>
|
||||
Date: Sat Nov 24 12:11:21 2012 +0000
|
||||
|
||||
8139cp: re-enable interrupts after tx timeout
|
||||
|
||||
Recovery doesn't work too well if we leave interrupts disabled...
|
||||
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
commit 871f0d4c153e1258d4becf306eca6761bf38b629
|
||||
Author: David Woodhouse <dwmw2@infradead.org>
|
||||
Date: Thu Nov 22 03:16:58 2012 +0000
|
||||
|
||||
8139cp: enable bql
|
||||
|
||||
This adds support for byte queue limits on RTL8139C+
|
||||
|
||||
Tested on real hardware.
|
||||
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Acked-By: Dave Täht <dave.taht@bufferbloat.net>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
commit a9dbe40fc10cea2efe6e1ff9e03c62dd7579c5ba
|
||||
Author: David Woodhouse <dwmw2@infradead.org>
|
||||
Date: Wed Nov 21 10:27:19 2012 +0000
|
||||
|
||||
8139cp: set ring address after enabling C+ mode
|
||||
|
||||
This fixes (for me) a regression introduced by commit b01af457 ("8139cp:
|
||||
set ring address before enabling receiver"). That commit configured the
|
||||
descriptor ring addresses earlier in the initialisation sequence, in
|
||||
order to avoid the possibility of triggering stray DMA before the
|
||||
correct address had been set up.
|
||||
|
||||
Unfortunately, it seems that the hardware will scribble garbage into the
|
||||
TxRingAddr registers when we enable "plus mode" Tx in the CpCmd
|
||||
register. Observed on a Traverse Geos router board.
|
||||
|
||||
To deal with this, while not reintroducing the problem which led to the
|
||||
original commit, we augment cp_start_hw() to write to the CpCmd register
|
||||
*first*, then set the descriptor ring addresses, and then finally to
|
||||
enable Rx and Tx in the original 8139 Cmd register. The datasheet
|
||||
actually indicates that we should enable Tx/Rx in the Cmd register
|
||||
*before* configuring the descriptor addresses, but that would appear to
|
||||
re-introduce the problem that the offending commit b01af457 was trying
|
||||
to solve. And this variant appears to work fine on real hardware.
|
||||
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Cc: stable@kernel.org [3.5+]
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
commit 071e3ef4a94a021b16a2912f3885c86f4ff36b49
|
||||
Author: David S. Miller <davem@davemloft.net>
|
||||
Date: Sun Nov 25 15:52:09 2012 -0500
|
||||
|
||||
Revert "8139cp: revert "set ring address before enabling receiver""
|
||||
|
||||
This reverts commit b26623dab7eeb1e9f5898c7a49458789dd492f20.
|
||||
|
||||
This reverts the revert, in net-next we'll try another scheme
|
||||
to fix this bug using patches from David Woodhouse.
|
||||
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/8139cp.c
|
||||
+++ b/drivers/net/ethernet/realtek/8139cp.c
|
||||
@@ -648,6 +648,7 @@ static void cp_tx (struct cp_private *cp
|
||||
{
|
||||
unsigned tx_head = cp->tx_head;
|
||||
unsigned tx_tail = cp->tx_tail;
|
||||
+ unsigned bytes_compl = 0, pkts_compl = 0;
|
||||
|
||||
while (tx_tail != tx_head) {
|
||||
struct cp_desc *txd = cp->tx_ring + tx_tail;
|
||||
@@ -666,6 +667,9 @@ static void cp_tx (struct cp_private *cp
|
||||
le32_to_cpu(txd->opts1) & 0xffff,
|
||||
PCI_DMA_TODEVICE);
|
||||
|
||||
+ bytes_compl += skb->len;
|
||||
+ pkts_compl++;
|
||||
+
|
||||
if (status & LastFrag) {
|
||||
if (status & (TxError | TxFIFOUnder)) {
|
||||
netif_dbg(cp, tx_err, cp->dev,
|
||||
@@ -697,6 +701,7 @@ static void cp_tx (struct cp_private *cp
|
||||
|
||||
cp->tx_tail = tx_tail;
|
||||
|
||||
+ netdev_completed_queue(cp->dev, pkts_compl, bytes_compl);
|
||||
if (TX_BUFFS_AVAIL(cp) > (MAX_SKB_FRAGS + 1))
|
||||
netif_wake_queue(cp->dev);
|
||||
}
|
||||
@@ -843,6 +848,8 @@ static netdev_tx_t cp_start_xmit (struct
|
||||
wmb();
|
||||
}
|
||||
cp->tx_head = entry;
|
||||
+
|
||||
+ netdev_sent_queue(dev, skb->len);
|
||||
netif_dbg(cp, tx_queued, cp->dev, "tx queued, slot %d, skblen %d\n",
|
||||
entry, skb->len);
|
||||
if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1))
|
||||
@@ -937,6 +944,8 @@ static void cp_stop_hw (struct cp_privat
|
||||
|
||||
cp->rx_tail = 0;
|
||||
cp->tx_head = cp->tx_tail = 0;
|
||||
+
|
||||
+ netdev_reset_queue(cp->dev);
|
||||
}
|
||||
|
||||
static void cp_reset_hw (struct cp_private *cp)
|
||||
@@ -957,8 +966,38 @@ static void cp_reset_hw (struct cp_priva
|
||||
|
||||
static inline void cp_start_hw (struct cp_private *cp)
|
||||
{
|
||||
+ dma_addr_t ring_dma;
|
||||
+
|
||||
cpw16(CpCmd, cp->cpcmd);
|
||||
+
|
||||
+ /*
|
||||
+ * These (at least TxRingAddr) need to be configured after the
|
||||
+ * corresponding bits in CpCmd are enabled. Datasheet v1.6 §6.33
|
||||
+ * (C+ Command Register) recommends that these and more be configured
|
||||
+ * *after* the [RT]xEnable bits in CpCmd are set. And on some hardware
|
||||
+ * it's been observed that the TxRingAddr is actually reset to garbage
|
||||
+ * when C+ mode Tx is enabled in CpCmd.
|
||||
+ */
|
||||
+ cpw32_f(HiTxRingAddr, 0);
|
||||
+ cpw32_f(HiTxRingAddr + 4, 0);
|
||||
+
|
||||
+ ring_dma = cp->ring_dma;
|
||||
+ cpw32_f(RxRingAddr, ring_dma & 0xffffffff);
|
||||
+ cpw32_f(RxRingAddr + 4, (ring_dma >> 16) >> 16);
|
||||
+
|
||||
+ ring_dma += sizeof(struct cp_desc) * CP_RX_RING_SIZE;
|
||||
+ cpw32_f(TxRingAddr, ring_dma & 0xffffffff);
|
||||
+ cpw32_f(TxRingAddr + 4, (ring_dma >> 16) >> 16);
|
||||
+
|
||||
+ /*
|
||||
+ * Strictly speaking, the datasheet says this should be enabled
|
||||
+ * *before* setting the descriptor addresses. But what, then, would
|
||||
+ * prevent it from doing DMA to random unconfigured addresses?
|
||||
+ * This variant appears to work fine.
|
||||
+ */
|
||||
cpw8(Cmd, RxOn | TxOn);
|
||||
+
|
||||
+ netdev_reset_queue(cp->dev);
|
||||
}
|
||||
|
||||
static void cp_enable_irq(struct cp_private *cp)
|
||||
@@ -969,7 +1008,6 @@ static void cp_enable_irq(struct cp_priv
|
||||
static void cp_init_hw (struct cp_private *cp)
|
||||
{
|
||||
struct net_device *dev = cp->dev;
|
||||
- dma_addr_t ring_dma;
|
||||
|
||||
cp_reset_hw(cp);
|
||||
|
||||
@@ -992,17 +1030,6 @@ static void cp_init_hw (struct cp_privat
|
||||
|
||||
cpw8(Config5, cpr8(Config5) & PMEStatus);
|
||||
|
||||
- cpw32_f(HiTxRingAddr, 0);
|
||||
- cpw32_f(HiTxRingAddr + 4, 0);
|
||||
-
|
||||
- ring_dma = cp->ring_dma;
|
||||
- cpw32_f(RxRingAddr, ring_dma & 0xffffffff);
|
||||
- cpw32_f(RxRingAddr + 4, (ring_dma >> 16) >> 16);
|
||||
-
|
||||
- ring_dma += sizeof(struct cp_desc) * CP_RX_RING_SIZE;
|
||||
- cpw32_f(TxRingAddr, ring_dma & 0xffffffff);
|
||||
- cpw32_f(TxRingAddr + 4, (ring_dma >> 16) >> 16);
|
||||
-
|
||||
cpw16(MultiIntr, 0);
|
||||
|
||||
cpw8_f(Cfg9346, Cfg9346_Lock);
|
||||
@@ -1197,6 +1224,7 @@ static void cp_tx_timeout(struct net_dev
|
||||
cp_clean_rings(cp);
|
||||
rc = cp_init_rings(cp);
|
||||
cp_start_hw(cp);
|
||||
+ cp_enable_irq(cp);
|
||||
|
||||
netif_wake_queue(dev);
|
||||
|
@ -1,41 +0,0 @@
|
||||
From 0714f2ec1e950d7b825093d05ae8eacf1d66ce58 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Fainelli <florian@openwrt.org>
|
||||
Date: Mon, 10 Dec 2012 15:52:07 +0100
|
||||
Subject: [PATCH 3.7-rc8] MIPS: MT: fix build with CONFIG_UIDGID_STRICT_TYPE_CHECKS=y
|
||||
|
||||
When CONFIG_UIDGID_STRICT_TYPE_CHECKS is enabled, plain integer checking
|
||||
between different uids/gids is explicitely turned into a build failure
|
||||
by making the k{uid,gid}_t types a structure containing a value:
|
||||
|
||||
arch/mips/kernel/mips-mt-fpaff.c: In function 'check_same_owner':
|
||||
arch/mips/kernel/mips-mt-fpaff.c:53:22: error: invalid operands to
|
||||
binary == (have 'kuid_t' and 'kuid_t')
|
||||
arch/mips/kernel/mips-mt-fpaff.c:54:15: error: invalid operands to
|
||||
binary == (have 'kuid_t' and 'kuid_t')
|
||||
|
||||
This problem got introduced with commit 17c04139 (MIPS: MT: Fix FPU affinity.)
|
||||
|
||||
In order to ensure proper comparison between uids, using the helper
|
||||
function uid_eq() which performs the right thing whenever this config
|
||||
option is turned on or off.
|
||||
|
||||
Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
||||
---
|
||||
Ralf, I think you might want to sneak this into 3.7-rc8 if possible at all.
|
||||
|
||||
arch/mips/kernel/mips-mt-fpaff.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/arch/mips/kernel/mips-mt-fpaff.c
|
||||
+++ b/arch/mips/kernel/mips-mt-fpaff.c
|
||||
@@ -50,8 +50,8 @@ static bool check_same_owner(struct task
|
||||
|
||||
rcu_read_lock();
|
||||
pcred = __task_cred(p);
|
||||
- match = (cred->euid == pcred->euid ||
|
||||
- cred->euid == pcred->uid);
|
||||
+ match = (uid_eq(cred->euid, pcred->euid) ||
|
||||
+ uid_eq(cred->euid, pcred->uid));
|
||||
rcu_read_unlock();
|
||||
return match;
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
From 031d8ad2c3cee85c515e551fc8c0054bdedb7b8b Mon Sep 17 00:00:00 2001
|
||||
From: Florian Fainelli <florian@openwrt.org>
|
||||
Date: Thu, 13 Dec 2012 18:02:11 +0100
|
||||
Subject: [PATCH] x86: fix perf build with uclibc toolchains
|
||||
|
||||
libio.h is not provided by uClibc, in order to be able to test the
|
||||
definition of __UCLIBC__ we need to include stdlib.h, which also
|
||||
includes stddef.h, providing the definition of 'NULL'
|
||||
|
||||
Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
||||
---
|
||||
tools/perf/arch/x86/util/dwarf-regs.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/tools/perf/arch/x86/util/dwarf-regs.c
|
||||
+++ b/tools/perf/arch/x86/util/dwarf-regs.c
|
||||
@@ -20,7 +20,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
+#include <stdlib.h>
|
||||
+#ifndef __UCLIBC__
|
||||
#include <libio.h>
|
||||
+#endif
|
||||
#include <dwarf-regs.h>
|
||||
|
||||
/*
|
File diff suppressed because it is too large
Load Diff
@ -1,41 +0,0 @@
|
||||
--- a/drivers/usb/host/ehci-hcd.c
|
||||
+++ b/drivers/usb/host/ehci-hcd.c
|
||||
@@ -645,7 +645,7 @@ static int ehci_run (struct usb_hcd *hcd
|
||||
"USB %x.%x started, EHCI %x.%02x%s\n",
|
||||
((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f),
|
||||
temp >> 8, temp & 0xff,
|
||||
- ignore_oc ? ", overcurrent ignored" : "");
|
||||
+ (ignore_oc || ehci->ignore_oc) ? ", overcurrent ignored" : "");
|
||||
|
||||
ehci_writel(ehci, INTR_MASK,
|
||||
&ehci->regs->intr_enable); /* Turn On Interrupts */
|
||||
--- a/drivers/usb/host/ehci-hub.c
|
||||
+++ b/drivers/usb/host/ehci-hub.c
|
||||
@@ -585,7 +585,7 @@ ehci_hub_status_data (struct usb_hcd *hc
|
||||
* always set, seem to clear PORT_OCC and PORT_CSC when writing to
|
||||
* PORT_POWER; that's surprising, but maybe within-spec.
|
||||
*/
|
||||
- if (!ignore_oc)
|
||||
+ if (!ignore_oc && !ehci->ignore_oc)
|
||||
mask = PORT_CSC | PORT_PEC | PORT_OCC;
|
||||
else
|
||||
mask = PORT_CSC | PORT_PEC;
|
||||
@@ -808,7 +808,7 @@ static int ehci_hub_control (
|
||||
if (temp & PORT_PEC)
|
||||
status |= USB_PORT_STAT_C_ENABLE << 16;
|
||||
|
||||
- if ((temp & PORT_OCC) && !ignore_oc){
|
||||
+ if ((temp & PORT_OCC) && (!ignore_oc && !ehci->ignore_oc)){
|
||||
status |= USB_PORT_STAT_C_OVERCURRENT << 16;
|
||||
|
||||
/*
|
||||
--- a/drivers/usb/host/ehci.h
|
||||
+++ b/drivers/usb/host/ehci.h
|
||||
@@ -197,6 +197,7 @@ struct ehci_hcd { /* one per controlle
|
||||
unsigned use_dummy_qh:1; /* AMD Frame List table quirk*/
|
||||
unsigned has_synopsys_hc_bug:1; /* Synopsys HC */
|
||||
unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */
|
||||
+ unsigned ignore_oc:1;
|
||||
|
||||
/* required for usb32 quirk */
|
||||
#define OHCI_CTRL_HCFS (3 << 6)
|
@ -1,10 +0,0 @@
|
||||
--- a/include/linux/mtd/physmap.h
|
||||
+++ b/include/linux/mtd/physmap.h
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
+#include <linux/platform_device.h>
|
||||
|
||||
struct map_info;
|
||||
struct platform_device;
|
@ -1,900 +0,0 @@
|
||||
commit d7d3d8f1ee4435e32bc6c93187798b7e2e3170a9
|
||||
Author: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Date: Thu Nov 29 23:28:30 2012 +0000
|
||||
|
||||
solos-pci: remove list_vccs() debugging function
|
||||
|
||||
No idea why we've gone so long dumping a list of VCCs with vci==0 on
|
||||
every ->open() call...
|
||||
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
|
||||
commit c93967bfd3a3dffa759a3f28370167bf3cdbc3d0
|
||||
Author: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Date: Thu Nov 29 23:27:20 2012 +0000
|
||||
|
||||
solos-pci: use GFP_KERNEL where possible, not GFP_ATOMIC
|
||||
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
|
||||
commit ad6999e17ae4f7b99f6d28f425ae970acb115347
|
||||
Author: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Date: Thu Nov 29 23:15:30 2012 +0000
|
||||
|
||||
solos-pci: clean up pclose() function
|
||||
|
||||
- Flush pending TX skbs from the queue rather than waiting for them all to
|
||||
complete (suggested by Krzysztof Mazur <krzysiek@podlesie.net>).
|
||||
- Clear ATM_VF_ADDR only when the PKT_PCLOSE packet has been submitted.
|
||||
- Don't clear ATM_VF_READY at all — vcc_destroy_socket() does that for us.
|
||||
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
|
||||
commit 2547e97f29d6d69d567947d5ef90b6b4fbcaf565
|
||||
Author: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Date: Wed Nov 28 10:15:05 2012 +0000
|
||||
|
||||
pppoatm: optimise PPP channel wakeups after sock_owned_by_user()
|
||||
|
||||
We don't need to schedule the wakeup tasklet on *every* unlock; only if we
|
||||
actually blocked the channel in the first place.
|
||||
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Acked-by: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
|
||||
commit 990b0884a2e9668c08e9daa4d70a54d65329cb6f
|
||||
Author: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
Date: Wed Nov 28 09:08:04 2012 +0100
|
||||
|
||||
br2684: allow assign only on a connected socket
|
||||
|
||||
The br2684 does not check if used vcc is in connected state,
|
||||
causing potential Oops in pppoatm_send() when vcc->send() is called
|
||||
on not fully connected socket.
|
||||
|
||||
Now br2684 can be assigned only on connected sockets; otherwise
|
||||
-EINVAL error is returned.
|
||||
|
||||
Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
|
||||
commit f49b6da01f0abebb17f6241473d53018d923f6b0
|
||||
Author: Nathan Williams <nathan@traverse.com.au>
|
||||
Date: Tue Nov 27 17:34:09 2012 +1100
|
||||
|
||||
solos-pci: Fix leak of skb received for unknown vcc
|
||||
|
||||
... and ensure that the next skb is set up for RX in the DMA case.
|
||||
|
||||
Signed-off-by: Nathan Williams <nathan@traverse.com.au>
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
|
||||
commit a61d37ff4a555886c4ebe31d2c6d893afb6f4d3c
|
||||
Author: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Date: Wed Nov 28 00:46:45 2012 +0000
|
||||
|
||||
br2684: fix module_put() race
|
||||
|
||||
The br2684 code used module_put() during unassignment from vcc with
|
||||
hope that we have BKL. This assumption is no longer true.
|
||||
|
||||
Now owner field in atmvcc is used to move this module_put()
|
||||
to vcc_destroy_socket().
|
||||
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Acked-by: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
|
||||
commit c52f40629884ddc62c7af445fd5d620fdb466fb2
|
||||
Author: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Date: Wed Nov 28 00:05:52 2012 +0000
|
||||
|
||||
pppoatm: fix missing wakeup in pppoatm_send()
|
||||
|
||||
Now that we can return zero from pppoatm_send() for reasons *other* than
|
||||
the queue being full, that means we can't depend on a subsequent call to
|
||||
pppoatm_pop() waking the queue, and we might leave it stalled
|
||||
indefinitely.
|
||||
|
||||
Use the ->release_cb() callback to wake the queue after the sock is
|
||||
unlocked.
|
||||
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Acked-by: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
|
||||
commit 35826e7372fe39b7db7930eda0267c82d68d1a4c
|
||||
Author: David Woodhouse <dwmw2@infradead.org>
|
||||
Date: Tue Nov 27 23:28:36 2012 +0000
|
||||
|
||||
br2684: don't send frames on not-ready vcc
|
||||
|
||||
Avoid submitting packets to a vcc which is being closed. Things go badly
|
||||
wrong when the ->pop method gets later called after everything's been
|
||||
torn down.
|
||||
|
||||
Use the ATM socket lock for synchronisation with vcc_destroy_socket(),
|
||||
which clears the ATM_VF_READY bit under the same lock. Otherwise, we
|
||||
could end up submitting a packet to the device driver even after its
|
||||
->ops->close method has been called. And it could call the vcc's ->pop
|
||||
method after the protocol has been shut down. Which leads to a panic.
|
||||
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Acked-by: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
|
||||
commit 7f940dde65de4a707f3dd723bb6ce9de90ca1eab
|
||||
Author: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Date: Wed Nov 28 00:03:11 2012 +0000
|
||||
|
||||
atm: add release_cb() callback to vcc
|
||||
|
||||
The immediate use case for this is that it will allow us to ensure that a
|
||||
pppoatm queue is woken after it has to drop a packet due to the sock being
|
||||
locked.
|
||||
|
||||
Note that 'release_cb' is called when the socket is *unlocked*. This is
|
||||
not to be confused with vcc_release() — which probably ought to be called
|
||||
vcc_close().
|
||||
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Acked-by: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
|
||||
commit def1b2f9083f84d0a77730e537c76429914d17c1
|
||||
Author: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Date: Tue Nov 27 23:49:24 2012 +0000
|
||||
|
||||
solos-pci: wait for pending TX to complete when releasing vcc
|
||||
|
||||
We should no longer be calling the old pop routine for the vcc, after
|
||||
vcc_release() has completed. Make sure we wait for any pending TX skbs
|
||||
to complete, by waiting for our own PKT_PCLOSE control skb to be sent.
|
||||
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
|
||||
commit 397ff16dce53888ec693b3718640be2560204751
|
||||
Author: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
Date: Tue Nov 6 23:17:02 2012 +0100
|
||||
|
||||
pppoatm: do not inline pppoatm_may_send()
|
||||
|
||||
The pppoatm_may_send() is quite heavy and it's called three times
|
||||
in pppoatm_send() and inlining costs more than 200 bytes of code
|
||||
(more than 10% of total pppoatm driver code size).
|
||||
|
||||
add/remove: 1/0 grow/shrink: 0/1 up/down: 132/-367 (-235)
|
||||
function old new delta
|
||||
pppoatm_may_send - 132 +132
|
||||
pppoatm_send 900 533 -367
|
||||
|
||||
Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
|
||||
commit 071d93931a75dc1f82f0baa9959613af81c5a032
|
||||
Author: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
Date: Sat Nov 10 23:33:19 2012 +0100
|
||||
|
||||
pppoatm: drop frames to not-ready vcc
|
||||
|
||||
The vcc_destroy_socket() closes vcc before the protocol is detached
|
||||
from vcc by calling vcc->push() with NULL skb. This leaves some time
|
||||
window, where the protocol may call vcc->send() on closed vcc
|
||||
and crash.
|
||||
|
||||
Now pppoatm_send(), like vcc_sendmsg(), checks for vcc flags that
|
||||
indicate that vcc is not ready. If the vcc is not ready we just
|
||||
drop frame. Queueing frames is much more complicated because we
|
||||
don't have callbacks that inform us about vcc flags changes.
|
||||
|
||||
Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
|
||||
commit 3ac108006fd7f20cb8fc8ea2287f1497bcda00a1
|
||||
Author: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
Date: Tue Nov 6 23:17:00 2012 +0100
|
||||
|
||||
pppoatm: take ATM socket lock in pppoatm_send()
|
||||
|
||||
The pppoatm_send() does not take any lock that will prevent concurrent
|
||||
vcc_sendmsg(). This causes two problems:
|
||||
|
||||
- there is no locking between checking the send queue size
|
||||
with atm_may_send() and incrementing sk_wmem_alloc,
|
||||
and the real queue size can be a little higher than sk_sndbuf
|
||||
|
||||
- the vcc->sendmsg() can be called concurrently. I'm not sure
|
||||
if it's allowed. Some drivers (eni, nicstar, ...) seem
|
||||
to assume it will never happen.
|
||||
|
||||
Now pppoatm_send() takes ATM socket lock, the same that is used
|
||||
in vcc_sendmsg() and other ATM socket functions. The pppoatm_send()
|
||||
is called with BH disabled, so bh_lock_sock() is used instead
|
||||
of lock_sock().
|
||||
|
||||
Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
Cc: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
|
||||
commit e41faed9cde1acce657f75a0b19a1787e9850d3f
|
||||
Author: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
Date: Tue Nov 6 23:16:59 2012 +0100
|
||||
|
||||
pppoatm: fix module_put() race
|
||||
|
||||
The pppoatm used module_put() during unassignment from vcc with
|
||||
hope that we have BKL. This assumption is no longer true.
|
||||
|
||||
Now owner field in atmvcc is used to move this module_put()
|
||||
to vcc_destroy_socket().
|
||||
|
||||
Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
|
||||
commit 3b1a914595f3f9beb9e38ff3ddc7bdafa092ba22
|
||||
Author: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
Date: Tue Nov 6 23:16:58 2012 +0100
|
||||
|
||||
pppoatm: allow assign only on a connected socket
|
||||
|
||||
The pppoatm does not check if used vcc is in connected state,
|
||||
causing an Oops in pppoatm_send() when vcc->send() is called
|
||||
on not fully connected socket.
|
||||
|
||||
Now pppoatm can be assigned only on connected sockets; otherwise
|
||||
-EINVAL error is returned.
|
||||
|
||||
Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
Cc: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
|
||||
commit ec809bd817dfa1905283468e4c813684ed4efe78
|
||||
Author: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
Date: Tue Nov 6 23:16:57 2012 +0100
|
||||
|
||||
atm: add owner of push() callback to atmvcc
|
||||
|
||||
The atm is using atmvcc->push(vcc, NULL) callback to notify protocol
|
||||
that vcc will be closed and protocol must detach from it. This callback
|
||||
is usually used by protocol to decrement module usage count by module_put(),
|
||||
but it leaves small window then module is still used after module_put().
|
||||
|
||||
Now the owner of push() callback is kept in atmvcc and
|
||||
module_put(atmvcc->owner) is called after the protocol is detached from vcc.
|
||||
|
||||
Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Acked-by: Chas Williams <chas@cmf.nrl.navy.mil>
|
||||
|
||||
commit ae088d663beebb3cad0e7abaac67ee61a7c578d5
|
||||
Author: David Woodhouse <dwmw2@infradead.org>
|
||||
Date: Sun Nov 25 12:06:52 2012 +0000
|
||||
|
||||
atm: br2684: Fix excessive queue bloat
|
||||
|
||||
There's really no excuse for an additional wmem_default of buffering
|
||||
between the netdev queue and the ATM device. Two packets (one in-flight,
|
||||
and one ready to send) ought to be fine. It's not as if it should take
|
||||
long to get another from the netdev queue when we need it.
|
||||
|
||||
If necessary we can make the queue space configurable later, but I don't
|
||||
think it's likely to be necessary.
|
||||
|
||||
cf. commit 9d02daf754238adac48fa075ee79e7edd3d79ed3 (pppoatm: Fix
|
||||
excessive queue bloat) which did something very similar for PPPoATM.
|
||||
|
||||
Note that there is a tremendously unlikely race condition which may
|
||||
result in qspace temporarily going negative. If a CPU running the
|
||||
br2684_pop() function goes off into the weeds for a long period of time
|
||||
after incrementing qspace to 1, but before calling netdev_wake_queue()...
|
||||
and another CPU ends up calling br2684_start_xmit() and *stopping* the
|
||||
queue again before the first CPU comes back, the netdev queue could
|
||||
end up being woken when qspace has already reached zero.
|
||||
|
||||
An alternative approach to coping with this race would be to check in
|
||||
br2684_start_xmit() for qspace==0 and return NETDEV_TX_BUSY, but just
|
||||
using '> 0' and '< 1' for comparison instead of '== 0' and '!= 0' is
|
||||
simpler. It just warranted a mention of *why* we do it that way...
|
||||
|
||||
Move the call to atmvcc->send() to happen *after* the accounting and
|
||||
potentially stopping the netdev queue, in br2684_xmit_vcc(). This matters
|
||||
if the ->send() call suffers an immediate failure, because it'll call
|
||||
br2684_pop() with the offending skb before returning. We want that to
|
||||
happen *after* we've done the initial accounting for the packet in
|
||||
question. Also make it return an appropriate success/failure indication
|
||||
while we're at it.
|
||||
|
||||
Tested by running 'ping -l 1000 bottomless.aaisp.net.uk' from within my
|
||||
network, with only a single PPPoE-over-BR2684 link running. And after
|
||||
setting txqueuelen on the nas0 interface to something low (5, in fact).
|
||||
Before the patch, we'd see about 15 packets being queued and a resulting
|
||||
latency of ~56ms being reached. After the patch, we see only about 8,
|
||||
which is fairly much what we expect. And a max latency of ~36ms. On this
|
||||
OpenWRT box, wmem_default is 163840.
|
||||
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Reviewed-by: Krzysztof Mazur <krzysiek@podlesie.net>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
--- a/drivers/atm/solos-pci.c
|
||||
+++ b/drivers/atm/solos-pci.c
|
||||
@@ -92,6 +92,7 @@ struct pkt_hdr {
|
||||
};
|
||||
|
||||
struct solos_skb_cb {
|
||||
+ struct completion c;
|
||||
struct atm_vcc *vcc;
|
||||
uint32_t dma_addr;
|
||||
};
|
||||
@@ -164,7 +165,6 @@ static void fpga_queue(struct solos_card
|
||||
static uint32_t fpga_tx(struct solos_card *);
|
||||
static irqreturn_t solos_irq(int irq, void *dev_id);
|
||||
static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci);
|
||||
-static int list_vccs(int vci);
|
||||
static int atm_init(struct solos_card *, struct device *);
|
||||
static void atm_remove(struct solos_card *);
|
||||
static int send_command(struct solos_card *card, int dev, const char *buf, size_t size);
|
||||
@@ -710,7 +710,8 @@ void solos_bh(unsigned long card_arg)
|
||||
dev_warn(&card->dev->dev, "Received packet for unknown VPI.VCI %d.%d on port %d\n",
|
||||
le16_to_cpu(header->vpi), le16_to_cpu(header->vci),
|
||||
port);
|
||||
- continue;
|
||||
+ dev_kfree_skb_any(skb);
|
||||
+ break;
|
||||
}
|
||||
atm_charge(vcc, skb->truesize);
|
||||
vcc->push(vcc, skb);
|
||||
@@ -790,44 +791,6 @@ static struct atm_vcc *find_vcc(struct a
|
||||
return vcc;
|
||||
}
|
||||
|
||||
-static int list_vccs(int vci)
|
||||
-{
|
||||
- struct hlist_head *head;
|
||||
- struct atm_vcc *vcc;
|
||||
- struct hlist_node *node;
|
||||
- struct sock *s;
|
||||
- int num_found = 0;
|
||||
- int i;
|
||||
-
|
||||
- read_lock(&vcc_sklist_lock);
|
||||
- if (vci != 0){
|
||||
- head = &vcc_hash[vci & (VCC_HTABLE_SIZE -1)];
|
||||
- sk_for_each(s, node, head) {
|
||||
- num_found ++;
|
||||
- vcc = atm_sk(s);
|
||||
- printk(KERN_DEBUG "Device: %d Vpi: %d Vci: %d\n",
|
||||
- vcc->dev->number,
|
||||
- vcc->vpi,
|
||||
- vcc->vci);
|
||||
- }
|
||||
- } else {
|
||||
- for(i = 0; i < VCC_HTABLE_SIZE; i++){
|
||||
- head = &vcc_hash[i];
|
||||
- sk_for_each(s, node, head) {
|
||||
- num_found ++;
|
||||
- vcc = atm_sk(s);
|
||||
- printk(KERN_DEBUG "Device: %d Vpi: %d Vci: %d\n",
|
||||
- vcc->dev->number,
|
||||
- vcc->vpi,
|
||||
- vcc->vci);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- read_unlock(&vcc_sklist_lock);
|
||||
- return num_found;
|
||||
-}
|
||||
-
|
||||
-
|
||||
static int popen(struct atm_vcc *vcc)
|
||||
{
|
||||
struct solos_card *card = vcc->dev->dev_data;
|
||||
@@ -840,7 +803,7 @@ static int popen(struct atm_vcc *vcc)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
- skb = alloc_skb(sizeof(*header), GFP_ATOMIC);
|
||||
+ skb = alloc_skb(sizeof(*header), GFP_KERNEL);
|
||||
if (!skb) {
|
||||
if (net_ratelimit())
|
||||
dev_warn(&card->dev->dev, "Failed to allocate sk_buff in popen()\n");
|
||||
@@ -857,8 +820,6 @@ static int popen(struct atm_vcc *vcc)
|
||||
|
||||
set_bit(ATM_VF_ADDR, &vcc->flags);
|
||||
set_bit(ATM_VF_READY, &vcc->flags);
|
||||
- list_vccs(0);
|
||||
-
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -866,10 +827,21 @@ static int popen(struct atm_vcc *vcc)
|
||||
static void pclose(struct atm_vcc *vcc)
|
||||
{
|
||||
struct solos_card *card = vcc->dev->dev_data;
|
||||
- struct sk_buff *skb;
|
||||
+ unsigned char port = SOLOS_CHAN(vcc->dev);
|
||||
+ struct sk_buff *skb, *tmpskb;
|
||||
struct pkt_hdr *header;
|
||||
|
||||
- skb = alloc_skb(sizeof(*header), GFP_ATOMIC);
|
||||
+ /* Remove any yet-to-be-transmitted packets from the pending queue */
|
||||
+ spin_lock(&card->tx_queue_lock);
|
||||
+ skb_queue_walk_safe(&card->tx_queue[port], skb, tmpskb) {
|
||||
+ if (SKB_CB(skb)->vcc == vcc) {
|
||||
+ skb_unlink(skb, &card->tx_queue[port]);
|
||||
+ solos_pop(vcc, skb);
|
||||
+ }
|
||||
+ }
|
||||
+ spin_unlock(&card->tx_queue_lock);
|
||||
+
|
||||
+ skb = alloc_skb(sizeof(*header), GFP_KERNEL);
|
||||
if (!skb) {
|
||||
dev_warn(&card->dev->dev, "Failed to allocate sk_buff in pclose()\n");
|
||||
return;
|
||||
@@ -881,15 +853,21 @@ static void pclose(struct atm_vcc *vcc)
|
||||
header->vci = cpu_to_le16(vcc->vci);
|
||||
header->type = cpu_to_le16(PKT_PCLOSE);
|
||||
|
||||
- fpga_queue(card, SOLOS_CHAN(vcc->dev), skb, NULL);
|
||||
+ init_completion(&SKB_CB(skb)->c);
|
||||
|
||||
- clear_bit(ATM_VF_ADDR, &vcc->flags);
|
||||
- clear_bit(ATM_VF_READY, &vcc->flags);
|
||||
+ fpga_queue(card, port, skb, NULL);
|
||||
+
|
||||
+ if (!wait_for_completion_timeout(&SKB_CB(skb)->c, 5 * HZ))
|
||||
+ dev_warn(&card->dev->dev, "Timeout waiting for VCC close on port %d\n",
|
||||
+ port);
|
||||
|
||||
/* Hold up vcc_destroy_socket() (our caller) until solos_bh() in the
|
||||
tasklet has finished processing any incoming packets (and, more to
|
||||
the point, using the vcc pointer). */
|
||||
tasklet_unlock_wait(&card->tlet);
|
||||
+
|
||||
+ clear_bit(ATM_VF_ADDR, &vcc->flags);
|
||||
+
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1012,9 +990,12 @@ static uint32_t fpga_tx(struct solos_car
|
||||
if (vcc) {
|
||||
atomic_inc(&vcc->stats->tx);
|
||||
solos_pop(vcc, oldskb);
|
||||
- } else
|
||||
+ } else {
|
||||
+ struct pkt_hdr *header = (void *)oldskb->data;
|
||||
+ if (le16_to_cpu(header->type) == PKT_PCLOSE)
|
||||
+ complete(&SKB_CB(oldskb)->c);
|
||||
dev_kfree_skb_irq(oldskb);
|
||||
-
|
||||
+ }
|
||||
}
|
||||
}
|
||||
/* For non-DMA TX, write the 'TX start' bit for all four ports simultaneously */
|
||||
@@ -1249,7 +1230,7 @@ static int atm_init(struct solos_card *c
|
||||
card->atmdev[i]->phy_data = (void *)(unsigned long)i;
|
||||
atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_FOUND);
|
||||
|
||||
- skb = alloc_skb(sizeof(*header), GFP_ATOMIC);
|
||||
+ skb = alloc_skb(sizeof(*header), GFP_KERNEL);
|
||||
if (!skb) {
|
||||
dev_warn(&card->dev->dev, "Failed to allocate sk_buff in atm_init()\n");
|
||||
continue;
|
||||
@@ -1346,6 +1327,8 @@ static struct pci_driver fpga_driver = {
|
||||
|
||||
static int __init solos_pci_init(void)
|
||||
{
|
||||
+ BUILD_BUG_ON(sizeof(struct solos_skb_cb) > sizeof(((struct sk_buff *)0)->cb));
|
||||
+
|
||||
printk(KERN_INFO "Solos PCI Driver Version %s\n", VERSION);
|
||||
return pci_register_driver(&fpga_driver);
|
||||
}
|
||||
--- a/include/linux/atmdev.h
|
||||
+++ b/include/linux/atmdev.h
|
||||
@@ -99,6 +99,7 @@ struct atm_vcc {
|
||||
struct atm_dev *dev; /* device back pointer */
|
||||
struct atm_qos qos; /* QOS */
|
||||
struct atm_sap sap; /* SAP */
|
||||
+ void (*release_cb)(struct atm_vcc *vcc); /* release_sock callback */
|
||||
void (*push)(struct atm_vcc *vcc,struct sk_buff *skb);
|
||||
void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */
|
||||
int (*push_oam)(struct atm_vcc *vcc,void *cell);
|
||||
@@ -106,6 +107,7 @@ struct atm_vcc {
|
||||
void *dev_data; /* per-device data */
|
||||
void *proto_data; /* per-protocol data */
|
||||
struct k_atm_aal_stats *stats; /* pointer to AAL stats group */
|
||||
+ struct module *owner; /* owner of ->push function */
|
||||
/* SVC part --- may move later ------------------------------------- */
|
||||
short itf; /* interface number */
|
||||
struct sockaddr_atmsvc local;
|
||||
--- a/net/atm/br2684.c
|
||||
+++ b/net/atm/br2684.c
|
||||
@@ -68,12 +68,15 @@ struct br2684_vcc {
|
||||
/* keep old push, pop functions for chaining */
|
||||
void (*old_push)(struct atm_vcc *vcc, struct sk_buff *skb);
|
||||
void (*old_pop)(struct atm_vcc *vcc, struct sk_buff *skb);
|
||||
+ void (*old_release_cb)(struct atm_vcc *vcc);
|
||||
+ struct module *old_owner;
|
||||
enum br2684_encaps encaps;
|
||||
struct list_head brvccs;
|
||||
#ifdef CONFIG_ATM_BR2684_IPFILTER
|
||||
struct br2684_filter filter;
|
||||
#endif /* CONFIG_ATM_BR2684_IPFILTER */
|
||||
unsigned int copies_needed, copies_failed;
|
||||
+ atomic_t qspace;
|
||||
};
|
||||
|
||||
struct br2684_dev {
|
||||
@@ -181,18 +184,15 @@ static struct notifier_block atm_dev_not
|
||||
static void br2684_pop(struct atm_vcc *vcc, struct sk_buff *skb)
|
||||
{
|
||||
struct br2684_vcc *brvcc = BR2684_VCC(vcc);
|
||||
- struct net_device *net_dev = skb->dev;
|
||||
|
||||
- pr_debug("(vcc %p ; net_dev %p )\n", vcc, net_dev);
|
||||
+ pr_debug("(vcc %p ; net_dev %p )\n", vcc, brvcc->device);
|
||||
brvcc->old_pop(vcc, skb);
|
||||
|
||||
- if (!net_dev)
|
||||
- return;
|
||||
-
|
||||
- if (atm_may_send(vcc, 0))
|
||||
- netif_wake_queue(net_dev);
|
||||
-
|
||||
+ /* If the queue space just went up from zero, wake */
|
||||
+ if (atomic_inc_return(&brvcc->qspace) == 1)
|
||||
+ netif_wake_queue(brvcc->device);
|
||||
}
|
||||
+
|
||||
/*
|
||||
* Send a packet out a particular vcc. Not to useful right now, but paves
|
||||
* the way for multiple vcc's per itf. Returns true if we can send,
|
||||
@@ -256,16 +256,30 @@ static int br2684_xmit_vcc(struct sk_buf
|
||||
ATM_SKB(skb)->atm_options = atmvcc->atm_options;
|
||||
dev->stats.tx_packets++;
|
||||
dev->stats.tx_bytes += skb->len;
|
||||
- atmvcc->send(atmvcc, skb);
|
||||
|
||||
- if (!atm_may_send(atmvcc, 0)) {
|
||||
+ if (atomic_dec_return(&brvcc->qspace) < 1) {
|
||||
+ /* No more please! */
|
||||
netif_stop_queue(brvcc->device);
|
||||
- /*check for race with br2684_pop*/
|
||||
- if (atm_may_send(atmvcc, 0))
|
||||
- netif_start_queue(brvcc->device);
|
||||
+ /* We might have raced with br2684_pop() */
|
||||
+ if (unlikely(atomic_read(&brvcc->qspace) > 0))
|
||||
+ netif_wake_queue(brvcc->device);
|
||||
}
|
||||
|
||||
- return 1;
|
||||
+ /* If this fails immediately, the skb will be freed and br2684_pop()
|
||||
+ will wake the queue if appropriate. Just return an error so that
|
||||
+ the stats are updated correctly */
|
||||
+ return !atmvcc->send(atmvcc, skb);
|
||||
+}
|
||||
+
|
||||
+static void br2684_release_cb(struct atm_vcc *atmvcc)
|
||||
+{
|
||||
+ struct br2684_vcc *brvcc = BR2684_VCC(atmvcc);
|
||||
+
|
||||
+ if (atomic_read(&brvcc->qspace) > 0)
|
||||
+ netif_wake_queue(brvcc->device);
|
||||
+
|
||||
+ if (brvcc->old_release_cb)
|
||||
+ brvcc->old_release_cb(atmvcc);
|
||||
}
|
||||
|
||||
static inline struct br2684_vcc *pick_outgoing_vcc(const struct sk_buff *skb,
|
||||
@@ -279,6 +293,8 @@ static netdev_tx_t br2684_start_xmit(str
|
||||
{
|
||||
struct br2684_dev *brdev = BRPRIV(dev);
|
||||
struct br2684_vcc *brvcc;
|
||||
+ struct atm_vcc *atmvcc;
|
||||
+ netdev_tx_t ret = NETDEV_TX_OK;
|
||||
|
||||
pr_debug("skb_dst(skb)=%p\n", skb_dst(skb));
|
||||
read_lock(&devs_lock);
|
||||
@@ -289,9 +305,26 @@ static netdev_tx_t br2684_start_xmit(str
|
||||
dev->stats.tx_carrier_errors++;
|
||||
/* netif_stop_queue(dev); */
|
||||
dev_kfree_skb(skb);
|
||||
- read_unlock(&devs_lock);
|
||||
- return NETDEV_TX_OK;
|
||||
+ goto out_devs;
|
||||
}
|
||||
+ atmvcc = brvcc->atmvcc;
|
||||
+
|
||||
+ bh_lock_sock(sk_atm(atmvcc));
|
||||
+
|
||||
+ if (test_bit(ATM_VF_RELEASED, &atmvcc->flags) ||
|
||||
+ test_bit(ATM_VF_CLOSE, &atmvcc->flags) ||
|
||||
+ !test_bit(ATM_VF_READY, &atmvcc->flags)) {
|
||||
+ dev->stats.tx_dropped++;
|
||||
+ dev_kfree_skb(skb);
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (sock_owned_by_user(sk_atm(atmvcc))) {
|
||||
+ netif_stop_queue(brvcc->device);
|
||||
+ ret = NETDEV_TX_BUSY;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
if (!br2684_xmit_vcc(skb, dev, brvcc)) {
|
||||
/*
|
||||
* We should probably use netif_*_queue() here, but that
|
||||
@@ -303,8 +336,11 @@ static netdev_tx_t br2684_start_xmit(str
|
||||
dev->stats.tx_errors++;
|
||||
dev->stats.tx_fifo_errors++;
|
||||
}
|
||||
+ out:
|
||||
+ bh_unlock_sock(sk_atm(atmvcc));
|
||||
+ out_devs:
|
||||
read_unlock(&devs_lock);
|
||||
- return NETDEV_TX_OK;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -377,9 +413,10 @@ static void br2684_close_vcc(struct br26
|
||||
list_del(&brvcc->brvccs);
|
||||
write_unlock_irq(&devs_lock);
|
||||
brvcc->atmvcc->user_back = NULL; /* what about vcc->recvq ??? */
|
||||
+ brvcc->atmvcc->release_cb = brvcc->old_release_cb;
|
||||
brvcc->old_push(brvcc->atmvcc, NULL); /* pass on the bad news */
|
||||
+ module_put(brvcc->old_owner);
|
||||
kfree(brvcc);
|
||||
- module_put(THIS_MODULE);
|
||||
}
|
||||
|
||||
/* when AAL5 PDU comes in: */
|
||||
@@ -504,6 +541,13 @@ static int br2684_regvcc(struct atm_vcc
|
||||
brvcc = kzalloc(sizeof(struct br2684_vcc), GFP_KERNEL);
|
||||
if (!brvcc)
|
||||
return -ENOMEM;
|
||||
+ /*
|
||||
+ * Allow two packets in the ATM queue. One actually being sent, and one
|
||||
+ * for the ATM 'TX done' handler to send. It shouldn't take long to get
|
||||
+ * the next one from the netdev queue, when we need it. More than that
|
||||
+ * would be bufferbloat.
|
||||
+ */
|
||||
+ atomic_set(&brvcc->qspace, 2);
|
||||
write_lock_irq(&devs_lock);
|
||||
net_dev = br2684_find_dev(&be.ifspec);
|
||||
if (net_dev == NULL) {
|
||||
@@ -546,9 +590,13 @@ static int br2684_regvcc(struct atm_vcc
|
||||
brvcc->encaps = (enum br2684_encaps)be.encaps;
|
||||
brvcc->old_push = atmvcc->push;
|
||||
brvcc->old_pop = atmvcc->pop;
|
||||
+ brvcc->old_release_cb = atmvcc->release_cb;
|
||||
+ brvcc->old_owner = atmvcc->owner;
|
||||
barrier();
|
||||
atmvcc->push = br2684_push;
|
||||
atmvcc->pop = br2684_pop;
|
||||
+ atmvcc->release_cb = br2684_release_cb;
|
||||
+ atmvcc->owner = THIS_MODULE;
|
||||
|
||||
/* initialize netdev carrier state */
|
||||
if (atmvcc->dev->signal == ATM_PHY_SIG_LOST)
|
||||
@@ -687,10 +735,13 @@ static int br2684_ioctl(struct socket *s
|
||||
return -ENOIOCTLCMD;
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
- if (cmd == ATM_SETBACKEND)
|
||||
+ if (cmd == ATM_SETBACKEND) {
|
||||
+ if (sock->state != SS_CONNECTED)
|
||||
+ return -EINVAL;
|
||||
return br2684_regvcc(atmvcc, argp);
|
||||
- else
|
||||
+ } else {
|
||||
return br2684_create(argp);
|
||||
+ }
|
||||
#ifdef CONFIG_ATM_BR2684_IPFILTER
|
||||
case BR2684_SETFILT:
|
||||
if (atmvcc->push != br2684_push)
|
||||
--- a/net/atm/common.c
|
||||
+++ b/net/atm/common.c
|
||||
@@ -126,10 +126,19 @@ static void vcc_write_space(struct sock
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
+static void vcc_release_cb(struct sock *sk)
|
||||
+{
|
||||
+ struct atm_vcc *vcc = atm_sk(sk);
|
||||
+
|
||||
+ if (vcc->release_cb)
|
||||
+ vcc->release_cb(vcc);
|
||||
+}
|
||||
+
|
||||
static struct proto vcc_proto = {
|
||||
.name = "VCC",
|
||||
.owner = THIS_MODULE,
|
||||
.obj_size = sizeof(struct atm_vcc),
|
||||
+ .release_cb = vcc_release_cb,
|
||||
};
|
||||
|
||||
int vcc_create(struct net *net, struct socket *sock, int protocol, int family)
|
||||
@@ -156,7 +165,9 @@ int vcc_create(struct net *net, struct s
|
||||
atomic_set(&sk->sk_rmem_alloc, 0);
|
||||
vcc->push = NULL;
|
||||
vcc->pop = NULL;
|
||||
+ vcc->owner = NULL;
|
||||
vcc->push_oam = NULL;
|
||||
+ vcc->release_cb = NULL;
|
||||
vcc->vpi = vcc->vci = 0; /* no VCI/VPI yet */
|
||||
vcc->atm_options = vcc->aal_options = 0;
|
||||
sk->sk_destruct = vcc_sock_destruct;
|
||||
@@ -175,6 +186,7 @@ static void vcc_destroy_socket(struct so
|
||||
vcc->dev->ops->close(vcc);
|
||||
if (vcc->push)
|
||||
vcc->push(vcc, NULL); /* atmarpd has no push */
|
||||
+ module_put(vcc->owner);
|
||||
|
||||
while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
|
||||
atm_return(vcc, skb->truesize);
|
||||
--- a/net/atm/pppoatm.c
|
||||
+++ b/net/atm/pppoatm.c
|
||||
@@ -60,6 +60,8 @@ struct pppoatm_vcc {
|
||||
struct atm_vcc *atmvcc; /* VCC descriptor */
|
||||
void (*old_push)(struct atm_vcc *, struct sk_buff *);
|
||||
void (*old_pop)(struct atm_vcc *, struct sk_buff *);
|
||||
+ void (*old_release_cb)(struct atm_vcc *);
|
||||
+ struct module *old_owner;
|
||||
/* keep old push/pop for detaching */
|
||||
enum pppoatm_encaps encaps;
|
||||
atomic_t inflight;
|
||||
@@ -107,6 +109,24 @@ static void pppoatm_wakeup_sender(unsign
|
||||
ppp_output_wakeup((struct ppp_channel *) arg);
|
||||
}
|
||||
|
||||
+static void pppoatm_release_cb(struct atm_vcc *atmvcc)
|
||||
+{
|
||||
+ struct pppoatm_vcc *pvcc = atmvcc_to_pvcc(atmvcc);
|
||||
+
|
||||
+ /*
|
||||
+ * As in pppoatm_pop(), it's safe to clear the BLOCKED bit here because
|
||||
+ * the wakeup *can't* race with pppoatm_send(). They both hold the PPP
|
||||
+ * channel's ->downl lock. And the potential race with *setting* it,
|
||||
+ * which leads to the double-check dance in pppoatm_may_send(), doesn't
|
||||
+ * exist here. In the sock_owned_by_user() case in pppoatm_send(), we
|
||||
+ * set the BLOCKED bit while the socket is still locked. We know that
|
||||
+ * ->release_cb() can't be called until that's done.
|
||||
+ */
|
||||
+ if (test_and_clear_bit(BLOCKED, &pvcc->blocked))
|
||||
+ tasklet_schedule(&pvcc->wakeup_tasklet);
|
||||
+ if (pvcc->old_release_cb)
|
||||
+ pvcc->old_release_cb(atmvcc);
|
||||
+}
|
||||
/*
|
||||
* This gets called every time the ATM card has finished sending our
|
||||
* skb. The ->old_pop will take care up normal atm flow control,
|
||||
@@ -151,12 +171,11 @@ static void pppoatm_unassign_vcc(struct
|
||||
pvcc = atmvcc_to_pvcc(atmvcc);
|
||||
atmvcc->push = pvcc->old_push;
|
||||
atmvcc->pop = pvcc->old_pop;
|
||||
+ atmvcc->release_cb = pvcc->old_release_cb;
|
||||
tasklet_kill(&pvcc->wakeup_tasklet);
|
||||
ppp_unregister_channel(&pvcc->chan);
|
||||
atmvcc->user_back = NULL;
|
||||
kfree(pvcc);
|
||||
- /* Gee, I hope we have the big kernel lock here... */
|
||||
- module_put(THIS_MODULE);
|
||||
}
|
||||
|
||||
/* Called when an AAL5 PDU comes in */
|
||||
@@ -165,9 +184,13 @@ static void pppoatm_push(struct atm_vcc
|
||||
struct pppoatm_vcc *pvcc = atmvcc_to_pvcc(atmvcc);
|
||||
pr_debug("\n");
|
||||
if (skb == NULL) { /* VCC was closed */
|
||||
+ struct module *module;
|
||||
+
|
||||
pr_debug("removing ATMPPP VCC %p\n", pvcc);
|
||||
+ module = pvcc->old_owner;
|
||||
pppoatm_unassign_vcc(atmvcc);
|
||||
atmvcc->push(atmvcc, NULL); /* Pass along bad news */
|
||||
+ module_put(module);
|
||||
return;
|
||||
}
|
||||
atm_return(atmvcc, skb->truesize);
|
||||
@@ -211,7 +234,7 @@ error:
|
||||
ppp_input_error(&pvcc->chan, 0);
|
||||
}
|
||||
|
||||
-static inline int pppoatm_may_send(struct pppoatm_vcc *pvcc, int size)
|
||||
+static int pppoatm_may_send(struct pppoatm_vcc *pvcc, int size)
|
||||
{
|
||||
/*
|
||||
* It's not clear that we need to bother with using atm_may_send()
|
||||
@@ -269,10 +292,33 @@ static inline int pppoatm_may_send(struc
|
||||
static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb)
|
||||
{
|
||||
struct pppoatm_vcc *pvcc = chan_to_pvcc(chan);
|
||||
+ struct atm_vcc *vcc;
|
||||
+ int ret;
|
||||
+
|
||||
ATM_SKB(skb)->vcc = pvcc->atmvcc;
|
||||
pr_debug("(skb=0x%p, vcc=0x%p)\n", skb, pvcc->atmvcc);
|
||||
if (skb->data[0] == '\0' && (pvcc->flags & SC_COMP_PROT))
|
||||
(void) skb_pull(skb, 1);
|
||||
+
|
||||
+ vcc = ATM_SKB(skb)->vcc;
|
||||
+ bh_lock_sock(sk_atm(vcc));
|
||||
+ if (sock_owned_by_user(sk_atm(vcc))) {
|
||||
+ /*
|
||||
+ * Needs to happen (and be flushed, hence test_and_) before we unlock
|
||||
+ * the socket. It needs to be seen by the time our ->release_cb gets
|
||||
+ * called.
|
||||
+ */
|
||||
+ test_and_set_bit(BLOCKED, &pvcc->blocked);
|
||||
+ goto nospace;
|
||||
+ }
|
||||
+ if (test_bit(ATM_VF_RELEASED, &vcc->flags) ||
|
||||
+ test_bit(ATM_VF_CLOSE, &vcc->flags) ||
|
||||
+ !test_bit(ATM_VF_READY, &vcc->flags)) {
|
||||
+ bh_unlock_sock(sk_atm(vcc));
|
||||
+ kfree_skb(skb);
|
||||
+ return DROP_PACKET;
|
||||
+ }
|
||||
+
|
||||
switch (pvcc->encaps) { /* LLC encapsulation needed */
|
||||
case e_llc:
|
||||
if (skb_headroom(skb) < LLC_LEN) {
|
||||
@@ -285,8 +331,10 @@ static int pppoatm_send(struct ppp_chann
|
||||
}
|
||||
consume_skb(skb);
|
||||
skb = n;
|
||||
- if (skb == NULL)
|
||||
+ if (skb == NULL) {
|
||||
+ bh_unlock_sock(sk_atm(vcc));
|
||||
return DROP_PACKET;
|
||||
+ }
|
||||
} else if (!pppoatm_may_send(pvcc, skb->truesize))
|
||||
goto nospace;
|
||||
memcpy(skb_push(skb, LLC_LEN), pppllc, LLC_LEN);
|
||||
@@ -296,6 +344,7 @@ static int pppoatm_send(struct ppp_chann
|
||||
goto nospace;
|
||||
break;
|
||||
case e_autodetect:
|
||||
+ bh_unlock_sock(sk_atm(vcc));
|
||||
pr_debug("Trying to send without setting encaps!\n");
|
||||
kfree_skb(skb);
|
||||
return 1;
|
||||
@@ -305,9 +354,12 @@ static int pppoatm_send(struct ppp_chann
|
||||
ATM_SKB(skb)->atm_options = ATM_SKB(skb)->vcc->atm_options;
|
||||
pr_debug("atm_skb(%p)->vcc(%p)->dev(%p)\n",
|
||||
skb, ATM_SKB(skb)->vcc, ATM_SKB(skb)->vcc->dev);
|
||||
- return ATM_SKB(skb)->vcc->send(ATM_SKB(skb)->vcc, skb)
|
||||
+ ret = ATM_SKB(skb)->vcc->send(ATM_SKB(skb)->vcc, skb)
|
||||
? DROP_PACKET : 1;
|
||||
+ bh_unlock_sock(sk_atm(vcc));
|
||||
+ return ret;
|
||||
nospace:
|
||||
+ bh_unlock_sock(sk_atm(vcc));
|
||||
/*
|
||||
* We don't have space to send this SKB now, but we might have
|
||||
* already applied SC_COMP_PROT compression, so may need to undo
|
||||
@@ -362,6 +414,8 @@ static int pppoatm_assign_vcc(struct atm
|
||||
atomic_set(&pvcc->inflight, NONE_INFLIGHT);
|
||||
pvcc->old_push = atmvcc->push;
|
||||
pvcc->old_pop = atmvcc->pop;
|
||||
+ pvcc->old_owner = atmvcc->owner;
|
||||
+ pvcc->old_release_cb = atmvcc->release_cb;
|
||||
pvcc->encaps = (enum pppoatm_encaps) be.encaps;
|
||||
pvcc->chan.private = pvcc;
|
||||
pvcc->chan.ops = &pppoatm_ops;
|
||||
@@ -377,7 +431,9 @@ static int pppoatm_assign_vcc(struct atm
|
||||
atmvcc->user_back = pvcc;
|
||||
atmvcc->push = pppoatm_push;
|
||||
atmvcc->pop = pppoatm_pop;
|
||||
+ atmvcc->release_cb = pppoatm_release_cb;
|
||||
__module_get(THIS_MODULE);
|
||||
+ atmvcc->owner = THIS_MODULE;
|
||||
|
||||
/* re-process everything received between connection setup and
|
||||
backend setup */
|
||||
@@ -406,6 +462,8 @@ static int pppoatm_ioctl(struct socket *
|
||||
return -ENOIOCTLCMD;
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
+ if (sock->state != SS_CONNECTED)
|
||||
+ return -EINVAL;
|
||||
return pppoatm_assign_vcc(atmvcc, argp);
|
||||
}
|
||||
case PPPIOCGCHAN:
|
@ -1,388 +0,0 @@
|
||||
commit 152a2a8b5e1d4cbe91a7c66f1028db15164a3766
|
||||
Author: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Date: Wed Dec 19 11:01:21 2012 +0000
|
||||
|
||||
solos-pci: ensure all TX packets are aligned to 4 bytes
|
||||
|
||||
The FPGA can't handled unaligned DMA (yet). So copy into an aligned buffer,
|
||||
if skb->data isn't suitably aligned.
|
||||
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
commit 13af816469db3449c072afbae6c4c1bd9ccecccb
|
||||
Author: Nathan Williams <nathan@traverse.com.au>
|
||||
Date: Wed Dec 19 11:01:20 2012 +0000
|
||||
|
||||
solos-pci: add firmware upgrade support for new models
|
||||
|
||||
Signed-off-by: Nathan Williams <nathan@traverse.com.au>
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
commit 7fbdadb5e951e4f0c0fc991ff5f50295568786e6
|
||||
Author: Nathan Williams <nathan@traverse.com.au>
|
||||
Date: Wed Dec 19 11:01:19 2012 +0000
|
||||
|
||||
solos-pci: remove superfluous debug output
|
||||
|
||||
Signed-off-by: Nathan Williams <nathan@traverse.com.au>
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
commit f9baad02e7411d9f38d5ebe1a1cdcde4ceec100d
|
||||
Author: Nathan Williams <nathan@traverse.com.au>
|
||||
Date: Wed Dec 19 11:01:18 2012 +0000
|
||||
|
||||
solos-pci: add GPIO support for newer versions on Geos board
|
||||
|
||||
dwmw2: Tidy up a little, simpler matching on which GPIO is being accessed,
|
||||
only register on newer boards, register under PCI device instead of
|
||||
duplicating them under each ATM device.
|
||||
|
||||
Signed-off-by: Nathan Williams <nathan@traverse.com.au>
|
||||
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
==
|
||||
There is a typo here so we do a double lock instead of an unlock.
|
||||
|
||||
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
|
||||
---
|
||||
Only needed in linux-next. Introduced in f9baad02e7411d9 [14/17]
|
||||
solos-pci: add GPIO support for newer versions on Geos board
|
||||
|
||||
|
||||
--- a/drivers/atm/solos-pci.c
|
||||
+++ b/drivers/atm/solos-pci.c
|
||||
@@ -42,7 +42,8 @@
|
||||
#include <linux/swab.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
-#define VERSION "0.07"
|
||||
+#define VERSION "1.04"
|
||||
+#define DRIVER_VERSION 0x01
|
||||
#define PTAG "solos-pci"
|
||||
|
||||
#define CONFIG_RAM_SIZE 128
|
||||
@@ -56,16 +57,21 @@
|
||||
#define FLASH_BUSY 0x60
|
||||
#define FPGA_MODE 0x5C
|
||||
#define FLASH_MODE 0x58
|
||||
+#define GPIO_STATUS 0x54
|
||||
+#define DRIVER_VER 0x50
|
||||
#define TX_DMA_ADDR(port) (0x40 + (4 * (port)))
|
||||
#define RX_DMA_ADDR(port) (0x30 + (4 * (port)))
|
||||
|
||||
#define DATA_RAM_SIZE 32768
|
||||
#define BUF_SIZE 2048
|
||||
#define OLD_BUF_SIZE 4096 /* For FPGA versions <= 2*/
|
||||
-#define FPGA_PAGE 528 /* FPGA flash page size*/
|
||||
-#define SOLOS_PAGE 512 /* Solos flash page size*/
|
||||
-#define FPGA_BLOCK (FPGA_PAGE * 8) /* FPGA flash block size*/
|
||||
-#define SOLOS_BLOCK (SOLOS_PAGE * 8) /* Solos flash block size*/
|
||||
+/* Old boards use ATMEL AD45DB161D flash */
|
||||
+#define ATMEL_FPGA_PAGE 528 /* FPGA flash page size*/
|
||||
+#define ATMEL_SOLOS_PAGE 512 /* Solos flash page size*/
|
||||
+#define ATMEL_FPGA_BLOCK (ATMEL_FPGA_PAGE * 8) /* FPGA block size*/
|
||||
+#define ATMEL_SOLOS_BLOCK (ATMEL_SOLOS_PAGE * 8) /* Solos block size*/
|
||||
+/* Current boards use M25P/M25PE SPI flash */
|
||||
+#define SPI_FLASH_BLOCK (256 * 64)
|
||||
|
||||
#define RX_BUF(card, nr) ((card->buffers) + (nr)*(card->buffer_size)*2)
|
||||
#define TX_BUF(card, nr) ((card->buffers) + (nr)*(card->buffer_size)*2 + (card->buffer_size))
|
||||
@@ -123,11 +129,14 @@ struct solos_card {
|
||||
struct sk_buff_head cli_queue[4];
|
||||
struct sk_buff *tx_skb[4];
|
||||
struct sk_buff *rx_skb[4];
|
||||
+ unsigned char *dma_bounce;
|
||||
wait_queue_head_t param_wq;
|
||||
wait_queue_head_t fw_wq;
|
||||
int using_dma;
|
||||
+ int dma_alignment;
|
||||
int fpga_version;
|
||||
int buffer_size;
|
||||
+ int atmel_flash;
|
||||
};
|
||||
|
||||
|
||||
@@ -452,7 +461,6 @@ static ssize_t console_show(struct devic
|
||||
|
||||
len = skb->len;
|
||||
memcpy(buf, skb->data, len);
|
||||
- dev_dbg(&card->dev->dev, "len: %d\n", len);
|
||||
|
||||
kfree_skb(skb);
|
||||
return len;
|
||||
@@ -499,6 +507,78 @@ static ssize_t console_store(struct devi
|
||||
return err?:count;
|
||||
}
|
||||
|
||||
+struct geos_gpio_attr {
|
||||
+ struct device_attribute attr;
|
||||
+ int offset;
|
||||
+};
|
||||
+
|
||||
+#define SOLOS_GPIO_ATTR(_name, _mode, _show, _store, _offset) \
|
||||
+ struct geos_gpio_attr gpio_attr_##_name = { \
|
||||
+ .attr = __ATTR(_name, _mode, _show, _store), \
|
||||
+ .offset = _offset }
|
||||
+
|
||||
+static ssize_t geos_gpio_store(struct device *dev, struct device_attribute *attr,
|
||||
+ const char *buf, size_t count)
|
||||
+{
|
||||
+ struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
|
||||
+ struct geos_gpio_attr *gattr = container_of(attr, struct geos_gpio_attr, attr);
|
||||
+ struct solos_card *card = pci_get_drvdata(pdev);
|
||||
+ uint32_t data32;
|
||||
+
|
||||
+ if (count != 1 && (count != 2 || buf[1] != '\n'))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ spin_lock_irq(&card->param_queue_lock);
|
||||
+ data32 = ioread32(card->config_regs + GPIO_STATUS);
|
||||
+ if (buf[0] == '1') {
|
||||
+ data32 |= 1 << gattr->offset;
|
||||
+ iowrite32(data32, card->config_regs + GPIO_STATUS);
|
||||
+ } else if (buf[0] == '0') {
|
||||
+ data32 &= ~(1 << gattr->offset);
|
||||
+ iowrite32(data32, card->config_regs + GPIO_STATUS);
|
||||
+ } else {
|
||||
+ count = -EINVAL;
|
||||
+ }
|
||||
+ spin_unlock_irq(&card->param_queue_lock);
|
||||
+ return count;
|
||||
+}
|
||||
+
|
||||
+static ssize_t geos_gpio_show(struct device *dev, struct device_attribute *attr,
|
||||
+ char *buf)
|
||||
+{
|
||||
+ struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
|
||||
+ struct geos_gpio_attr *gattr = container_of(attr, struct geos_gpio_attr, attr);
|
||||
+ struct solos_card *card = pci_get_drvdata(pdev);
|
||||
+ uint32_t data32;
|
||||
+
|
||||
+ data32 = ioread32(card->config_regs + GPIO_STATUS);
|
||||
+ data32 = (data32 >> gattr->offset) & 1;
|
||||
+
|
||||
+ return sprintf(buf, "%d\n", data32);
|
||||
+}
|
||||
+
|
||||
+static ssize_t hardware_show(struct device *dev, struct device_attribute *attr,
|
||||
+ char *buf)
|
||||
+{
|
||||
+ struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
|
||||
+ struct geos_gpio_attr *gattr = container_of(attr, struct geos_gpio_attr, attr);
|
||||
+ struct solos_card *card = pci_get_drvdata(pdev);
|
||||
+ uint32_t data32;
|
||||
+
|
||||
+ data32 = ioread32(card->config_regs + GPIO_STATUS);
|
||||
+ switch (gattr->offset) {
|
||||
+ case 0:
|
||||
+ /* HardwareVersion */
|
||||
+ data32 = data32 & 0x1F;
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ /* HardwareVariant */
|
||||
+ data32 = (data32 >> 5) & 0x0F;
|
||||
+ break;
|
||||
+ }
|
||||
+ return sprintf(buf, "%d\n", data32);
|
||||
+}
|
||||
+
|
||||
static DEVICE_ATTR(console, 0644, console_show, console_store);
|
||||
|
||||
|
||||
@@ -507,6 +587,14 @@ static DEVICE_ATTR(console, 0644, consol
|
||||
|
||||
#include "solos-attrlist.c"
|
||||
|
||||
+static SOLOS_GPIO_ATTR(GPIO1, 0644, geos_gpio_show, geos_gpio_store, 9);
|
||||
+static SOLOS_GPIO_ATTR(GPIO2, 0644, geos_gpio_show, geos_gpio_store, 10);
|
||||
+static SOLOS_GPIO_ATTR(GPIO3, 0644, geos_gpio_show, geos_gpio_store, 11);
|
||||
+static SOLOS_GPIO_ATTR(GPIO4, 0644, geos_gpio_show, geos_gpio_store, 12);
|
||||
+static SOLOS_GPIO_ATTR(GPIO5, 0644, geos_gpio_show, geos_gpio_store, 13);
|
||||
+static SOLOS_GPIO_ATTR(PushButton, 0444, geos_gpio_show, NULL, 14);
|
||||
+static SOLOS_GPIO_ATTR(HardwareVersion, 0444, hardware_show, NULL, 0);
|
||||
+static SOLOS_GPIO_ATTR(HardwareVariant, 0444, hardware_show, NULL, 1);
|
||||
#undef SOLOS_ATTR_RO
|
||||
#undef SOLOS_ATTR_RW
|
||||
|
||||
@@ -523,6 +611,23 @@ static struct attribute_group solos_attr
|
||||
.name = "parameters",
|
||||
};
|
||||
|
||||
+static struct attribute *gpio_attrs[] = {
|
||||
+ &gpio_attr_GPIO1.attr.attr,
|
||||
+ &gpio_attr_GPIO2.attr.attr,
|
||||
+ &gpio_attr_GPIO3.attr.attr,
|
||||
+ &gpio_attr_GPIO4.attr.attr,
|
||||
+ &gpio_attr_GPIO5.attr.attr,
|
||||
+ &gpio_attr_PushButton.attr.attr,
|
||||
+ &gpio_attr_HardwareVersion.attr.attr,
|
||||
+ &gpio_attr_HardwareVariant.attr.attr,
|
||||
+ NULL
|
||||
+};
|
||||
+
|
||||
+static struct attribute_group gpio_attr_group = {
|
||||
+ .attrs = gpio_attrs,
|
||||
+ .name = "gpio",
|
||||
+};
|
||||
+
|
||||
static int flash_upgrade(struct solos_card *card, int chip)
|
||||
{
|
||||
const struct firmware *fw;
|
||||
@@ -534,16 +639,25 @@ static int flash_upgrade(struct solos_ca
|
||||
switch (chip) {
|
||||
case 0:
|
||||
fw_name = "solos-FPGA.bin";
|
||||
- blocksize = FPGA_BLOCK;
|
||||
+ if (card->atmel_flash)
|
||||
+ blocksize = ATMEL_FPGA_BLOCK;
|
||||
+ else
|
||||
+ blocksize = SPI_FLASH_BLOCK;
|
||||
break;
|
||||
case 1:
|
||||
fw_name = "solos-Firmware.bin";
|
||||
- blocksize = SOLOS_BLOCK;
|
||||
+ if (card->atmel_flash)
|
||||
+ blocksize = ATMEL_SOLOS_BLOCK;
|
||||
+ else
|
||||
+ blocksize = SPI_FLASH_BLOCK;
|
||||
break;
|
||||
case 2:
|
||||
if (card->fpga_version > LEGACY_BUFFERS){
|
||||
fw_name = "solos-db-FPGA.bin";
|
||||
- blocksize = FPGA_BLOCK;
|
||||
+ if (card->atmel_flash)
|
||||
+ blocksize = ATMEL_FPGA_BLOCK;
|
||||
+ else
|
||||
+ blocksize = SPI_FLASH_BLOCK;
|
||||
} else {
|
||||
dev_info(&card->dev->dev, "FPGA version doesn't support"
|
||||
" daughter board upgrades\n");
|
||||
@@ -553,7 +667,10 @@ static int flash_upgrade(struct solos_ca
|
||||
case 3:
|
||||
if (card->fpga_version > LEGACY_BUFFERS){
|
||||
fw_name = "solos-Firmware.bin";
|
||||
- blocksize = SOLOS_BLOCK;
|
||||
+ if (card->atmel_flash)
|
||||
+ blocksize = ATMEL_SOLOS_BLOCK;
|
||||
+ else
|
||||
+ blocksize = SPI_FLASH_BLOCK;
|
||||
} else {
|
||||
dev_info(&card->dev->dev, "FPGA version doesn't support"
|
||||
" daughter board upgrades\n");
|
||||
@@ -569,6 +686,9 @@ static int flash_upgrade(struct solos_ca
|
||||
|
||||
dev_info(&card->dev->dev, "Flash upgrade starting\n");
|
||||
|
||||
+ /* New FPGAs require driver version before permitting flash upgrades */
|
||||
+ iowrite32(DRIVER_VERSION, card->config_regs + DRIVER_VER);
|
||||
+
|
||||
numblocks = fw->size / blocksize;
|
||||
dev_info(&card->dev->dev, "Firmware size: %zd\n", fw->size);
|
||||
dev_info(&card->dev->dev, "Number of blocks: %d\n", numblocks);
|
||||
@@ -598,9 +718,13 @@ static int flash_upgrade(struct solos_ca
|
||||
/* dev_info(&card->dev->dev, "Set FPGA Flash mode to Block Write\n"); */
|
||||
iowrite32(((chip * 2) + 1), card->config_regs + FLASH_MODE);
|
||||
|
||||
- /* Copy block to buffer, swapping each 16 bits */
|
||||
+ /* Copy block to buffer, swapping each 16 bits for Atmel flash */
|
||||
for(i = 0; i < blocksize; i += 4) {
|
||||
- uint32_t word = swahb32p((uint32_t *)(fw->data + offset + i));
|
||||
+ uint32_t word;
|
||||
+ if (card->atmel_flash)
|
||||
+ word = swahb32p((uint32_t *)(fw->data + offset + i));
|
||||
+ else
|
||||
+ word = *(uint32_t *)(fw->data + offset + i);
|
||||
if(card->fpga_version > LEGACY_BUFFERS)
|
||||
iowrite32(word, FLASH_BUF + i);
|
||||
else
|
||||
@@ -961,7 +1085,12 @@ static uint32_t fpga_tx(struct solos_car
|
||||
tx_started |= 1 << port;
|
||||
oldskb = skb; /* We're done with this skb already */
|
||||
} else if (skb && card->using_dma) {
|
||||
- SKB_CB(skb)->dma_addr = pci_map_single(card->dev, skb->data,
|
||||
+ unsigned char *data = skb->data;
|
||||
+ if ((unsigned long)data & card->dma_alignment) {
|
||||
+ data = card->dma_bounce + (BUF_SIZE * port);
|
||||
+ memcpy(data, skb->data, skb->len);
|
||||
+ }
|
||||
+ SKB_CB(skb)->dma_addr = pci_map_single(card->dev, data,
|
||||
skb->len, PCI_DMA_TODEVICE);
|
||||
card->tx_skb[port] = skb;
|
||||
iowrite32(SKB_CB(skb)->dma_addr,
|
||||
@@ -1135,18 +1264,33 @@ static int fpga_probe(struct pci_dev *de
|
||||
db_fpga_upgrade = db_firmware_upgrade = 0;
|
||||
}
|
||||
|
||||
+ /* Stopped using Atmel flash after 0.03-38 */
|
||||
+ if (fpga_ver < 39)
|
||||
+ card->atmel_flash = 1;
|
||||
+ else
|
||||
+ card->atmel_flash = 0;
|
||||
+
|
||||
+ data32 = ioread32(card->config_regs + PORTS);
|
||||
+ card->nr_ports = (data32 & 0x000000FF);
|
||||
+
|
||||
if (card->fpga_version >= DMA_SUPPORTED) {
|
||||
pci_set_master(dev);
|
||||
card->using_dma = 1;
|
||||
+ if (1) { /* All known FPGA versions so far */
|
||||
+ card->dma_alignment = 3;
|
||||
+ card->dma_bounce = kmalloc(card->nr_ports * BUF_SIZE, GFP_KERNEL);
|
||||
+ if (!card->dma_bounce) {
|
||||
+ dev_warn(&card->dev->dev, "Failed to allocate DMA bounce buffers\n");
|
||||
+ /* Fallback to MMIO doesn't work */
|
||||
+ goto out_unmap_both;
|
||||
+ }
|
||||
+ }
|
||||
} else {
|
||||
card->using_dma = 0;
|
||||
/* Set RX empty flag for all ports */
|
||||
iowrite32(0xF0, card->config_regs + FLAGS_ADDR);
|
||||
}
|
||||
|
||||
- data32 = ioread32(card->config_regs + PORTS);
|
||||
- card->nr_ports = (data32 & 0x000000FF);
|
||||
-
|
||||
pci_set_drvdata(dev, card);
|
||||
|
||||
tasklet_init(&card->tlet, solos_bh, (unsigned long)card);
|
||||
@@ -1181,6 +1325,10 @@ static int fpga_probe(struct pci_dev *de
|
||||
if (err)
|
||||
goto out_free_irq;
|
||||
|
||||
+ if (card->fpga_version >= DMA_SUPPORTED &&
|
||||
+ sysfs_create_group(&card->dev->dev.kobj, &gpio_attr_group))
|
||||
+ dev_err(&card->dev->dev, "Could not register parameter group for GPIOs\n");
|
||||
+
|
||||
return 0;
|
||||
|
||||
out_free_irq:
|
||||
@@ -1189,6 +1337,7 @@ static int fpga_probe(struct pci_dev *de
|
||||
tasklet_kill(&card->tlet);
|
||||
|
||||
out_unmap_both:
|
||||
+ kfree(card->dma_bounce);
|
||||
pci_set_drvdata(dev, NULL);
|
||||
pci_iounmap(dev, card->buffers);
|
||||
out_unmap_config:
|
||||
@@ -1291,11 +1440,16 @@ static void fpga_remove(struct pci_dev *
|
||||
iowrite32(1, card->config_regs + FPGA_MODE);
|
||||
(void)ioread32(card->config_regs + FPGA_MODE);
|
||||
|
||||
+ if (card->fpga_version >= DMA_SUPPORTED)
|
||||
+ sysfs_remove_group(&card->dev->dev.kobj, &gpio_attr_group);
|
||||
+
|
||||
atm_remove(card);
|
||||
|
||||
free_irq(dev->irq, card);
|
||||
tasklet_kill(&card->tlet);
|
||||
|
||||
+ kfree(card->dma_bounce);
|
||||
+
|
||||
/* Release device from reset */
|
||||
iowrite32(0, card->config_regs + FPGA_MODE);
|
||||
(void)ioread32(card->config_regs + FPGA_MODE);
|
@ -1,11 +0,0 @@
|
||||
--- a/scripts/setlocalversion
|
||||
+++ b/scripts/setlocalversion
|
||||
@@ -167,7 +167,7 @@ else
|
||||
# annotated or signed tagged state (as git describe only
|
||||
# looks at signed or annotated tags - git tag -a/-s) and
|
||||
# LOCALVERSION= is not specified
|
||||
- if test "${LOCALVERSION+set}" != "set"; then
|
||||
+ if test "${CONFIG_LOCALVERSION+set}" != "set"; then
|
||||
scm=$(scm_version --short)
|
||||
res="$res${scm:++}"
|
||||
fi
|
@ -1,24 +0,0 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -570,9 +570,9 @@ endif # $(dot-config)
|
||||
all: vmlinux
|
||||
|
||||
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
|
||||
-KBUILD_CFLAGS += -Os
|
||||
+KBUILD_CFLAGS += -Os -fno-caller-saves
|
||||
else
|
||||
-KBUILD_CFLAGS += -O2
|
||||
+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch -fno-caller-saves
|
||||
endif
|
||||
|
||||
include $(srctree)/arch/$(SRCARCH)/Makefile
|
||||
@@ -645,6 +645,9 @@ endif
|
||||
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
|
||||
CHECKFLAGS += $(NOSTDINC_FLAGS)
|
||||
|
||||
+# improve gcc optimization
|
||||
+CFLAGS += $(call cc-option,-funit-at-a-time,)
|
||||
+
|
||||
# warn about C99 declaration after statement
|
||||
KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -379,7 +379,7 @@ KBUILD_CFLAGS_KERNEL :=
|
||||
KBUILD_AFLAGS := -D__ASSEMBLY__
|
||||
KBUILD_AFLAGS_MODULE := -DMODULE
|
||||
KBUILD_CFLAGS_MODULE := -DMODULE
|
||||
-KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
|
||||
+KBUILD_LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds $(if $(CONFIG_PROFILING),,-s)
|
||||
|
||||
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
|
||||
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
|
@ -1,108 +0,0 @@
|
||||
--- a/scripts/kallsyms.c
|
||||
+++ b/scripts/kallsyms.c
|
||||
@@ -54,6 +54,7 @@ static struct text_range text_ranges[] =
|
||||
static struct sym_entry *table;
|
||||
static unsigned int table_size, table_cnt;
|
||||
static int all_symbols = 0;
|
||||
+static int uncompressed = 0;
|
||||
static char symbol_prefix_char = '\0';
|
||||
|
||||
int token_profit[0x10000];
|
||||
@@ -360,6 +361,9 @@ static void write_src(void)
|
||||
|
||||
free(markers);
|
||||
|
||||
+ if (uncompressed)
|
||||
+ return;
|
||||
+
|
||||
output_label("kallsyms_token_table");
|
||||
off = 0;
|
||||
for (i = 0; i < 256; i++) {
|
||||
@@ -418,6 +422,9 @@ static void *find_token(unsigned char *s
|
||||
{
|
||||
int i;
|
||||
|
||||
+ if (uncompressed)
|
||||
+ return NULL;
|
||||
+
|
||||
for (i = 0; i < len - 1; i++) {
|
||||
if (str[i] == token[0] && str[i+1] == token[1])
|
||||
return &str[i];
|
||||
@@ -490,6 +497,9 @@ static void optimize_result(void)
|
||||
{
|
||||
int i, best;
|
||||
|
||||
+ if (uncompressed)
|
||||
+ return;
|
||||
+
|
||||
/* using the '\0' symbol last allows compress_symbols to use standard
|
||||
* fast string functions */
|
||||
for (i = 255; i >= 0; i--) {
|
||||
@@ -646,7 +656,9 @@ int main(int argc, char **argv)
|
||||
if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\''))
|
||||
p++;
|
||||
symbol_prefix_char = *p;
|
||||
- } else
|
||||
+ } else if (strcmp(argv[i], "--uncompressed") == 0)
|
||||
+ uncompressed = 1;
|
||||
+ else
|
||||
usage();
|
||||
}
|
||||
} else if (argc != 1)
|
||||
--- a/init/Kconfig
|
||||
+++ b/init/Kconfig
|
||||
@@ -1194,6 +1194,17 @@ config KALLSYMS_ALL
|
||||
|
||||
Say N unless you really need all symbols.
|
||||
|
||||
+config KALLSYMS_UNCOMPRESSED
|
||||
+ bool "Keep kallsyms uncompressed"
|
||||
+ depends on KALLSYMS
|
||||
+ help
|
||||
+ Normally kallsyms contains compressed symbols (using a token table),
|
||||
+ reducing the uncompressed kernel image size. Keeping the symbol table
|
||||
+ uncompressed significantly improves the size of this part in compressed
|
||||
+ kernel images.
|
||||
+
|
||||
+ Say N unless you need compressed kernel images to be small.
|
||||
+
|
||||
config HOTPLUG
|
||||
def_bool y
|
||||
|
||||
--- a/scripts/link-vmlinux.sh
|
||||
+++ b/scripts/link-vmlinux.sh
|
||||
@@ -83,6 +83,10 @@ kallsyms()
|
||||
kallsymopt="${kallsymopt} --all-symbols"
|
||||
fi
|
||||
|
||||
+ if [ -n "${CONFIG_KALLSYMS_UNCOMPRESSED}" ]; then
|
||||
+ kallsymopt="${kallsymopt} --uncompressed"
|
||||
+ fi
|
||||
+
|
||||
local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \
|
||||
${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}"
|
||||
|
||||
--- a/kernel/kallsyms.c
|
||||
+++ b/kernel/kallsyms.c
|
||||
@@ -106,6 +106,11 @@ static unsigned int kallsyms_expand_symb
|
||||
* For every byte on the compressed symbol data, copy the table
|
||||
* entry for that byte.
|
||||
*/
|
||||
+#ifdef CONFIG_KALLSYMS_UNCOMPRESSED
|
||||
+ memcpy(result, data + 1, len - 1);
|
||||
+ result += len - 1;
|
||||
+ len = 0;
|
||||
+#endif
|
||||
while (len) {
|
||||
tptr = &kallsyms_token_table[kallsyms_token_index[*data]];
|
||||
data++;
|
||||
@@ -133,6 +138,9 @@ static unsigned int kallsyms_expand_symb
|
||||
*/
|
||||
static char kallsyms_get_symbol_type(unsigned int off)
|
||||
{
|
||||
+#ifdef CONFIG_KALLSYMS_UNCOMPRESSED
|
||||
+ return kallsyms_names[off + 1];
|
||||
+#endif
|
||||
/*
|
||||
* Get just the first code, look it up in the token table,
|
||||
* and return the first char from this token.
|
File diff suppressed because it is too large
Load Diff
@ -1,53 +0,0 @@
|
||||
--- a/tools/include/tools/be_byteshift.h
|
||||
+++ b/tools/include/tools/be_byteshift.h
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef _TOOLS_BE_BYTESHIFT_H
|
||||
#define _TOOLS_BE_BYTESHIFT_H
|
||||
|
||||
+#ifdef __linux__
|
||||
#include <linux/types.h>
|
||||
+#else
|
||||
+#include "linux_types.h"
|
||||
+#endif
|
||||
|
||||
static inline __u16 __get_unaligned_be16(const __u8 *p)
|
||||
{
|
||||
--- a/tools/include/tools/le_byteshift.h
|
||||
+++ b/tools/include/tools/le_byteshift.h
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef _TOOLS_LE_BYTESHIFT_H
|
||||
#define _TOOLS_LE_BYTESHIFT_H
|
||||
|
||||
+#ifdef __linux__
|
||||
#include <linux/types.h>
|
||||
+#else
|
||||
+#include "linux_types.h"
|
||||
+#endif
|
||||
|
||||
static inline __u16 __get_unaligned_le16(const __u8 *p)
|
||||
{
|
||||
--- /dev/null
|
||||
+++ b/tools/include/tools/linux_types.h
|
||||
@@ -0,0 +1,22 @@
|
||||
+#ifndef __LINUX_TYPES_H
|
||||
+#define __LINUX_TYPES_H
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+
|
||||
+typedef uint8_t __u8;
|
||||
+typedef uint8_t __be8;
|
||||
+typedef uint8_t __le8;
|
||||
+
|
||||
+typedef uint16_t __u16;
|
||||
+typedef uint16_t __be16;
|
||||
+typedef uint16_t __le16;
|
||||
+
|
||||
+typedef uint32_t __u32;
|
||||
+typedef uint32_t __be32;
|
||||
+typedef uint32_t __le32;
|
||||
+
|
||||
+typedef uint64_t __u64;
|
||||
+typedef uint64_t __be64;
|
||||
+typedef uint64_t __le64;
|
||||
+
|
||||
+#endif
|
@ -1,372 +0,0 @@
|
||||
--- a/arch/mips/Makefile
|
||||
+++ b/arch/mips/Makefile
|
||||
@@ -89,10 +89,12 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin
|
||||
#
|
||||
cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
|
||||
cflags-y += -msoft-float
|
||||
-LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
|
||||
+LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections
|
||||
KBUILD_AFLAGS_MODULE += -mlong-calls
|
||||
KBUILD_CFLAGS_MODULE += -mlong-calls
|
||||
|
||||
+KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
|
||||
+
|
||||
cflags-y += -ffreestanding
|
||||
|
||||
#
|
||||
--- a/arch/mips/kernel/vmlinux.lds.S
|
||||
+++ b/arch/mips/kernel/vmlinux.lds.S
|
||||
@@ -66,7 +66,7 @@ SECTIONS
|
||||
/* Exception table for data bus errors */
|
||||
__dbe_table : {
|
||||
__start___dbe_table = .;
|
||||
- *(__dbe_table)
|
||||
+ KEEP(*(__dbe_table))
|
||||
__stop___dbe_table = .;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ SECTIONS
|
||||
. = ALIGN(4);
|
||||
.mips.machines.init : AT(ADDR(.mips.machines.init) - LOAD_OFFSET) {
|
||||
__mips_machines_start = .;
|
||||
- *(.mips.machines.init)
|
||||
+ KEEP(*(.mips.machines.init))
|
||||
__mips_machines_end = .;
|
||||
}
|
||||
|
||||
--- a/include/asm-generic/vmlinux.lds.h
|
||||
+++ b/include/asm-generic/vmlinux.lds.h
|
||||
@@ -101,7 +101,7 @@
|
||||
#ifdef CONFIG_FTRACE_MCOUNT_RECORD
|
||||
#define MCOUNT_REC() . = ALIGN(8); \
|
||||
VMLINUX_SYMBOL(__start_mcount_loc) = .; \
|
||||
- *(__mcount_loc) \
|
||||
+ KEEP(*(__mcount_loc)) \
|
||||
VMLINUX_SYMBOL(__stop_mcount_loc) = .;
|
||||
#else
|
||||
#define MCOUNT_REC()
|
||||
@@ -109,7 +109,7 @@
|
||||
|
||||
#ifdef CONFIG_TRACE_BRANCH_PROFILING
|
||||
#define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \
|
||||
- *(_ftrace_annotated_branch) \
|
||||
+ KEEP(*(_ftrace_annotated_branch)) \
|
||||
VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .;
|
||||
#else
|
||||
#define LIKELY_PROFILE()
|
||||
@@ -117,7 +117,7 @@
|
||||
|
||||
#ifdef CONFIG_PROFILE_ALL_BRANCHES
|
||||
#define BRANCH_PROFILE() VMLINUX_SYMBOL(__start_branch_profile) = .; \
|
||||
- *(_ftrace_branch) \
|
||||
+ KEEP(*(_ftrace_branch)) \
|
||||
VMLINUX_SYMBOL(__stop_branch_profile) = .;
|
||||
#else
|
||||
#define BRANCH_PROFILE()
|
||||
@@ -126,7 +126,7 @@
|
||||
#ifdef CONFIG_EVENT_TRACING
|
||||
#define FTRACE_EVENTS() . = ALIGN(8); \
|
||||
VMLINUX_SYMBOL(__start_ftrace_events) = .; \
|
||||
- *(_ftrace_events) \
|
||||
+ KEEP(*(_ftrace_events)) \
|
||||
VMLINUX_SYMBOL(__stop_ftrace_events) = .;
|
||||
#else
|
||||
#define FTRACE_EVENTS()
|
||||
@@ -134,7 +134,7 @@
|
||||
|
||||
#ifdef CONFIG_TRACING
|
||||
#define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \
|
||||
- *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \
|
||||
+ KEEP(*(__trace_printk_fmt)) /* Trace_printk fmt' pointer */ \
|
||||
VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .;
|
||||
#else
|
||||
#define TRACE_PRINTKS()
|
||||
@@ -143,7 +143,7 @@
|
||||
#ifdef CONFIG_FTRACE_SYSCALLS
|
||||
#define TRACE_SYSCALLS() . = ALIGN(8); \
|
||||
VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
|
||||
- *(__syscalls_metadata) \
|
||||
+ KEEP(*(__syscalls_metadata)) \
|
||||
VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
|
||||
#else
|
||||
#define TRACE_SYSCALLS()
|
||||
@@ -153,7 +153,7 @@
|
||||
#define KERNEL_DTB() \
|
||||
STRUCT_ALIGN(); \
|
||||
VMLINUX_SYMBOL(__dtb_start) = .; \
|
||||
- *(.dtb.init.rodata) \
|
||||
+ KEEP(*(.dtb.init.rodata)) \
|
||||
VMLINUX_SYMBOL(__dtb_end) = .;
|
||||
|
||||
/* .data section */
|
||||
@@ -173,15 +173,16 @@
|
||||
/* implement dynamic printk debug */ \
|
||||
. = ALIGN(8); \
|
||||
VMLINUX_SYMBOL(__start___jump_table) = .; \
|
||||
- *(__jump_table) \
|
||||
+ KEEP(*(__jump_table)) \
|
||||
VMLINUX_SYMBOL(__stop___jump_table) = .; \
|
||||
. = ALIGN(8); \
|
||||
VMLINUX_SYMBOL(__start___verbose) = .; \
|
||||
- *(__verbose) \
|
||||
+ KEEP(*(__verbose)) \
|
||||
VMLINUX_SYMBOL(__stop___verbose) = .; \
|
||||
LIKELY_PROFILE() \
|
||||
BRANCH_PROFILE() \
|
||||
- TRACE_PRINTKS()
|
||||
+ TRACE_PRINTKS() \
|
||||
+ *(.data.[a-zA-Z_]*)
|
||||
|
||||
/*
|
||||
* Data section helpers
|
||||
@@ -235,39 +236,39 @@
|
||||
/* PCI quirks */ \
|
||||
.pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
|
||||
- *(.pci_fixup_early) \
|
||||
+ KEEP(*(.pci_fixup_early)) \
|
||||
VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \
|
||||
VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \
|
||||
- *(.pci_fixup_header) \
|
||||
+ KEEP(*(.pci_fixup_header)) \
|
||||
VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \
|
||||
VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
|
||||
- *(.pci_fixup_final) \
|
||||
+ KEEP(*(.pci_fixup_final)) \
|
||||
VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
|
||||
VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
|
||||
- *(.pci_fixup_enable) \
|
||||
+ KEEP(*(.pci_fixup_enable)) \
|
||||
VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
|
||||
VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \
|
||||
- *(.pci_fixup_resume) \
|
||||
+ KEEP(*(.pci_fixup_resume)) \
|
||||
VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \
|
||||
VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .; \
|
||||
- *(.pci_fixup_resume_early) \
|
||||
+ KEEP(*(.pci_fixup_resume_early)) \
|
||||
VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .; \
|
||||
VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \
|
||||
- *(.pci_fixup_suspend) \
|
||||
+ KEEP(*(.pci_fixup_suspend)) \
|
||||
VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \
|
||||
} \
|
||||
\
|
||||
/* Built-in firmware blobs */ \
|
||||
.builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start_builtin_fw) = .; \
|
||||
- *(.builtin_fw) \
|
||||
+ KEEP(*(.builtin_fw)) \
|
||||
VMLINUX_SYMBOL(__end_builtin_fw) = .; \
|
||||
} \
|
||||
\
|
||||
/* RapidIO route ops */ \
|
||||
.rio_ops : AT(ADDR(.rio_ops) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start_rio_switch_ops) = .; \
|
||||
- *(.rio_switch_ops) \
|
||||
+ KEEP(*(.rio_switch_ops)) \
|
||||
VMLINUX_SYMBOL(__end_rio_switch_ops) = .; \
|
||||
} \
|
||||
\
|
||||
@@ -276,49 +277,49 @@
|
||||
/* Kernel symbol table: Normal symbols */ \
|
||||
__ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___ksymtab) = .; \
|
||||
- *(SORT(___ksymtab+*)) \
|
||||
+ KEEP(*(SORT(___ksymtab+*))) \
|
||||
VMLINUX_SYMBOL(__stop___ksymtab) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: GPL-only symbols */ \
|
||||
__ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
|
||||
- *(SORT(___ksymtab_gpl+*)) \
|
||||
+ KEEP(*(SORT(___ksymtab_gpl+*))) \
|
||||
VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: Normal unused symbols */ \
|
||||
__ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
|
||||
- *(SORT(___ksymtab_unused+*)) \
|
||||
+ KEEP(*(SORT(___ksymtab_unused+*))) \
|
||||
VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: GPL-only unused symbols */ \
|
||||
__ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
|
||||
- *(SORT(___ksymtab_unused_gpl+*)) \
|
||||
+ KEEP(*(SORT(___ksymtab_unused_gpl+*))) \
|
||||
VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: GPL-future-only symbols */ \
|
||||
__ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
|
||||
- *(SORT(___ksymtab_gpl_future+*)) \
|
||||
+ KEEP(*(SORT(___ksymtab_gpl_future+*))) \
|
||||
VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: Normal symbols */ \
|
||||
__kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___kcrctab) = .; \
|
||||
- *(SORT(___kcrctab+*)) \
|
||||
+ KEEP(*(SORT(___kcrctab+*))) \
|
||||
VMLINUX_SYMBOL(__stop___kcrctab) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: GPL-only symbols */ \
|
||||
__kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \
|
||||
- *(SORT(___kcrctab_gpl+*)) \
|
||||
+ KEEP(*(SORT(___kcrctab_gpl+*))) \
|
||||
VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
|
||||
} \
|
||||
\
|
||||
@@ -332,14 +333,14 @@
|
||||
/* Kernel symbol table: GPL-only unused symbols */ \
|
||||
__kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \
|
||||
- *(SORT(___kcrctab_unused_gpl+*)) \
|
||||
+ KEEP(*(SORT(___kcrctab_unused_gpl+*))) \
|
||||
VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: GPL-future-only symbols */ \
|
||||
__kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
|
||||
- *(SORT(___kcrctab_gpl_future+*)) \
|
||||
+ KEEP(*(SORT(___kcrctab_gpl_future+*))) \
|
||||
VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \
|
||||
} \
|
||||
\
|
||||
@@ -362,14 +363,14 @@
|
||||
/* Built-in module parameters. */ \
|
||||
__param : AT(ADDR(__param) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___param) = .; \
|
||||
- *(__param) \
|
||||
+ KEEP(*(__param)) \
|
||||
VMLINUX_SYMBOL(__stop___param) = .; \
|
||||
} \
|
||||
\
|
||||
/* Built-in module versions. */ \
|
||||
__modver : AT(ADDR(__modver) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___modver) = .; \
|
||||
- *(__modver) \
|
||||
+ KEEP(*(__modver)) \
|
||||
VMLINUX_SYMBOL(__stop___modver) = .; \
|
||||
. = ALIGN((align)); \
|
||||
VMLINUX_SYMBOL(__end_rodata) = .; \
|
||||
@@ -429,7 +430,7 @@
|
||||
#define ENTRY_TEXT \
|
||||
ALIGN_FUNCTION(); \
|
||||
VMLINUX_SYMBOL(__entry_text_start) = .; \
|
||||
- *(.entry.text) \
|
||||
+ KEEP(*(.entry.text)) \
|
||||
VMLINUX_SYMBOL(__entry_text_end) = .;
|
||||
|
||||
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
||||
@@ -457,7 +458,7 @@
|
||||
. = ALIGN(align); \
|
||||
__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___ex_table) = .; \
|
||||
- *(__ex_table) \
|
||||
+ KEEP(*(__ex_table)) \
|
||||
VMLINUX_SYMBOL(__stop___ex_table) = .; \
|
||||
}
|
||||
|
||||
@@ -473,7 +474,7 @@
|
||||
#ifdef CONFIG_CONSTRUCTORS
|
||||
#define KERNEL_CTORS() . = ALIGN(8); \
|
||||
VMLINUX_SYMBOL(__ctors_start) = .; \
|
||||
- *(.ctors) \
|
||||
+ KEEP(*(.ctors)) \
|
||||
VMLINUX_SYMBOL(__ctors_end) = .;
|
||||
#else
|
||||
#define KERNEL_CTORS()
|
||||
@@ -526,7 +527,7 @@
|
||||
#define SBSS(sbss_align) \
|
||||
. = ALIGN(sbss_align); \
|
||||
.sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \
|
||||
- *(.sbss) \
|
||||
+ *(.sbss .sbss.*) \
|
||||
*(.scommon) \
|
||||
}
|
||||
|
||||
@@ -544,7 +545,7 @@
|
||||
BSS_FIRST_SECTIONS \
|
||||
*(.bss..page_aligned) \
|
||||
*(.dynbss) \
|
||||
- *(.bss) \
|
||||
+ *(.bss .bss.*) \
|
||||
*(COMMON) \
|
||||
}
|
||||
|
||||
@@ -593,7 +594,7 @@
|
||||
. = ALIGN(8); \
|
||||
__bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___bug_table) = .; \
|
||||
- *(__bug_table) \
|
||||
+ KEEP(*(__bug_table)) \
|
||||
VMLINUX_SYMBOL(__stop___bug_table) = .; \
|
||||
}
|
||||
#else
|
||||
@@ -605,7 +606,7 @@
|
||||
. = ALIGN(4); \
|
||||
.tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__tracedata_start) = .; \
|
||||
- *(.tracedata) \
|
||||
+ KEEP(*(.tracedata)) \
|
||||
VMLINUX_SYMBOL(__tracedata_end) = .; \
|
||||
}
|
||||
#else
|
||||
@@ -622,17 +623,17 @@
|
||||
#define INIT_SETUP(initsetup_align) \
|
||||
. = ALIGN(initsetup_align); \
|
||||
VMLINUX_SYMBOL(__setup_start) = .; \
|
||||
- *(.init.setup) \
|
||||
+ KEEP(*(.init.setup)) \
|
||||
VMLINUX_SYMBOL(__setup_end) = .;
|
||||
|
||||
#define INIT_CALLS_LEVEL(level) \
|
||||
VMLINUX_SYMBOL(__initcall##level##_start) = .; \
|
||||
- *(.initcall##level##.init) \
|
||||
- *(.initcall##level##s.init) \
|
||||
+ KEEP(*(.initcall##level##.init)) \
|
||||
+ KEEP(*(.initcall##level##s.init)) \
|
||||
|
||||
#define INIT_CALLS \
|
||||
VMLINUX_SYMBOL(__initcall_start) = .; \
|
||||
- *(.initcallearly.init) \
|
||||
+ KEEP(*(.initcallearly.init)) \
|
||||
INIT_CALLS_LEVEL(0) \
|
||||
INIT_CALLS_LEVEL(1) \
|
||||
INIT_CALLS_LEVEL(2) \
|
||||
@@ -646,21 +647,21 @@
|
||||
|
||||
#define CON_INITCALL \
|
||||
VMLINUX_SYMBOL(__con_initcall_start) = .; \
|
||||
- *(.con_initcall.init) \
|
||||
+ KEEP(*(.con_initcall.init)) \
|
||||
VMLINUX_SYMBOL(__con_initcall_end) = .;
|
||||
|
||||
#define SECURITY_INITCALL \
|
||||
VMLINUX_SYMBOL(__security_initcall_start) = .; \
|
||||
- *(.security_initcall.init) \
|
||||
+ KEEP(*(.security_initcall.init)) \
|
||||
VMLINUX_SYMBOL(__security_initcall_end) = .;
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_INITRD
|
||||
#define INIT_RAM_FS \
|
||||
. = ALIGN(4); \
|
||||
VMLINUX_SYMBOL(__initramfs_start) = .; \
|
||||
- *(.init.ramfs) \
|
||||
+ KEEP(*(.init.ramfs)) \
|
||||
. = ALIGN(8); \
|
||||
- *(.init.ramfs.info)
|
||||
+ KEEP(*(.init.ramfs.info))
|
||||
#else
|
||||
#define INIT_RAM_FS
|
||||
#endif
|
@ -1,88 +0,0 @@
|
||||
--- a/include/asm-generic/vmlinux.lds.h
|
||||
+++ b/include/asm-generic/vmlinux.lds.h
|
||||
@@ -52,6 +52,16 @@
|
||||
#define LOAD_OFFSET 0
|
||||
#endif
|
||||
|
||||
+#ifndef SYMTAB_KEEP
|
||||
+#define SYMTAB_KEEP KEEP(*(SORT(___ksymtab+*)))
|
||||
+#define SYMTAB_KEEP_GPL KEEP(*(SORT(___ksymtab_gpl+*)))
|
||||
+#endif
|
||||
+
|
||||
+#ifndef SYMTAB_DISCARD
|
||||
+#define SYMTAB_DISCARD
|
||||
+#define SYMTAB_DISCARD_GPL
|
||||
+#endif
|
||||
+
|
||||
#ifndef SYMBOL_PREFIX
|
||||
#define VMLINUX_SYMBOL(sym) sym
|
||||
#else
|
||||
@@ -277,14 +287,14 @@
|
||||
/* Kernel symbol table: Normal symbols */ \
|
||||
__ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___ksymtab) = .; \
|
||||
- KEEP(*(SORT(___ksymtab+*))) \
|
||||
+ SYMTAB_KEEP \
|
||||
VMLINUX_SYMBOL(__stop___ksymtab) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: GPL-only symbols */ \
|
||||
__ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
|
||||
- KEEP(*(SORT(___ksymtab_gpl+*))) \
|
||||
+ SYMTAB_KEEP_GPL \
|
||||
VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
|
||||
} \
|
||||
\
|
||||
@@ -346,7 +356,7 @@
|
||||
\
|
||||
/* Kernel symbol table: strings */ \
|
||||
__ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
|
||||
- *(__ksymtab_strings) \
|
||||
+ *(__ksymtab_strings+*) \
|
||||
} \
|
||||
\
|
||||
/* __*init sections */ \
|
||||
@@ -680,6 +690,8 @@
|
||||
EXIT_TEXT \
|
||||
EXIT_DATA \
|
||||
EXIT_CALL \
|
||||
+ SYMTAB_DISCARD \
|
||||
+ SYMTAB_DISCARD_GPL \
|
||||
*(.discard) \
|
||||
*(.discard.*) \
|
||||
}
|
||||
--- a/scripts/Makefile.build
|
||||
+++ b/scripts/Makefile.build
|
||||
@@ -348,7 +348,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $(
|
||||
# Linker scripts preprocessor (.lds.S -> .lds)
|
||||
# ---------------------------------------------------------------------------
|
||||
quiet_cmd_cpp_lds_S = LDS $@
|
||||
- cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \
|
||||
+ cmd_cpp_lds_S = $(CPP) $(EXTRA_LDSFLAGS) $(cpp_flags) -P -C -U$(ARCH) \
|
||||
-D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $<
|
||||
|
||||
$(obj)/%.lds: $(src)/%.lds.S FORCE
|
||||
--- a/include/linux/export.h
|
||||
+++ b/include/linux/export.h
|
||||
@@ -45,12 +45,19 @@ extern struct module __this_module;
|
||||
#define __CRC_SYMBOL(sym, sec)
|
||||
#endif
|
||||
|
||||
+#ifdef MODULE
|
||||
+#define __EXPORT_SUFFIX(sym)
|
||||
+#else
|
||||
+#define __EXPORT_SUFFIX(sym) "+" #sym
|
||||
+#endif
|
||||
+
|
||||
/* For every exported symbol, place a struct in the __ksymtab section */
|
||||
#define __EXPORT_SYMBOL(sym, sec) \
|
||||
extern typeof(sym) sym; \
|
||||
__CRC_SYMBOL(sym, sec) \
|
||||
static const char __kstrtab_##sym[] \
|
||||
- __attribute__((section("__ksymtab_strings"), aligned(1))) \
|
||||
+ __attribute__((section("__ksymtab_strings" \
|
||||
+ __EXPORT_SUFFIX(sym)), aligned(1))) \
|
||||
= MODULE_SYMBOL_PREFIX #sym; \
|
||||
static const struct kernel_symbol __ksymtab_##sym \
|
||||
__used \
|
@ -1,54 +0,0 @@
|
||||
--- a/scripts/Makefile.lib
|
||||
+++ b/scripts/Makefile.lib
|
||||
@@ -296,7 +296,7 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^)
|
||||
|
||||
quiet_cmd_lzma = LZMA $@
|
||||
cmd_lzma = (cat $(filter-out FORCE,$^) | \
|
||||
- lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
|
||||
+ lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
|
||||
(rm -f $@ ; false)
|
||||
|
||||
quiet_cmd_lzo = LZO $@
|
||||
--- a/scripts/gen_initramfs_list.sh
|
||||
+++ b/scripts/gen_initramfs_list.sh
|
||||
@@ -226,7 +226,7 @@ cpio_list=
|
||||
output="/dev/stdout"
|
||||
output_file=""
|
||||
is_cpio_compressed=
|
||||
-compr="gzip -n -9 -f"
|
||||
+compr="gzip -n -9 -f -"
|
||||
|
||||
arg="$1"
|
||||
case "$arg" in
|
||||
@@ -240,9 +240,9 @@ case "$arg" in
|
||||
output_file="$1"
|
||||
cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)"
|
||||
output=${cpio_list}
|
||||
- echo "$output_file" | grep -q "\.gz$" && compr="gzip -n -9 -f"
|
||||
- echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f"
|
||||
- echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f"
|
||||
+ echo "$output_file" | grep -q "\.gz$" && compr="gzip -n -9 -f -"
|
||||
+ echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f -"
|
||||
+ echo "$output_file" | grep -q "\.lzma$" && compr="lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so"
|
||||
echo "$output_file" | grep -q "\.xz$" && \
|
||||
compr="xz --check=crc32 --lzma2=dict=1MiB"
|
||||
echo "$output_file" | grep -q "\.lzo$" && compr="lzop -9 -f"
|
||||
@@ -303,7 +303,7 @@ if [ ! -z ${output_file} ]; then
|
||||
if [ "${is_cpio_compressed}" = "compressed" ]; then
|
||||
cat ${cpio_tfile} > ${output_file}
|
||||
else
|
||||
- (cat ${cpio_tfile} | ${compr} - > ${output_file}) \
|
||||
+ (cat ${cpio_tfile} | ${compr} > ${output_file}) \
|
||||
|| (rm -f ${output_file} ; false)
|
||||
fi
|
||||
[ -z ${cpio_file} ] && rm ${cpio_tfile}
|
||||
--- a/lib/decompress.c
|
||||
+++ b/lib/decompress.c
|
||||
@@ -43,6 +43,7 @@ static const struct compress_format comp
|
||||
{ {037, 0236}, "gzip", gunzip },
|
||||
{ {0x42, 0x5a}, "bzip2", bunzip2 },
|
||||
{ {0x5d, 0x00}, "lzma", unlzma },
|
||||
+ { {0x6d, 0x00}, "lzma-openwrt", unlzma },
|
||||
{ {0xfd, 0x37}, "xz", unxz },
|
||||
{ {0x89, 0x4c}, "lzo", unlzo },
|
||||
{ {0, 0}, NULL, NULL }
|
@ -1,18 +0,0 @@
|
||||
--- a/net/netfilter/Kconfig
|
||||
+++ b/net/netfilter/Kconfig
|
||||
@@ -191,7 +191,6 @@ config NF_CONNTRACK_FTP
|
||||
|
||||
config NF_CONNTRACK_H323
|
||||
tristate "H.323 protocol support"
|
||||
- depends on (IPV6 || IPV6=n)
|
||||
depends on NETFILTER_ADVANCED
|
||||
help
|
||||
H.323 is a VoIP signalling protocol from ITU-T. As one of the most
|
||||
@@ -757,7 +756,6 @@ config NETFILTER_XT_TARGET_SECMARK
|
||||
|
||||
config NETFILTER_XT_TARGET_TCPMSS
|
||||
tristate '"TCPMSS" target support'
|
||||
- depends on (IPV6 || IPV6=n)
|
||||
default m if NETFILTER_ADVANCED=n
|
||||
---help---
|
||||
This option adds a `TCPMSS' target, which allows you to alter the
|
@ -1,18 +0,0 @@
|
||||
--- a/sound/core/Kconfig
|
||||
+++ b/sound/core/Kconfig
|
||||
@@ -7,13 +7,13 @@ config SND_PCM
|
||||
select SND_TIMER
|
||||
|
||||
config SND_HWDEP
|
||||
- tristate
|
||||
+ tristate "Sound hardware support"
|
||||
|
||||
config SND_RAWMIDI
|
||||
tristate
|
||||
|
||||
config SND_COMPRESS_OFFLOAD
|
||||
- tristate
|
||||
+ tristate "Compression offloading support"
|
||||
|
||||
# To be effective this also requires INPUT - users should say:
|
||||
# select SND_JACK if INPUT=y || INPUT=SND
|
@ -1,10 +0,0 @@
|
||||
--- a/drivers/crypto/Kconfig
|
||||
+++ b/drivers/crypto/Kconfig
|
||||
@@ -164,6 +164,7 @@ config CRYPTO_DEV_MV_CESA
|
||||
depends on PLAT_ORION
|
||||
select CRYPTO_ALGAPI
|
||||
select CRYPTO_AES
|
||||
+ select CRYPTO_HASH2
|
||||
select CRYPTO_BLKCIPHER2
|
||||
select CRYPTO_HASH
|
||||
help
|
@ -1,29 +0,0 @@
|
||||
--- a/drivers/ssb/Kconfig
|
||||
+++ b/drivers/ssb/Kconfig
|
||||
@@ -29,6 +29,7 @@ config SSB_SPROM
|
||||
config SSB_BLOCKIO
|
||||
bool
|
||||
depends on SSB
|
||||
+ default y
|
||||
|
||||
config SSB_PCIHOST_POSSIBLE
|
||||
bool
|
||||
@@ -49,7 +50,7 @@ config SSB_PCIHOST
|
||||
config SSB_B43_PCI_BRIDGE
|
||||
bool
|
||||
depends on SSB_PCIHOST
|
||||
- default n
|
||||
+ default y
|
||||
|
||||
config SSB_PCMCIAHOST_POSSIBLE
|
||||
bool
|
||||
--- a/drivers/bcma/Kconfig
|
||||
+++ b/drivers/bcma/Kconfig
|
||||
@@ -17,6 +17,7 @@ config BCMA
|
||||
config BCMA_BLOCKIO
|
||||
bool
|
||||
depends on BCMA
|
||||
+ default y
|
||||
|
||||
config BCMA_HOST_PCI_POSSIBLE
|
||||
bool
|
@ -1,23 +0,0 @@
|
||||
--- a/lib/Kconfig
|
||||
+++ b/lib/Kconfig
|
||||
@@ -277,16 +277,16 @@ config BCH_CONST_T
|
||||
# Textsearch support is select'ed if needed
|
||||
#
|
||||
config TEXTSEARCH
|
||||
- boolean
|
||||
+ boolean "Textsearch support"
|
||||
|
||||
config TEXTSEARCH_KMP
|
||||
- tristate
|
||||
+ tristate "Textsearch KMP"
|
||||
|
||||
config TEXTSEARCH_BM
|
||||
- tristate
|
||||
+ tristate "Textsearch BM"
|
||||
|
||||
config TEXTSEARCH_FSM
|
||||
- tristate
|
||||
+ tristate "Textsearch FSM"
|
||||
|
||||
config BTREE
|
||||
boolean
|
@ -1,19 +0,0 @@
|
||||
--- a/net/wireless/Kconfig
|
||||
+++ b/net/wireless/Kconfig
|
||||
@@ -150,13 +150,13 @@ config LIB80211
|
||||
you want this built into your kernel.
|
||||
|
||||
config LIB80211_CRYPT_WEP
|
||||
- tristate
|
||||
+ tristate "LIB80211_CRYPT_WEP"
|
||||
|
||||
config LIB80211_CRYPT_CCMP
|
||||
- tristate
|
||||
+ tristate "LIB80211_CRYPT_CCMP"
|
||||
|
||||
config LIB80211_CRYPT_TKIP
|
||||
- tristate
|
||||
+ tristate "LIB80211_CRYPT_TKIP"
|
||||
|
||||
config LIB80211_DEBUG
|
||||
bool "lib80211 debugging messages"
|
@ -1,47 +0,0 @@
|
||||
--- a/crypto/Kconfig
|
||||
+++ b/crypto/Kconfig
|
||||
@@ -31,7 +31,7 @@ config CRYPTO_FIPS
|
||||
this is.
|
||||
|
||||
config CRYPTO_ALGAPI
|
||||
- tristate
|
||||
+ tristate "ALGAPI"
|
||||
select CRYPTO_ALGAPI2
|
||||
help
|
||||
This option provides the API for cryptographic algorithms.
|
||||
@@ -40,7 +40,7 @@ config CRYPTO_ALGAPI2
|
||||
tristate
|
||||
|
||||
config CRYPTO_AEAD
|
||||
- tristate
|
||||
+ tristate "AEAD"
|
||||
select CRYPTO_AEAD2
|
||||
select CRYPTO_ALGAPI
|
||||
|
||||
@@ -49,7 +49,7 @@ config CRYPTO_AEAD2
|
||||
select CRYPTO_ALGAPI2
|
||||
|
||||
config CRYPTO_BLKCIPHER
|
||||
- tristate
|
||||
+ tristate "BLKCIPHER"
|
||||
select CRYPTO_BLKCIPHER2
|
||||
select CRYPTO_ALGAPI
|
||||
|
||||
@@ -60,7 +60,7 @@ config CRYPTO_BLKCIPHER2
|
||||
select CRYPTO_WORKQUEUE
|
||||
|
||||
config CRYPTO_HASH
|
||||
- tristate
|
||||
+ tristate "HASH"
|
||||
select CRYPTO_HASH2
|
||||
select CRYPTO_ALGAPI
|
||||
|
||||
@@ -69,7 +69,7 @@ config CRYPTO_HASH2
|
||||
select CRYPTO_ALGAPI2
|
||||
|
||||
config CRYPTO_RNG
|
||||
- tristate
|
||||
+ tristate "RNG"
|
||||
select CRYPTO_RNG2
|
||||
select CRYPTO_ALGAPI
|
||||
|
@ -1,22 +0,0 @@
|
||||
--- a/net/wireless/Kconfig
|
||||
+++ b/net/wireless/Kconfig
|
||||
@@ -1,5 +1,5 @@
|
||||
config WIRELESS_EXT
|
||||
- bool
|
||||
+ bool "Wireless extensions"
|
||||
|
||||
config WEXT_CORE
|
||||
def_bool y
|
||||
@@ -11,10 +11,10 @@ config WEXT_PROC
|
||||
depends on WEXT_CORE
|
||||
|
||||
config WEXT_SPY
|
||||
- bool
|
||||
+ bool "WEXT_SPY"
|
||||
|
||||
config WEXT_PRIV
|
||||
- bool
|
||||
+ bool "WEXT_PRIV"
|
||||
|
||||
config CFG80211
|
||||
tristate "cfg80211 - wireless configuration API"
|
@ -1,11 +0,0 @@
|
||||
--- a/net/netfilter/Kconfig
|
||||
+++ b/net/netfilter/Kconfig
|
||||
@@ -2,7 +2,7 @@ menu "Core Netfilter Configuration"
|
||||
depends on NET && INET && NETFILTER
|
||||
|
||||
config NETFILTER_NETLINK
|
||||
- tristate
|
||||
+ tristate "Netfilter NFNETLINK interface"
|
||||
|
||||
config NETFILTER_NETLINK_ACCT
|
||||
tristate "Netfilter NFACCT over NFNETLINK interface"
|
@ -1,72 +0,0 @@
|
||||
--- a/drivers/base/regmap/Kconfig
|
||||
+++ b/drivers/base/regmap/Kconfig
|
||||
@@ -3,20 +3,24 @@
|
||||
# subsystems should select the appropriate symbols.
|
||||
|
||||
config REGMAP
|
||||
- default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_MMIO || REGMAP_IRQ)
|
||||
select LZO_COMPRESS
|
||||
select LZO_DECOMPRESS
|
||||
select IRQ_DOMAIN if REGMAP_IRQ
|
||||
- bool
|
||||
+ tristate "Regmap"
|
||||
|
||||
config REGMAP_I2C
|
||||
- tristate
|
||||
+ select REGMAP
|
||||
+ tristate "Regmap I2C"
|
||||
|
||||
config REGMAP_SPI
|
||||
- tristate
|
||||
+ select REGMAP
|
||||
+ depends on SPI_MASTER
|
||||
+ tristate "Regmap SPI"
|
||||
|
||||
config REGMAP_MMIO
|
||||
+ select REGMAP
|
||||
tristate
|
||||
|
||||
config REGMAP_IRQ
|
||||
+ select REGMAP
|
||||
bool
|
||||
--- a/include/linux/regmap.h
|
||||
+++ b/include/linux/regmap.h
|
||||
@@ -43,7 +43,7 @@ struct reg_default {
|
||||
unsigned int def;
|
||||
};
|
||||
|
||||
-#ifdef CONFIG_REGMAP
|
||||
+#if IS_ENABLED(CONFIG_REGMAP)
|
||||
|
||||
enum regmap_endian {
|
||||
/* Unspecified -> 0 -> Backwards compatible default */
|
||||
--- a/drivers/base/regmap/Makefile
|
||||
+++ b/drivers/base/regmap/Makefile
|
||||
@@ -1,6 +1,8 @@
|
||||
-obj-$(CONFIG_REGMAP) += regmap.o regcache.o
|
||||
-obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-lzo.o
|
||||
-obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o
|
||||
+regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-lzo.o
|
||||
+ifdef CONFIG_DEBUG_FS
|
||||
+regmap-core-objs += regmap-debugfs.o
|
||||
+endif
|
||||
+obj-$(CONFIG_REGMAP) += regmap-core.o
|
||||
obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o
|
||||
obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o
|
||||
obj-$(CONFIG_REGMAP_MMIO) += regmap-mmio.o
|
||||
--- a/drivers/base/regmap/regmap.c
|
||||
+++ b/drivers/base/regmap/regmap.c
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/export.h>
|
||||
+#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/rbtree.h>
|
||||
@@ -1413,3 +1414,5 @@ static int __init regmap_initcall(void)
|
||||
return 0;
|
||||
}
|
||||
postcore_initcall(regmap_initcall);
|
||||
+
|
||||
+MODULE_LICENSE("GPL");
|
@ -1,37 +0,0 @@
|
||||
--- a/crypto/Kconfig
|
||||
+++ b/crypto/Kconfig
|
||||
@@ -95,10 +95,10 @@ config CRYPTO_MANAGER
|
||||
|
||||
config CRYPTO_MANAGER2
|
||||
def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y)
|
||||
- select CRYPTO_AEAD2
|
||||
- select CRYPTO_HASH2
|
||||
- select CRYPTO_BLKCIPHER2
|
||||
- select CRYPTO_PCOMP2
|
||||
+ select CRYPTO_AEAD2 if !CRYPTO_MANAGER_DISABLE_TESTS
|
||||
+ select CRYPTO_HASH2 if !CRYPTO_MANAGER_DISABLE_TESTS
|
||||
+ select CRYPTO_BLKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS
|
||||
+ select CRYPTO_PCOMP2 if !CRYPTO_MANAGER_DISABLE_TESTS
|
||||
|
||||
config CRYPTO_USER
|
||||
tristate "Userspace cryptographic algorithm configuration"
|
||||
--- a/crypto/algboss.c
|
||||
+++ b/crypto/algboss.c
|
||||
@@ -247,6 +247,9 @@ static int cryptomgr_schedule_test(struc
|
||||
type = alg->cra_flags;
|
||||
|
||||
/* This piece of crap needs to disappear into per-type test hooks. */
|
||||
+#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
|
||||
+ type |= CRYPTO_ALG_TESTED;
|
||||
+#else
|
||||
if ((!((type ^ CRYPTO_ALG_TYPE_BLKCIPHER) &
|
||||
CRYPTO_ALG_TYPE_BLKCIPHER_MASK) && !(type & CRYPTO_ALG_GENIV) &&
|
||||
((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) ==
|
||||
@@ -255,6 +258,7 @@ static int cryptomgr_schedule_test(struc
|
||||
(!((type ^ CRYPTO_ALG_TYPE_AEAD) & CRYPTO_ALG_TYPE_MASK) &&
|
||||
alg->cra_type == &crypto_nivaead_type && alg->cra_aead.ivsize))
|
||||
type |= CRYPTO_ALG_TESTED;
|
||||
+#endif
|
||||
|
||||
param->type = type;
|
||||
|
@ -1,233 +0,0 @@
|
||||
From b00c6f1a96a2cee4b9e63a8aa4f10ed0473f437b Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Tue, 29 Jan 2013 10:24:12 +0100
|
||||
Subject: [PATCH 001/118] MIPS: BCM63XX: export bcm63xx tag to userspace
|
||||
|
||||
---
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h | 96 ---------------------
|
||||
drivers/mtd/bcm63xxpart.c | 2 +-
|
||||
include/uapi/linux/Kbuild | 1 +
|
||||
include/uapi/linux/bcm963xx_tag.h | 96 +++++++++++++++++++++
|
||||
4 files changed, 98 insertions(+), 97 deletions(-)
|
||||
delete mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
|
||||
create mode 100644 include/uapi/linux/bcm963xx_tag.h
|
||||
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
|
||||
+++ /dev/null
|
||||
@@ -1,96 +0,0 @@
|
||||
-#ifndef __BCM963XX_TAG_H
|
||||
-#define __BCM963XX_TAG_H
|
||||
-
|
||||
-#define TAGVER_LEN 4 /* Length of Tag Version */
|
||||
-#define TAGLAYOUT_LEN 4 /* Length of FlashLayoutVer */
|
||||
-#define SIG1_LEN 20 /* Company Signature 1 Length */
|
||||
-#define SIG2_LEN 14 /* Company Signature 2 Length */
|
||||
-#define BOARDID_LEN 16 /* Length of BoardId */
|
||||
-#define ENDIANFLAG_LEN 2 /* Endian Flag Length */
|
||||
-#define CHIPID_LEN 6 /* Chip Id Length */
|
||||
-#define IMAGE_LEN 10 /* Length of Length Field */
|
||||
-#define ADDRESS_LEN 12 /* Length of Address field */
|
||||
-#define DUALFLAG_LEN 2 /* Dual Image flag Length */
|
||||
-#define INACTIVEFLAG_LEN 2 /* Inactie Flag Length */
|
||||
-#define RSASIG_LEN 20 /* Length of RSA Signature in tag */
|
||||
-#define TAGINFO1_LEN 30 /* Length of vendor information field1 in tag */
|
||||
-#define FLASHLAYOUTVER_LEN 4 /* Length of Flash Layout Version String tag */
|
||||
-#define TAGINFO2_LEN 16 /* Length of vendor information field2 in tag */
|
||||
-#define ALTTAGINFO_LEN 54 /* Alternate length for vendor information; Pirelli */
|
||||
-
|
||||
-#define NUM_PIRELLI 2
|
||||
-#define IMAGETAG_CRC_START 0xFFFFFFFF
|
||||
-
|
||||
-#define PIRELLI_BOARDS { \
|
||||
- "AGPF-S0", \
|
||||
- "DWV-S0", \
|
||||
-}
|
||||
-
|
||||
-/*
|
||||
- * The broadcom firmware assumes the rootfs starts the image,
|
||||
- * therefore uses the rootfs start (flash_image_address)
|
||||
- * to determine where to flash the image. Since we have the kernel first
|
||||
- * we have to give it the kernel address, but the crc uses the length
|
||||
- * associated with this address (root_length), which is added to the kernel
|
||||
- * length (kernel_length) to determine the length of image to flash and thus
|
||||
- * needs to be rootfs + deadcode (jffs2 EOF marker)
|
||||
-*/
|
||||
-
|
||||
-struct bcm_tag {
|
||||
- /* 0-3: Version of the image tag */
|
||||
- char tag_version[TAGVER_LEN];
|
||||
- /* 4-23: Company Line 1 */
|
||||
- char sig_1[SIG1_LEN];
|
||||
- /* 24-37: Company Line 2 */
|
||||
- char sig_2[SIG2_LEN];
|
||||
- /* 38-43: Chip this image is for */
|
||||
- char chip_id[CHIPID_LEN];
|
||||
- /* 44-59: Board name */
|
||||
- char board_id[BOARDID_LEN];
|
||||
- /* 60-61: Map endianness -- 1 BE 0 LE */
|
||||
- char big_endian[ENDIANFLAG_LEN];
|
||||
- /* 62-71: Total length of image */
|
||||
- char total_length[IMAGE_LEN];
|
||||
- /* 72-83: Address in memory of CFE */
|
||||
- char cfe__address[ADDRESS_LEN];
|
||||
- /* 84-93: Size of CFE */
|
||||
- char cfe_length[IMAGE_LEN];
|
||||
- /* 94-105: Address in memory of image start
|
||||
- * (kernel for OpenWRT, rootfs for stock firmware)
|
||||
- */
|
||||
- char flash_image_start[ADDRESS_LEN];
|
||||
- /* 106-115: Size of rootfs */
|
||||
- char root_length[IMAGE_LEN];
|
||||
- /* 116-127: Address in memory of kernel */
|
||||
- char kernel_address[ADDRESS_LEN];
|
||||
- /* 128-137: Size of kernel */
|
||||
- char kernel_length[IMAGE_LEN];
|
||||
- /* 138-139: Unused at the moment */
|
||||
- char dual_image[DUALFLAG_LEN];
|
||||
- /* 140-141: Unused at the moment */
|
||||
- char inactive_flag[INACTIVEFLAG_LEN];
|
||||
- /* 142-161: RSA Signature (not used; some vendors may use this) */
|
||||
- char rsa_signature[RSASIG_LEN];
|
||||
- /* 162-191: Compilation and related information (not used in OpenWrt) */
|
||||
- char information1[TAGINFO1_LEN];
|
||||
- /* 192-195: Version flash layout */
|
||||
- char flash_layout_ver[FLASHLAYOUTVER_LEN];
|
||||
- /* 196-199: kernel+rootfs CRC32 */
|
||||
- __u32 fskernel_crc;
|
||||
- /* 200-215: Unused except on Alice Gate where is is information */
|
||||
- char information2[TAGINFO2_LEN];
|
||||
- /* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
|
||||
- __u32 image_crc;
|
||||
- /* 220-223: CRC32 of rootfs partition */
|
||||
- __u32 rootfs_crc;
|
||||
- /* 224-227: CRC32 of kernel partition */
|
||||
- __u32 kernel_crc;
|
||||
- /* 228-235: Unused at present */
|
||||
- char reserved1[8];
|
||||
- /* 236-239: CRC32 of header excluding last 20 bytes */
|
||||
- __u32 header_crc;
|
||||
- /* 240-255: Unused at present */
|
||||
- char reserved2[16];
|
||||
-};
|
||||
-
|
||||
-#endif /* __BCM63XX_TAG_H */
|
||||
--- a/drivers/mtd/bcm63xxpart.c
|
||||
+++ b/drivers/mtd/bcm63xxpart.c
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
-#include <asm/mach-bcm63xx/bcm963xx_tag.h>
|
||||
+#include <linux/bcm963xx_tag.h>
|
||||
#include <asm/mach-bcm63xx/board_bcm963xx.h>
|
||||
|
||||
#define BCM63XX_EXTENDED_SIZE 0xBFC00000 /* Extended flash address */
|
||||
--- a/include/uapi/linux/Kbuild
|
||||
+++ b/include/uapi/linux/Kbuild
|
||||
@@ -67,6 +67,7 @@ header-y += binfmts.h
|
||||
header-y += blkpg.h
|
||||
header-y += blktrace_api.h
|
||||
header-y += bpqether.h
|
||||
+header-y += bcm963xx_tag.h
|
||||
header-y += bsg.h
|
||||
header-y += can.h
|
||||
header-y += capability.h
|
||||
--- /dev/null
|
||||
+++ b/include/uapi/linux/bcm963xx_tag.h
|
||||
@@ -0,0 +1,96 @@
|
||||
+#ifndef __BCM963XX_TAG_H
|
||||
+#define __BCM963XX_TAG_H
|
||||
+
|
||||
+#define TAGVER_LEN 4 /* Length of Tag Version */
|
||||
+#define TAGLAYOUT_LEN 4 /* Length of FlashLayoutVer */
|
||||
+#define SIG1_LEN 20 /* Company Signature 1 Length */
|
||||
+#define SIG2_LEN 14 /* Company Signature 2 Length */
|
||||
+#define BOARDID_LEN 16 /* Length of BoardId */
|
||||
+#define ENDIANFLAG_LEN 2 /* Endian Flag Length */
|
||||
+#define CHIPID_LEN 6 /* Chip Id Length */
|
||||
+#define IMAGE_LEN 10 /* Length of Length Field */
|
||||
+#define ADDRESS_LEN 12 /* Length of Address field */
|
||||
+#define DUALFLAG_LEN 2 /* Dual Image flag Length */
|
||||
+#define INACTIVEFLAG_LEN 2 /* Inactie Flag Length */
|
||||
+#define RSASIG_LEN 20 /* Length of RSA Signature in tag */
|
||||
+#define TAGINFO1_LEN 30 /* Length of vendor information field1 in tag */
|
||||
+#define FLASHLAYOUTVER_LEN 4 /* Length of Flash Layout Version String tag */
|
||||
+#define TAGINFO2_LEN 16 /* Length of vendor information field2 in tag */
|
||||
+#define ALTTAGINFO_LEN 54 /* Alternate length for vendor information; Pirelli */
|
||||
+
|
||||
+#define NUM_PIRELLI 2
|
||||
+#define IMAGETAG_CRC_START 0xFFFFFFFF
|
||||
+
|
||||
+#define PIRELLI_BOARDS { \
|
||||
+ "AGPF-S0", \
|
||||
+ "DWV-S0", \
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * The broadcom firmware assumes the rootfs starts the image,
|
||||
+ * therefore uses the rootfs start (flash_image_address)
|
||||
+ * to determine where to flash the image. Since we have the kernel first
|
||||
+ * we have to give it the kernel address, but the crc uses the length
|
||||
+ * associated with this address (root_length), which is added to the kernel
|
||||
+ * length (kernel_length) to determine the length of image to flash and thus
|
||||
+ * needs to be rootfs + deadcode (jffs2 EOF marker)
|
||||
+*/
|
||||
+
|
||||
+struct bcm_tag {
|
||||
+ /* 0-3: Version of the image tag */
|
||||
+ char tag_version[TAGVER_LEN];
|
||||
+ /* 4-23: Company Line 1 */
|
||||
+ char sig_1[SIG1_LEN];
|
||||
+ /* 24-37: Company Line 2 */
|
||||
+ char sig_2[SIG2_LEN];
|
||||
+ /* 38-43: Chip this image is for */
|
||||
+ char chip_id[CHIPID_LEN];
|
||||
+ /* 44-59: Board name */
|
||||
+ char board_id[BOARDID_LEN];
|
||||
+ /* 60-61: Map endianness -- 1 BE 0 LE */
|
||||
+ char big_endian[ENDIANFLAG_LEN];
|
||||
+ /* 62-71: Total length of image */
|
||||
+ char total_length[IMAGE_LEN];
|
||||
+ /* 72-83: Address in memory of CFE */
|
||||
+ char cfe__address[ADDRESS_LEN];
|
||||
+ /* 84-93: Size of CFE */
|
||||
+ char cfe_length[IMAGE_LEN];
|
||||
+ /* 94-105: Address in memory of image start
|
||||
+ * (kernel for OpenWRT, rootfs for stock firmware)
|
||||
+ */
|
||||
+ char flash_image_start[ADDRESS_LEN];
|
||||
+ /* 106-115: Size of rootfs */
|
||||
+ char root_length[IMAGE_LEN];
|
||||
+ /* 116-127: Address in memory of kernel */
|
||||
+ char kernel_address[ADDRESS_LEN];
|
||||
+ /* 128-137: Size of kernel */
|
||||
+ char kernel_length[IMAGE_LEN];
|
||||
+ /* 138-139: Unused at the moment */
|
||||
+ char dual_image[DUALFLAG_LEN];
|
||||
+ /* 140-141: Unused at the moment */
|
||||
+ char inactive_flag[INACTIVEFLAG_LEN];
|
||||
+ /* 142-161: RSA Signature (not used; some vendors may use this) */
|
||||
+ char rsa_signature[RSASIG_LEN];
|
||||
+ /* 162-191: Compilation and related information (not used in OpenWrt) */
|
||||
+ char information1[TAGINFO1_LEN];
|
||||
+ /* 192-195: Version flash layout */
|
||||
+ char flash_layout_ver[FLASHLAYOUTVER_LEN];
|
||||
+ /* 196-199: kernel+rootfs CRC32 */
|
||||
+ __u32 fskernel_crc;
|
||||
+ /* 200-215: Unused except on Alice Gate where is is information */
|
||||
+ char information2[TAGINFO2_LEN];
|
||||
+ /* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
|
||||
+ __u32 image_crc;
|
||||
+ /* 220-223: CRC32 of rootfs partition */
|
||||
+ __u32 rootfs_crc;
|
||||
+ /* 224-227: CRC32 of kernel partition */
|
||||
+ __u32 kernel_crc;
|
||||
+ /* 228-235: Unused at present */
|
||||
+ char reserved1[8];
|
||||
+ /* 236-239: CRC32 of header excluding last 20 bytes */
|
||||
+ __u32 header_crc;
|
||||
+ /* 240-255: Unused at present */
|
||||
+ char reserved2[16];
|
||||
+};
|
||||
+
|
||||
+#endif /* __BCM63XX_TAG_H */
|
@ -1,23 +0,0 @@
|
||||
--- a/lib/Kconfig
|
||||
+++ b/lib/Kconfig
|
||||
@@ -175,16 +175,16 @@ config AUDIT_GENERIC
|
||||
# compression support is select'ed if needed
|
||||
#
|
||||
config ZLIB_INFLATE
|
||||
- tristate
|
||||
+ tristate "ZLIB inflate support"
|
||||
|
||||
config ZLIB_DEFLATE
|
||||
- tristate
|
||||
+ tristate "ZLIB deflate support"
|
||||
|
||||
config LZO_COMPRESS
|
||||
- tristate
|
||||
+ tristate "LZO compress support"
|
||||
|
||||
config LZO_DECOMPRESS
|
||||
- tristate
|
||||
+ tristate "LZO decompress support"
|
||||
|
||||
source "lib/xz/Kconfig"
|
||||
|
@ -1,39 +0,0 @@
|
||||
From: Mark Miller <mark@mirell.org>
|
||||
|
||||
This exposes the CONFIG_BOOT_RAW symbol in Kconfig. This is needed on
|
||||
certain Broadcom chipsets running CFE in order to load the kernel.
|
||||
|
||||
Signed-off-by: Mark Miller <mark@mirell.org>
|
||||
Acked-by: Rob Landley <rob@landley.net>
|
||||
---
|
||||
--- a/arch/mips/Kconfig
|
||||
+++ b/arch/mips/Kconfig
|
||||
@@ -912,9 +912,6 @@ config ARC
|
||||
config ARCH_MAY_HAVE_PC_FDC
|
||||
bool
|
||||
|
||||
-config BOOT_RAW
|
||||
- bool
|
||||
-
|
||||
config CEVT_BCM1480
|
||||
bool
|
||||
|
||||
@@ -2387,6 +2384,18 @@ config USE_OF
|
||||
select OF_EARLY_FLATTREE
|
||||
select IRQ_DOMAIN
|
||||
|
||||
+config BOOT_RAW
|
||||
+ bool "Enable the kernel to be executed from the load address"
|
||||
+ default n
|
||||
+ help
|
||||
+ Allow the kernel to be executed from the load address for
|
||||
+ bootloaders which cannot read the ELF format. This places
|
||||
+ a jump to start_kernel at the load address.
|
||||
+
|
||||
+ If unsure, say N.
|
||||
+
|
||||
+
|
||||
+
|
||||
endmenu
|
||||
|
||||
config LOCKDEP_SUPPORT
|
@ -1,28 +0,0 @@
|
||||
--- a/arch/mips/Kconfig
|
||||
+++ b/arch/mips/Kconfig
|
||||
@@ -1011,6 +1011,10 @@ config SYNC_R4K
|
||||
config MIPS_MACHINE
|
||||
def_bool n
|
||||
|
||||
+config IMAGE_CMDLINE_HACK
|
||||
+ bool "OpenWrt specific image command line hack"
|
||||
+ default n
|
||||
+
|
||||
config NO_IOPORT
|
||||
def_bool n
|
||||
|
||||
--- a/arch/mips/kernel/head.S
|
||||
+++ b/arch/mips/kernel/head.S
|
||||
@@ -141,6 +141,12 @@ FEXPORT(__kernel_entry)
|
||||
j kernel_entry
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_IMAGE_CMDLINE_HACK
|
||||
+ .ascii "CMDLINE:"
|
||||
+EXPORT(__image_cmdline)
|
||||
+ .fill 0x400
|
||||
+#endif /* CONFIG_IMAGE_CMDLINE_HACK */
|
||||
+
|
||||
__REF
|
||||
|
||||
NESTED(kernel_entry, 16, sp) # kernel entry point
|
@ -1,11 +0,0 @@
|
||||
--- a/arch/mips/Makefile
|
||||
+++ b/arch/mips/Makefile
|
||||
@@ -87,7 +87,7 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin
|
||||
# machines may also. Since BFD is incredibly buggy with respect to
|
||||
# crossformat linking we rely on the elf2ecoff tool for format conversion.
|
||||
#
|
||||
-cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
|
||||
+cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely
|
||||
cflags-y += -msoft-float
|
||||
LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections
|
||||
KBUILD_AFLAGS_MODULE += -mlong-calls
|
@ -1,11 +0,0 @@
|
||||
--- a/arch/mips/kernel/machine_kexec.c
|
||||
+++ b/arch/mips/kernel/machine_kexec.c
|
||||
@@ -52,7 +52,7 @@ machine_kexec(struct kimage *image)
|
||||
reboot_code_buffer =
|
||||
(unsigned long)page_address(image->control_code_page);
|
||||
|
||||
- kexec_start_address = image->start;
|
||||
+ kexec_start_address = (unsigned long) phys_to_virt(image->start);
|
||||
kexec_indirection_page =
|
||||
(unsigned long) phys_to_virt(image->head & PAGE_MASK);
|
||||
|
@ -1,160 +0,0 @@
|
||||
MIPS: allow disabling the kernel FPU emulator
|
||||
|
||||
This patch allows turning off the in-kernel Algorithmics
|
||||
FPU emulator support, which allows one to save a couple of
|
||||
precious blocks on an embedded system.
|
||||
|
||||
Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
||||
--
|
||||
--- a/arch/mips/Kconfig
|
||||
+++ b/arch/mips/Kconfig
|
||||
@@ -996,6 +996,17 @@ config I8259
|
||||
config MIPS_BONITO64
|
||||
bool
|
||||
|
||||
+config MIPS_FPU_EMU
|
||||
+ bool "Enable FPU emulation"
|
||||
+ default y
|
||||
+ help
|
||||
+ This option allows building a kernel with or without the Algorithmics
|
||||
+ FPU emulator enabled. Turning off this option results in a kernel which
|
||||
+ does not catch floating operations exceptions. Make sure that your toolchain
|
||||
+ is configured to enable software floating point emulation in that case.
|
||||
+
|
||||
+ If unsure say Y here.
|
||||
+
|
||||
config MIPS_MSC
|
||||
bool
|
||||
|
||||
--- a/arch/mips/math-emu/Makefile
|
||||
+++ b/arch/mips/math-emu/Makefile
|
||||
@@ -2,11 +2,13 @@
|
||||
# Makefile for the Linux/MIPS kernel FPU emulation.
|
||||
#
|
||||
|
||||
-obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
|
||||
+obj-y := kernel_linkage.o dsemul.o cp1emu.o
|
||||
+
|
||||
+obj-$(CONFIG_MIPS_FPU_EMU) += ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
|
||||
ieee754xcpt.o dp_frexp.o dp_modf.o dp_div.o dp_mul.o dp_sub.o \
|
||||
dp_add.o dp_fsp.o dp_cmp.o dp_logb.o dp_scalb.o dp_simple.o \
|
||||
dp_tint.o dp_fint.o dp_tlong.o dp_flong.o sp_frexp.o sp_modf.o \
|
||||
sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_logb.o \
|
||||
sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \
|
||||
- dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o
|
||||
+ dp_sqrt.o sp_sqrt.o
|
||||
|
||||
--- a/arch/mips/math-emu/cp1emu.c
|
||||
+++ b/arch/mips/math-emu/cp1emu.c
|
||||
@@ -58,7 +58,11 @@
|
||||
#define __mips 4
|
||||
|
||||
/* Function which emulates a floating point instruction. */
|
||||
+#ifdef CONFIG_DEBUG_FS
|
||||
+DEFINE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats);
|
||||
+#endif
|
||||
|
||||
+#ifdef CONFIG_MIPS_FPU_EMU
|
||||
static int fpu_emu(struct pt_regs *, struct mips_fpu_struct *,
|
||||
mips_instruction);
|
||||
|
||||
@@ -69,10 +73,6 @@ static int fpux_emu(struct pt_regs *,
|
||||
|
||||
/* Further private data for which no space exists in mips_fpu_struct */
|
||||
|
||||
-#ifdef CONFIG_DEBUG_FS
|
||||
-DEFINE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats);
|
||||
-#endif
|
||||
-
|
||||
/* Control registers */
|
||||
|
||||
#define FPCREG_RID 0 /* $0 = revision id */
|
||||
@@ -1360,7 +1360,6 @@ int fpu_emulator_cop1Handler(struct pt_r
|
||||
|
||||
return sig;
|
||||
}
|
||||
-
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
|
||||
static int fpuemu_stat_get(void *data, u64 *val)
|
||||
@@ -1409,4 +1408,11 @@ static int __init debugfs_fpuemu(void)
|
||||
return 0;
|
||||
}
|
||||
__initcall(debugfs_fpuemu);
|
||||
-#endif
|
||||
+#endif /* CONFIG_DEBUGFS */
|
||||
+#else
|
||||
+int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
|
||||
+ int has_fpu)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif /* CONFIG_MIPS_FPU_EMU */
|
||||
--- a/arch/mips/math-emu/dsemul.c
|
||||
+++ b/arch/mips/math-emu/dsemul.c
|
||||
@@ -108,6 +108,7 @@ int mips_dsemul(struct pt_regs *regs, mi
|
||||
return SIGILL; /* force out of emulation loop */
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_MIPS_FPU_EMU
|
||||
int do_dsemulret(struct pt_regs *xcp)
|
||||
{
|
||||
struct emuframe __user *fr;
|
||||
@@ -164,3 +165,9 @@ int do_dsemulret(struct pt_regs *xcp)
|
||||
|
||||
return 1;
|
||||
}
|
||||
+#else
|
||||
+int do_dsemulret(struct pt_regs *xcp)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif /* CONFIG_MIPS_FPU_EMU */
|
||||
--- a/arch/mips/math-emu/kernel_linkage.c
|
||||
+++ b/arch/mips/math-emu/kernel_linkage.c
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#define SIGNALLING_NAN 0x7ff800007ff80000LL
|
||||
|
||||
+#ifdef CONFIG_MIPS_FPU_EMU
|
||||
void fpu_emulator_init_fpu(void)
|
||||
{
|
||||
static int first = 1;
|
||||
@@ -112,4 +113,36 @@ int fpu_emulator_restore_context32(struc
|
||||
|
||||
return err;
|
||||
}
|
||||
-#endif
|
||||
+#endif /* CONFIG_64BIT */
|
||||
+#else
|
||||
+
|
||||
+void fpu_emulator_init_fpu(void)
|
||||
+{
|
||||
+ printk(KERN_INFO "FPU emulator disabled, make sure your toolchain"
|
||||
+ "was compiled with software floating point support (soft-float)\n");
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+int fpu_emulator_save_context(struct sigcontext __user *sc)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int fpu_emulator_restore_context(struct sigcontext __user *sc)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int fpu_emulator_save_context32(struct sigcontext32 __user *sc)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int fpu_emulator_restore_context32(struct sigcontext32 __user *sc)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#ifdef CONFIG_64BIT
|
||||
+#endif /* CONFIG_64BIT */
|
||||
+#endif /* CONFIG_MIPS_FPU_EMU */
|
@ -1,350 +0,0 @@
|
||||
--- a/arch/mips/Makefile
|
||||
+++ b/arch/mips/Makefile
|
||||
@@ -90,8 +90,13 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin
|
||||
cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely
|
||||
cflags-y += -msoft-float
|
||||
LDFLAGS_vmlinux += -G 0 -static -n -nostdlib --gc-sections
|
||||
+ifdef CONFIG_64BIT
|
||||
KBUILD_AFLAGS_MODULE += -mlong-calls
|
||||
KBUILD_CFLAGS_MODULE += -mlong-calls
|
||||
+else
|
||||
+KBUILD_AFLAGS_MODULE += -mno-long-calls
|
||||
+KBUILD_CFLAGS_MODULE += -mno-long-calls
|
||||
+endif
|
||||
|
||||
KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
|
||||
|
||||
--- a/arch/mips/include/asm/module.h
|
||||
+++ b/arch/mips/include/asm/module.h
|
||||
@@ -11,6 +11,11 @@ struct mod_arch_specific {
|
||||
const struct exception_table_entry *dbe_start;
|
||||
const struct exception_table_entry *dbe_end;
|
||||
struct mips_hi16 *r_mips_hi16_list;
|
||||
+
|
||||
+ void *phys_plt_tbl;
|
||||
+ void *virt_plt_tbl;
|
||||
+ unsigned int phys_plt_offset;
|
||||
+ unsigned int virt_plt_offset;
|
||||
};
|
||||
|
||||
typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */
|
||||
--- a/arch/mips/kernel/module.c
|
||||
+++ b/arch/mips/kernel/module.c
|
||||
@@ -42,14 +42,219 @@ struct mips_hi16 {
|
||||
static LIST_HEAD(dbe_list);
|
||||
static DEFINE_SPINLOCK(dbe_lock);
|
||||
|
||||
-#ifdef MODULE_START
|
||||
+/*
|
||||
+ * Get the potential max trampolines size required of the init and
|
||||
+ * non-init sections. Only used if we cannot find enough contiguous
|
||||
+ * physically mapped memory to put the module into.
|
||||
+ */
|
||||
+static unsigned int
|
||||
+get_plt_size(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
|
||||
+ const char *secstrings, unsigned int symindex, bool is_init)
|
||||
+{
|
||||
+ unsigned long ret = 0;
|
||||
+ unsigned int i, j;
|
||||
+ Elf_Sym *syms;
|
||||
+
|
||||
+ /* Everything marked ALLOC (this includes the exported symbols) */
|
||||
+ for (i = 1; i < hdr->e_shnum; ++i) {
|
||||
+ unsigned int info = sechdrs[i].sh_info;
|
||||
+
|
||||
+ if (sechdrs[i].sh_type != SHT_REL
|
||||
+ && sechdrs[i].sh_type != SHT_RELA)
|
||||
+ continue;
|
||||
+
|
||||
+ /* Not a valid relocation section? */
|
||||
+ if (info >= hdr->e_shnum)
|
||||
+ continue;
|
||||
+
|
||||
+ /* Don't bother with non-allocated sections */
|
||||
+ if (!(sechdrs[info].sh_flags & SHF_ALLOC))
|
||||
+ continue;
|
||||
+
|
||||
+ /* If it's called *.init*, and we're not init, we're
|
||||
+ not interested */
|
||||
+ if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0)
|
||||
+ != is_init)
|
||||
+ continue;
|
||||
+
|
||||
+ syms = (Elf_Sym *) sechdrs[symindex].sh_addr;
|
||||
+ if (sechdrs[i].sh_type == SHT_REL) {
|
||||
+ Elf_Mips_Rel *rel = (void *) sechdrs[i].sh_addr;
|
||||
+ unsigned int size = sechdrs[i].sh_size / sizeof(*rel);
|
||||
+
|
||||
+ for (j = 0; j < size; ++j) {
|
||||
+ Elf_Sym *sym;
|
||||
+
|
||||
+ if (ELF_MIPS_R_TYPE(rel[j]) != R_MIPS_26)
|
||||
+ continue;
|
||||
+
|
||||
+ sym = syms + ELF_MIPS_R_SYM(rel[j]);
|
||||
+ if (!is_init && sym->st_shndx != SHN_UNDEF)
|
||||
+ continue;
|
||||
+
|
||||
+ ret += 4 * sizeof(int);
|
||||
+ }
|
||||
+ } else {
|
||||
+ Elf_Mips_Rela *rela = (void *) sechdrs[i].sh_addr;
|
||||
+ unsigned int size = sechdrs[i].sh_size / sizeof(*rela);
|
||||
+
|
||||
+ for (j = 0; j < size; ++j) {
|
||||
+ Elf_Sym *sym;
|
||||
+
|
||||
+ if (ELF_MIPS_R_TYPE(rela[j]) != R_MIPS_26)
|
||||
+ continue;
|
||||
+
|
||||
+ sym = syms + ELF_MIPS_R_SYM(rela[j]);
|
||||
+ if (!is_init && sym->st_shndx != SHN_UNDEF)
|
||||
+ continue;
|
||||
+
|
||||
+ ret += 4 * sizeof(int);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+#ifndef MODULE_START
|
||||
+static void *alloc_phys(unsigned long size)
|
||||
+{
|
||||
+ unsigned order;
|
||||
+ struct page *page;
|
||||
+ struct page *p;
|
||||
+
|
||||
+ size = PAGE_ALIGN(size);
|
||||
+ order = get_order(size);
|
||||
+
|
||||
+ page = alloc_pages(GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN |
|
||||
+ __GFP_THISNODE, order);
|
||||
+ if (!page)
|
||||
+ return NULL;
|
||||
+
|
||||
+ split_page(page, order);
|
||||
+
|
||||
+ for (p = page + (size >> PAGE_SHIFT); p < page + (1 << order); ++p)
|
||||
+ __free_page(p);
|
||||
+
|
||||
+ return page_address(page);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+static void free_phys(void *ptr, unsigned long size)
|
||||
+{
|
||||
+ struct page *page;
|
||||
+ struct page *end;
|
||||
+
|
||||
+ page = virt_to_page(ptr);
|
||||
+ end = page + (PAGE_ALIGN(size) >> PAGE_SHIFT);
|
||||
+
|
||||
+ for (; page < end; ++page)
|
||||
+ __free_page(page);
|
||||
+}
|
||||
+
|
||||
+
|
||||
void *module_alloc(unsigned long size)
|
||||
{
|
||||
+#ifdef MODULE_START
|
||||
return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END,
|
||||
GFP_KERNEL, PAGE_KERNEL, -1,
|
||||
__builtin_return_address(0));
|
||||
+#else
|
||||
+ void *ptr;
|
||||
+
|
||||
+ if (size == 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ ptr = alloc_phys(size);
|
||||
+
|
||||
+ /* If we failed to allocate physically contiguous memory,
|
||||
+ * fall back to regular vmalloc. The module loader code will
|
||||
+ * create jump tables to handle long jumps */
|
||||
+ if (!ptr)
|
||||
+ return vmalloc(size);
|
||||
+
|
||||
+ return ptr;
|
||||
+#endif
|
||||
}
|
||||
+
|
||||
+static inline bool is_phys_addr(void *ptr)
|
||||
+{
|
||||
+#ifdef CONFIG_64BIT
|
||||
+ return (KSEGX((unsigned long)ptr) == CKSEG0);
|
||||
+#else
|
||||
+ return (KSEGX(ptr) == KSEG0);
|
||||
#endif
|
||||
+}
|
||||
+
|
||||
+/* Free memory returned from module_alloc */
|
||||
+void module_free(struct module *mod, void *module_region)
|
||||
+{
|
||||
+ if (is_phys_addr(module_region)) {
|
||||
+ if (mod->module_init == module_region)
|
||||
+ free_phys(module_region, mod->init_size);
|
||||
+ else if (mod->module_core == module_region)
|
||||
+ free_phys(module_region, mod->core_size);
|
||||
+ else
|
||||
+ BUG();
|
||||
+ } else {
|
||||
+ vfree(module_region);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void *__module_alloc(int size, bool phys)
|
||||
+{
|
||||
+ void *ptr;
|
||||
+
|
||||
+ if (phys)
|
||||
+ ptr = kmalloc(size, GFP_KERNEL);
|
||||
+ else
|
||||
+ ptr = vmalloc(size);
|
||||
+ return ptr;
|
||||
+}
|
||||
+
|
||||
+static void __module_free(void *ptr)
|
||||
+{
|
||||
+ if (is_phys_addr(ptr))
|
||||
+ kfree(ptr);
|
||||
+ else
|
||||
+ vfree(ptr);
|
||||
+}
|
||||
+
|
||||
+int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
|
||||
+ char *secstrings, struct module *mod)
|
||||
+{
|
||||
+ unsigned int symindex = 0;
|
||||
+ unsigned int core_size, init_size;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 1; i < hdr->e_shnum; i++)
|
||||
+ if (sechdrs[i].sh_type == SHT_SYMTAB)
|
||||
+ symindex = i;
|
||||
+
|
||||
+ core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false);
|
||||
+ init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true);
|
||||
+
|
||||
+ mod->arch.phys_plt_offset = 0;
|
||||
+ mod->arch.virt_plt_offset = 0;
|
||||
+ mod->arch.phys_plt_tbl = NULL;
|
||||
+ mod->arch.virt_plt_tbl = NULL;
|
||||
+
|
||||
+ if ((core_size + init_size) == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ mod->arch.phys_plt_tbl = __module_alloc(core_size + init_size, 1);
|
||||
+ if (!mod->arch.phys_plt_tbl)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ mod->arch.virt_plt_tbl = __module_alloc(core_size + init_size, 0);
|
||||
+ if (!mod->arch.virt_plt_tbl) {
|
||||
+ __module_free(mod->arch.phys_plt_tbl);
|
||||
+ mod->arch.phys_plt_tbl = NULL;
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
|
||||
int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v)
|
||||
{
|
||||
@@ -63,8 +268,39 @@ static int apply_r_mips_32_rel(struct mo
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static Elf_Addr add_plt_entry_to(unsigned *plt_offset,
|
||||
+ void *start, Elf_Addr v)
|
||||
+{
|
||||
+ unsigned *tramp = start + *plt_offset;
|
||||
+ *plt_offset += 4 * sizeof(int);
|
||||
+
|
||||
+ /* adjust carry for addiu */
|
||||
+ if (v & 0x00008000)
|
||||
+ v += 0x10000;
|
||||
+
|
||||
+ tramp[0] = 0x3c190000 | (v >> 16); /* lui t9, hi16 */
|
||||
+ tramp[1] = 0x27390000 | (v & 0xffff); /* addiu t9, t9, lo16 */
|
||||
+ tramp[2] = 0x03200008; /* jr t9 */
|
||||
+ tramp[3] = 0x00000000; /* nop */
|
||||
+
|
||||
+ return (Elf_Addr) tramp;
|
||||
+}
|
||||
+
|
||||
+static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v)
|
||||
+{
|
||||
+ if (is_phys_addr(location))
|
||||
+ return add_plt_entry_to(&me->arch.phys_plt_offset,
|
||||
+ me->arch.phys_plt_tbl, v);
|
||||
+ else
|
||||
+ return add_plt_entry_to(&me->arch.virt_plt_offset,
|
||||
+ me->arch.virt_plt_tbl, v);
|
||||
+
|
||||
+}
|
||||
+
|
||||
static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v)
|
||||
{
|
||||
+ u32 ofs = *location & 0x03ffffff;
|
||||
+
|
||||
if (v % 4) {
|
||||
pr_err("module %s: dangerous R_MIPS_26 REL relocation\n",
|
||||
me->name);
|
||||
@@ -72,14 +308,17 @@ static int apply_r_mips_26_rel(struct mo
|
||||
}
|
||||
|
||||
if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
|
||||
- printk(KERN_ERR
|
||||
- "module %s: relocation overflow\n",
|
||||
- me->name);
|
||||
- return -ENOEXEC;
|
||||
+ v = add_plt_entry(me, location, v + (ofs << 2));
|
||||
+ if (!v) {
|
||||
+ printk(KERN_ERR
|
||||
+ "module %s: relocation overflow\n",
|
||||
+ me->name);
|
||||
+ return -ENOEXEC;
|
||||
+ }
|
||||
+ ofs = 0;
|
||||
}
|
||||
|
||||
- *location = (*location & ~0x03ffffff) |
|
||||
- ((*location + (v >> 2)) & 0x03ffffff);
|
||||
+ *location = (*location & ~0x03ffffff) | ((ofs + (v >> 2)) & 0x03ffffff);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -286,11 +525,32 @@ int module_finalize(const Elf_Ehdr *hdr,
|
||||
list_add(&me->arch.dbe_list, &dbe_list);
|
||||
spin_unlock_irq(&dbe_lock);
|
||||
}
|
||||
+
|
||||
+ /* Get rid of the fixup trampoline if we're running the module
|
||||
+ * from physically mapped address space */
|
||||
+ if (me->arch.phys_plt_offset == 0) {
|
||||
+ __module_free(me->arch.phys_plt_tbl);
|
||||
+ me->arch.phys_plt_tbl = NULL;
|
||||
+ }
|
||||
+ if (me->arch.virt_plt_offset == 0) {
|
||||
+ __module_free(me->arch.virt_plt_tbl);
|
||||
+ me->arch.virt_plt_tbl = NULL;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
void module_arch_cleanup(struct module *mod)
|
||||
{
|
||||
+ if (mod->arch.phys_plt_tbl) {
|
||||
+ __module_free(mod->arch.phys_plt_tbl);
|
||||
+ mod->arch.phys_plt_tbl = NULL;
|
||||
+ }
|
||||
+ if (mod->arch.virt_plt_tbl) {
|
||||
+ __module_free(mod->arch.virt_plt_tbl);
|
||||
+ mod->arch.virt_plt_tbl = NULL;
|
||||
+ }
|
||||
+
|
||||
spin_lock_irq(&dbe_lock);
|
||||
list_del(&mod->arch.dbe_list);
|
||||
spin_unlock_irq(&dbe_lock);
|
@ -1,83 +0,0 @@
|
||||
--- a/arch/mips/include/asm/string.h
|
||||
+++ b/arch/mips/include/asm/string.h
|
||||
@@ -133,11 +133,44 @@ strncmp(__const__ char *__cs, __const__
|
||||
|
||||
#define __HAVE_ARCH_MEMSET
|
||||
extern void *memset(void *__s, int __c, size_t __count);
|
||||
+#define memset(__s, __c, len) \
|
||||
+({ \
|
||||
+ size_t __len = (len); \
|
||||
+ void *__ret; \
|
||||
+ if (__builtin_constant_p(len) && __len >= 64) \
|
||||
+ __ret = memset((__s), (__c), __len); \
|
||||
+ else \
|
||||
+ __ret = __builtin_memset((__s), (__c), __len); \
|
||||
+ __ret; \
|
||||
+})
|
||||
|
||||
#define __HAVE_ARCH_MEMCPY
|
||||
extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
|
||||
+#define memcpy(dst, src, len) \
|
||||
+({ \
|
||||
+ size_t __len = (len); \
|
||||
+ void *__ret; \
|
||||
+ if (__builtin_constant_p(len) && __len >= 64) \
|
||||
+ __ret = memcpy((dst), (src), __len); \
|
||||
+ else \
|
||||
+ __ret = __builtin_memcpy((dst), (src), __len); \
|
||||
+ __ret; \
|
||||
+})
|
||||
|
||||
#define __HAVE_ARCH_MEMMOVE
|
||||
extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
|
||||
+#define memmove(dst, src, len) \
|
||||
+({ \
|
||||
+ size_t __len = (len); \
|
||||
+ void *__ret; \
|
||||
+ if (__builtin_constant_p(len) && __len >= 64) \
|
||||
+ __ret = memmove((dst), (src), __len); \
|
||||
+ else \
|
||||
+ __ret = __builtin_memmove((dst), (src), __len); \
|
||||
+ __ret; \
|
||||
+})
|
||||
+
|
||||
+#define __HAVE_ARCH_MEMCMP
|
||||
+#define memcmp(src1, src2, len) __builtin_memcmp((src1), (src2), (len))
|
||||
|
||||
#endif /* _ASM_STRING_H */
|
||||
--- a/arch/mips/lib/Makefile
|
||||
+++ b/arch/mips/lib/Makefile
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
lib-y += bitops.o csum_partial.o delay.o memcpy.o memset.o \
|
||||
mips-atomic.o strlen_user.o strncpy_user.o \
|
||||
- strnlen_user.o uncached.o
|
||||
+ strnlen_user.o uncached.o memcmp.o
|
||||
|
||||
obj-y += iomap.o
|
||||
obj-$(CONFIG_PCI) += iomap-pci.o
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/lib/memcmp.c
|
||||
@@ -0,0 +1,22 @@
|
||||
+/*
|
||||
+ * copied from linux/lib/string.c
|
||||
+ *
|
||||
+ * Copyright (C) 1991, 1992 Linus Torvalds
|
||||
+ */
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/string.h>
|
||||
+
|
||||
+#undef memcmp
|
||||
+int memcmp(const void *cs, const void *ct, size_t count)
|
||||
+{
|
||||
+ const unsigned char *su1, *su2;
|
||||
+ int res = 0;
|
||||
+
|
||||
+ for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
|
||||
+ if ((res = *su1 - *su2) != 0)
|
||||
+ break;
|
||||
+ return res;
|
||||
+}
|
||||
+EXPORT_SYMBOL(memcmp);
|
||||
+
|
@ -1,17 +0,0 @@
|
||||
--- a/arch/mips/kernel/cpu-probe.c
|
||||
+++ b/arch/mips/kernel/cpu-probe.c
|
||||
@@ -838,10 +838,13 @@ static inline void cpu_probe_mips(struct
|
||||
__cpu_name[cpu] = "MIPS 20Kc";
|
||||
break;
|
||||
case PRID_IMP_24K:
|
||||
- case PRID_IMP_24KE:
|
||||
c->cputype = CPU_24K;
|
||||
__cpu_name[cpu] = "MIPS 24Kc";
|
||||
break;
|
||||
+ case PRID_IMP_24KE:
|
||||
+ c->cputype = CPU_24K;
|
||||
+ __cpu_name[cpu] = "MIPS 24KEc";
|
||||
+ break;
|
||||
case PRID_IMP_25KF:
|
||||
c->cputype = CPU_25KF;
|
||||
__cpu_name[cpu] = "MIPS 25Kc";
|
@ -1,32 +0,0 @@
|
||||
--- a/arch/mips/mm/cache.c
|
||||
+++ b/arch/mips/mm/cache.c
|
||||
@@ -39,6 +39,7 @@ void (*__flush_kernel_vmap_range)(unsign
|
||||
void (*__invalidate_kernel_vmap_range)(unsigned long vaddr, int size);
|
||||
|
||||
EXPORT_SYMBOL_GPL(__flush_kernel_vmap_range);
|
||||
+EXPORT_SYMBOL(__flush_cache_all);
|
||||
|
||||
/* MIPS specific cache operations */
|
||||
void (*flush_cache_sigtramp)(unsigned long addr);
|
||||
--- a/fs/fuse/dev.c
|
||||
+++ b/fs/fuse/dev.c
|
||||
@@ -19,6 +19,9 @@
|
||||
#include <linux/pipe_fs_i.h>
|
||||
#include <linux/swap.h>
|
||||
#include <linux/splice.h>
|
||||
+#ifdef CONFIG_MIPS
|
||||
+#include <asm/cacheflush.h>
|
||||
+#endif
|
||||
|
||||
MODULE_ALIAS_MISCDEV(FUSE_MINOR);
|
||||
MODULE_ALIAS("devname:fuse");
|
||||
@@ -654,6 +657,9 @@ static int fuse_copy_fill(struct fuse_co
|
||||
static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size)
|
||||
{
|
||||
unsigned ncpy = min(*size, cs->len);
|
||||
+#ifdef CONFIG_MIPS
|
||||
+ __flush_cache_all();
|
||||
+#endif
|
||||
if (val) {
|
||||
if (cs->write)
|
||||
memcpy(cs->buf, *val, ncpy);
|
@ -1,13 +0,0 @@
|
||||
--- a/arch/arm/kernel/module.c
|
||||
+++ b/arch/arm/kernel/module.c
|
||||
@@ -81,6 +81,10 @@ apply_relocate(Elf32_Shdr *sechdrs, cons
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
+ if ((IS_ERR_VALUE(sym->st_value) || !sym->st_value) &&
|
||||
+ ELF_ST_BIND(sym->st_info) == STB_WEAK)
|
||||
+ continue;
|
||||
+
|
||||
loc = dstsec->sh_addr + rel->r_offset;
|
||||
|
||||
switch (ELF32_R_TYPE(rel->r_info)) {
|
@ -1,31 +0,0 @@
|
||||
Upstream doesn't optimize the kernel and bootwrappers for ppc44x because
|
||||
they still want to support gcc 3.3 -- well, we don't.
|
||||
|
||||
--- a/arch/powerpc/Makefile
|
||||
+++ b/arch/powerpc/Makefile
|
||||
@@ -119,7 +119,8 @@ ifeq ($(CONFIG_FUNCTION_TRACER),y)
|
||||
KBUILD_CFLAGS += -mno-sched-epilog
|
||||
endif
|
||||
|
||||
-cpu-as-$(CONFIG_4xx) += -Wa,-m405
|
||||
+cpu-as-$(CONFIG_40x) += -Wa,-m405
|
||||
+cpu-as-$(CONFIG_44x) += -Wa,-m440
|
||||
cpu-as-$(CONFIG_ALTIVEC) += -Wa,-maltivec
|
||||
cpu-as-$(CONFIG_E500) += -Wa,-me500
|
||||
cpu-as-$(CONFIG_E200) += -Wa,-me200
|
||||
--- a/arch/powerpc/boot/Makefile
|
||||
+++ b/arch/powerpc/boot/Makefile
|
||||
@@ -38,10 +38,10 @@ BOOTCFLAGS += -I$(obj) -I$(srctree)/$(ob
|
||||
DTC_FLAGS ?= -p 1024
|
||||
|
||||
$(obj)/4xx.o: BOOTCFLAGS += -mcpu=405
|
||||
-$(obj)/ebony.o: BOOTCFLAGS += -mcpu=405
|
||||
+$(obj)/ebony.o: BOOTCFLAGS += -mcpu=440
|
||||
$(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405
|
||||
-$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405
|
||||
-$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405
|
||||
+$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440
|
||||
+$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440
|
||||
$(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
|
||||
$(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
|
||||
$(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
|
@ -1,10 +0,0 @@
|
||||
--- a/arch/powerpc/Makefile
|
||||
+++ b/arch/powerpc/Makefile
|
||||
@@ -86,7 +86,6 @@ CPP = $(CC) -E $(KBUILD_CFLAGS)
|
||||
|
||||
CHECKFLAGS += -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__
|
||||
|
||||
-KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
|
||||
|
||||
# No AltiVec or VSX instructions when building kernel
|
||||
KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
|
@ -1,10 +0,0 @@
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
+#include <linux/module.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/spinlock_types.h>
|
||||
#include <linux/random.h>
|
@ -1,616 +0,0 @@
|
||||
From eee16330c9de9adf7880cce9f1d32e13f89706bb Mon Sep 17 00:00:00 2001
|
||||
From: Wu Zhangjin <wuzhangjin@gmail.com>
|
||||
Date: Tue, 11 Jan 2011 13:16:47 +0000
|
||||
Subject: MIPS: Add crash and kdump support
|
||||
|
||||
From: http://patchwork.linux-mips.org/patch/1025/
|
||||
|
||||
Hello folks,
|
||||
|
||||
Please find here MIPS crash and kdump patches.
|
||||
This is patch set of 3 patches:
|
||||
1. generic MIPS changes (kernel);
|
||||
2. MIPS Cavium Octeon board kexec/kdump code (kernel);
|
||||
3. Kexec user space MIPS changes.
|
||||
|
||||
Patches were tested on the latest linux-mips@ git kernel and the latest
|
||||
kexec-tools git on Cavium Octeon 50xx board.
|
||||
|
||||
I also made the same code working on RMI XLR/XLS boards for both
|
||||
mips32 and mips64 kernels.
|
||||
|
||||
Best regards,
|
||||
Maxim Uvarov.
|
||||
|
||||
------
|
||||
[ Zhangjin: Several trivial building failure has been fixed.
|
||||
|
||||
Note: the 2nd patch can not be cleanly applied, but may be a good
|
||||
reference for the other board development:
|
||||
|
||||
+ MIPS Cavium Octeon board kexec,kdump support
|
||||
http://patchwork.linux-mips.org/patch/1026/
|
||||
|
||||
And the 3rd patch has already been merged into the mainline kexec-tools:
|
||||
|
||||
+ some kexec MIPS improvements
|
||||
http://patchwork.linux-mips.org/patch/1027/
|
||||
|
||||
kexec-tools is available here:
|
||||
|
||||
+ http://horms.net/projects/kexec/
|
||||
git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
|
||||
]
|
||||
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
|
||||
---
|
||||
(limited to 'arch/mips/kernel')
|
||||
|
||||
--- a/arch/mips/kernel/Makefile
|
||||
+++ b/arch/mips/kernel/Makefile
|
||||
@@ -80,7 +80,8 @@ obj-$(CONFIG_I8253) += i8253.o
|
||||
|
||||
obj-$(CONFIG_GPIO_TXX9) += gpio_txx9.o
|
||||
|
||||
-obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
|
||||
+obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o
|
||||
+obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
|
||||
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
|
||||
obj-$(CONFIG_SPINLOCK_TEST) += spinlock_test.o
|
||||
obj-$(CONFIG_MIPS_MACHINE) += mips_machine.o
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/kernel/crash.c
|
||||
@@ -0,0 +1,75 @@
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/smp.h>
|
||||
+#include <linux/reboot.h>
|
||||
+#include <linux/kexec.h>
|
||||
+#include <linux/bootmem.h>
|
||||
+#include <linux/crash_dump.h>
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/irq.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/sched.h>
|
||||
+
|
||||
+#ifdef CONFIG_CRASH_DUMP
|
||||
+unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
|
||||
+#endif
|
||||
+
|
||||
+/* This keeps a track of which one is crashing cpu. */
|
||||
+int crashing_cpu = -1;
|
||||
+static cpumask_t cpus_in_crash = CPU_MASK_NONE;
|
||||
+
|
||||
+#ifdef CONFIG_SMP
|
||||
+void crash_shutdown_secondary(void *ignore)
|
||||
+{
|
||||
+ struct pt_regs *regs;
|
||||
+ int cpu = smp_processor_id();
|
||||
+
|
||||
+ regs = task_pt_regs(current);
|
||||
+
|
||||
+ if (!cpu_online(cpu))
|
||||
+ return;
|
||||
+
|
||||
+ local_irq_disable();
|
||||
+ if (!cpu_isset(cpu, cpus_in_crash))
|
||||
+ crash_save_cpu(regs, cpu);
|
||||
+ cpu_set(cpu, cpus_in_crash);
|
||||
+
|
||||
+ while (!atomic_read(&kexec_ready_to_reboot))
|
||||
+ cpu_relax();
|
||||
+ relocated_kexec_smp_wait(NULL);
|
||||
+ /* NOTREACHED */
|
||||
+}
|
||||
+
|
||||
+static void crash_kexec_prepare_cpus(void)
|
||||
+{
|
||||
+ unsigned int msecs;
|
||||
+
|
||||
+ unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */
|
||||
+
|
||||
+ dump_send_ipi(crash_shutdown_secondary);
|
||||
+ smp_wmb();
|
||||
+
|
||||
+ /*
|
||||
+ * The crash CPU sends an IPI and wait for other CPUs to
|
||||
+ * respond. Delay of at least 10 seconds.
|
||||
+ */
|
||||
+ printk(KERN_EMERG "Sending IPI to other cpus...\n");
|
||||
+ msecs = 10000;
|
||||
+ while ((cpus_weight(cpus_in_crash) < ncpus) && (--msecs > 0)) {
|
||||
+ cpu_relax();
|
||||
+ mdelay(1);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+#else
|
||||
+static void crash_kexec_prepare_cpus(void) {}
|
||||
+#endif
|
||||
+
|
||||
+void default_machine_crash_shutdown(struct pt_regs *regs)
|
||||
+{
|
||||
+ local_irq_disable();
|
||||
+ crashing_cpu = smp_processor_id();
|
||||
+ crash_save_cpu(regs, crashing_cpu);
|
||||
+ crash_kexec_prepare_cpus();
|
||||
+ cpu_set(crashing_cpu, cpus_in_crash);
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/kernel/crash_dump.c
|
||||
@@ -0,0 +1,86 @@
|
||||
+#include <linux/highmem.h>
|
||||
+#include <linux/bootmem.h>
|
||||
+#include <linux/crash_dump.h>
|
||||
+#include <asm/uaccess.h>
|
||||
+
|
||||
+#ifdef CONFIG_PROC_VMCORE
|
||||
+static int __init parse_elfcorehdr(char *p)
|
||||
+{
|
||||
+ if (p)
|
||||
+ elfcorehdr_addr = memparse(p, &p);
|
||||
+ return 1;
|
||||
+}
|
||||
+__setup("elfcorehdr=", parse_elfcorehdr);
|
||||
+#endif
|
||||
+
|
||||
+static int __init parse_savemaxmem(char *p)
|
||||
+{
|
||||
+ if (p)
|
||||
+ saved_max_pfn = (memparse(p, &p) >> PAGE_SHIFT) - 1;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+__setup("savemaxmem=", parse_savemaxmem);
|
||||
+
|
||||
+
|
||||
+static void *kdump_buf_page;
|
||||
+
|
||||
+/**
|
||||
+ * copy_oldmem_page - copy one page from "oldmem"
|
||||
+ * @pfn: page frame number to be copied
|
||||
+ * @buf: target memory address for the copy; this can be in kernel address
|
||||
+ * space or user address space (see @userbuf)
|
||||
+ * @csize: number of bytes to copy
|
||||
+ * @offset: offset in bytes into the page (based on pfn) to begin the copy
|
||||
+ * @userbuf: if set, @buf is in user address space, use copy_to_user(),
|
||||
+ * otherwise @buf is in kernel address space, use memcpy().
|
||||
+ *
|
||||
+ * Copy a page from "oldmem". For this page, there is no pte mapped
|
||||
+ * in the current kernel.
|
||||
+ *
|
||||
+ * Calling copy_to_user() in atomic context is not desirable. Hence first
|
||||
+ * copying the data to a pre-allocated kernel page and then copying to user
|
||||
+ * space in non-atomic context.
|
||||
+ */
|
||||
+ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
|
||||
+ size_t csize, unsigned long offset, int userbuf)
|
||||
+{
|
||||
+ void *vaddr;
|
||||
+
|
||||
+ if (!csize)
|
||||
+ return 0;
|
||||
+
|
||||
+ vaddr = kmap_atomic_pfn(pfn, KM_PTE0);
|
||||
+
|
||||
+ if (!userbuf) {
|
||||
+ memcpy(buf, (vaddr + offset), csize);
|
||||
+ kunmap_atomic(vaddr, KM_PTE0);
|
||||
+ } else {
|
||||
+ if (!kdump_buf_page) {
|
||||
+ printk(KERN_WARNING "Kdump: Kdump buffer page not"
|
||||
+ " allocated\n");
|
||||
+ return -EFAULT;
|
||||
+ }
|
||||
+ copy_page(kdump_buf_page, vaddr);
|
||||
+ kunmap_atomic(vaddr, KM_PTE0);
|
||||
+ if (copy_to_user(buf, (kdump_buf_page + offset), csize))
|
||||
+ return -EFAULT;
|
||||
+ }
|
||||
+
|
||||
+ return csize;
|
||||
+}
|
||||
+
|
||||
+static int __init kdump_buf_page_init(void)
|
||||
+{
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ kdump_buf_page = kmalloc(PAGE_SIZE, GFP_KERNEL);
|
||||
+ if (!kdump_buf_page) {
|
||||
+ printk(KERN_WARNING "Kdump: Failed to allocate kdump buffer"
|
||||
+ " page\n");
|
||||
+ ret = -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+arch_initcall(kdump_buf_page_init);
|
||||
--- a/arch/mips/kernel/machine_kexec.c
|
||||
+++ b/arch/mips/kernel/machine_kexec.c
|
||||
@@ -19,9 +19,19 @@ extern const size_t relocate_new_kernel_
|
||||
extern unsigned long kexec_start_address;
|
||||
extern unsigned long kexec_indirection_page;
|
||||
|
||||
+int (*_machine_kexec_prepare)(struct kimage *) = NULL;
|
||||
+void (*_machine_kexec_shutdown)(void) = NULL;
|
||||
+void (*_machine_crash_shutdown)(struct pt_regs *regs) = NULL;
|
||||
+#ifdef CONFIG_SMP
|
||||
+void (*relocated_kexec_smp_wait) (void *);
|
||||
+atomic_t kexec_ready_to_reboot = ATOMIC_INIT(0);
|
||||
+#endif
|
||||
+
|
||||
int
|
||||
machine_kexec_prepare(struct kimage *kimage)
|
||||
{
|
||||
+ if (_machine_kexec_prepare)
|
||||
+ return _machine_kexec_prepare(kimage);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -33,11 +43,17 @@ machine_kexec_cleanup(struct kimage *kim
|
||||
void
|
||||
machine_shutdown(void)
|
||||
{
|
||||
+ if (_machine_kexec_shutdown)
|
||||
+ _machine_kexec_shutdown();
|
||||
}
|
||||
|
||||
void
|
||||
machine_crash_shutdown(struct pt_regs *regs)
|
||||
{
|
||||
+ if (_machine_crash_shutdown)
|
||||
+ _machine_crash_shutdown(regs);
|
||||
+ else
|
||||
+ default_machine_crash_shutdown(regs);
|
||||
}
|
||||
|
||||
typedef void (*noretfun_t)(void) __attribute__((noreturn));
|
||||
@@ -52,7 +68,9 @@ machine_kexec(struct kimage *image)
|
||||
reboot_code_buffer =
|
||||
(unsigned long)page_address(image->control_code_page);
|
||||
|
||||
- kexec_start_address = (unsigned long) phys_to_virt(image->start);
|
||||
+ kexec_start_address =
|
||||
+ (unsigned long) phys_to_virt(image->start);
|
||||
+
|
||||
kexec_indirection_page =
|
||||
(unsigned long) phys_to_virt(image->head & PAGE_MASK);
|
||||
|
||||
@@ -63,7 +81,7 @@ machine_kexec(struct kimage *image)
|
||||
* The generic kexec code builds a page list with physical
|
||||
* addresses. they are directly accessible through KSEG0 (or
|
||||
* CKSEG0 or XPHYS if on 64bit system), hence the
|
||||
- * pys_to_virt() call.
|
||||
+ * phys_to_virt() call.
|
||||
*/
|
||||
for (ptr = &image->head; (entry = *ptr) && !(entry &IND_DONE);
|
||||
ptr = (entry & IND_INDIRECTION) ?
|
||||
@@ -81,5 +99,13 @@ machine_kexec(struct kimage *image)
|
||||
printk("Will call new kernel at %08lx\n", image->start);
|
||||
printk("Bye ...\n");
|
||||
__flush_cache_all();
|
||||
+#ifdef CONFIG_SMP
|
||||
+ /* All secondary cpus now may jump to kexec_wait cycle */
|
||||
+ relocated_kexec_smp_wait = reboot_code_buffer +
|
||||
+ (void *)(kexec_smp_wait - relocate_new_kernel);
|
||||
+ smp_wmb();
|
||||
+ atomic_set(&kexec_ready_to_reboot, 1);
|
||||
+#endif
|
||||
((noretfun_t) reboot_code_buffer)();
|
||||
}
|
||||
+
|
||||
--- a/arch/mips/kernel/relocate_kernel.S
|
||||
+++ b/arch/mips/kernel/relocate_kernel.S
|
||||
@@ -15,6 +15,11 @@
|
||||
#include <asm/addrspace.h>
|
||||
|
||||
LEAF(relocate_new_kernel)
|
||||
+ PTR_L a0, arg0
|
||||
+ PTR_L a1, arg1
|
||||
+ PTR_L a2, arg2
|
||||
+ PTR_L a3, arg3
|
||||
+
|
||||
PTR_L s0, kexec_indirection_page
|
||||
PTR_L s1, kexec_start_address
|
||||
|
||||
@@ -26,7 +31,6 @@ process_entry:
|
||||
and s3, s2, 0x1
|
||||
beq s3, zero, 1f
|
||||
and s4, s2, ~0x1 /* store destination addr in s4 */
|
||||
- move a0, s4
|
||||
b process_entry
|
||||
|
||||
1:
|
||||
@@ -60,23 +64,100 @@ copy_word:
|
||||
b process_entry
|
||||
|
||||
done:
|
||||
+#ifdef CONFIG_SMP
|
||||
+ /* kexec_flag reset is signal to other CPUs what kernel
|
||||
+ was moved to it's location. Note - we need relocated address
|
||||
+ of kexec_flag. */
|
||||
+
|
||||
+ bal 1f
|
||||
+ 1: move t1,ra;
|
||||
+ PTR_LA t2,1b
|
||||
+ PTR_LA t0,kexec_flag
|
||||
+ PTR_SUB t0,t0,t2;
|
||||
+ PTR_ADD t0,t1,t0;
|
||||
+ LONG_S zero,(t0)
|
||||
+#endif
|
||||
+
|
||||
+ sync
|
||||
/* jump to kexec_start_address */
|
||||
j s1
|
||||
END(relocate_new_kernel)
|
||||
|
||||
-kexec_start_address:
|
||||
- EXPORT(kexec_start_address)
|
||||
+#ifdef CONFIG_SMP
|
||||
+/*
|
||||
+ * Other CPUs should wait until code is relocated and
|
||||
+ * then start at entry (?) point.
|
||||
+ */
|
||||
+LEAF(kexec_smp_wait)
|
||||
+ PTR_L a0, s_arg0
|
||||
+ PTR_L a1, s_arg1
|
||||
+ PTR_L a2, s_arg2
|
||||
+ PTR_L a3, s_arg3
|
||||
+ PTR_L s1, kexec_start_address
|
||||
+
|
||||
+ /* Non-relocated address works for args and kexec_start_address ( old
|
||||
+ * kernel is not overwritten). But we need relocated address of
|
||||
+ * kexec_flag.
|
||||
+ */
|
||||
+
|
||||
+ bal 1f
|
||||
+1: move t1,ra;
|
||||
+ PTR_LA t2,1b
|
||||
+ PTR_LA t0,kexec_flag
|
||||
+ PTR_SUB t0,t0,t2;
|
||||
+ PTR_ADD t0,t1,t0;
|
||||
+
|
||||
+1: LONG_L s0, (t0)
|
||||
+ bne s0, zero,1b
|
||||
+
|
||||
+ sync
|
||||
+ j s1
|
||||
+ END(kexec_smp_wait)
|
||||
+#endif
|
||||
+
|
||||
+#ifdef __mips64
|
||||
+ /* all PTR's must be aligned to 8 byte in 64-bit mode */
|
||||
+ .align 3
|
||||
+#endif
|
||||
+
|
||||
+/* All parameters to new kernel are passed in registers a0-a3.
|
||||
+ * kexec_args[0..3] are uses to prepare register values.
|
||||
+ */
|
||||
+
|
||||
+EXPORT(kexec_args)
|
||||
+arg0: PTR 0x0
|
||||
+arg1: PTR 0x0
|
||||
+arg2: PTR 0x0
|
||||
+arg3: PTR 0x0
|
||||
+ .size kexec_args,PTRSIZE*4
|
||||
+
|
||||
+#ifdef CONFIG_SMP
|
||||
+/*
|
||||
+ * Secondary CPUs may have different kernel parameters in
|
||||
+ * their registers a0-a3. secondary_kexec_args[0..3] are used
|
||||
+ * to prepare register values.
|
||||
+ */
|
||||
+EXPORT(secondary_kexec_args)
|
||||
+s_arg0: PTR 0x0
|
||||
+s_arg1: PTR 0x0
|
||||
+s_arg2: PTR 0x0
|
||||
+s_arg3: PTR 0x0
|
||||
+ .size secondary_kexec_args,PTRSIZE*4
|
||||
+kexec_flag:
|
||||
+ LONG 0x1
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+EXPORT(kexec_start_address)
|
||||
PTR 0x0
|
||||
.size kexec_start_address, PTRSIZE
|
||||
|
||||
-kexec_indirection_page:
|
||||
- EXPORT(kexec_indirection_page)
|
||||
+EXPORT(kexec_indirection_page)
|
||||
PTR 0
|
||||
.size kexec_indirection_page, PTRSIZE
|
||||
|
||||
relocate_new_kernel_end:
|
||||
|
||||
-relocate_new_kernel_size:
|
||||
- EXPORT(relocate_new_kernel_size)
|
||||
+EXPORT(relocate_new_kernel_size)
|
||||
PTR relocate_new_kernel_end - relocate_new_kernel
|
||||
.size relocate_new_kernel_size, PTRSIZE
|
||||
--- a/arch/mips/kernel/setup.c
|
||||
+++ b/arch/mips/kernel/setup.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <linux/console.h>
|
||||
#include <linux/pfn.h>
|
||||
#include <linux/debugfs.h>
|
||||
+#include <linux/kexec.h>
|
||||
|
||||
#include <asm/addrspace.h>
|
||||
#include <asm/bootinfo.h>
|
||||
@@ -536,12 +537,62 @@ static void __init arch_mem_init(char **
|
||||
}
|
||||
|
||||
bootmem_init();
|
||||
+#ifdef CONFIG_KEXEC
|
||||
+ if (crashk_res.start != crashk_res.end)
|
||||
+ reserve_bootmem(crashk_res.start,
|
||||
+ crashk_res.end - crashk_res.start + 1,
|
||||
+ BOOTMEM_DEFAULT);
|
||||
+#endif
|
||||
device_tree_init();
|
||||
sparse_init();
|
||||
plat_swiotlb_setup();
|
||||
paging_init();
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_KEXEC
|
||||
+static inline unsigned long long get_total_mem(void)
|
||||
+{
|
||||
+ unsigned long long total;
|
||||
+ total = max_pfn - min_low_pfn;
|
||||
+ return total << PAGE_SHIFT;
|
||||
+}
|
||||
+
|
||||
+static void __init mips_parse_crashkernel(void)
|
||||
+{
|
||||
+ unsigned long long total_mem;
|
||||
+ unsigned long long crash_size, crash_base;
|
||||
+ int ret;
|
||||
+
|
||||
+ total_mem = get_total_mem();
|
||||
+ ret = parse_crashkernel(boot_command_line, total_mem,
|
||||
+ &crash_size, &crash_base);
|
||||
+ if (ret != 0 || crash_size <= 0)
|
||||
+ return;
|
||||
+
|
||||
+ crashk_res.start = crash_base;
|
||||
+ crashk_res.end = crash_base + crash_size - 1;
|
||||
+}
|
||||
+static void __init request_crashkernel(struct resource *res)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = request_resource(res, &crashk_res);
|
||||
+ if (!ret)
|
||||
+ printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
|
||||
+ "for crashkernel\n",
|
||||
+ (unsigned long)((crashk_res.end -
|
||||
+ crashk_res.start + 1) >> 20),
|
||||
+ (unsigned long)(crashk_res.start >> 20));
|
||||
+}
|
||||
+#else
|
||||
+static void __init mips_parse_crashkernel(void)
|
||||
+{
|
||||
+}
|
||||
+static void __init request_crashkernel(struct resource *res)
|
||||
+{
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static void __init resource_init(void)
|
||||
{
|
||||
int i;
|
||||
@@ -557,6 +608,8 @@ static void __init resource_init(void)
|
||||
/*
|
||||
* Request address space for all standard RAM.
|
||||
*/
|
||||
+ mips_parse_crashkernel();
|
||||
+
|
||||
for (i = 0; i < boot_mem_map.nr_map; i++) {
|
||||
struct resource *res;
|
||||
unsigned long start, end;
|
||||
@@ -593,6 +646,7 @@ static void __init resource_init(void)
|
||||
*/
|
||||
request_resource(res, &code_resource);
|
||||
request_resource(res, &data_resource);
|
||||
+ request_crashkernel(res);
|
||||
}
|
||||
}
|
||||
|
||||
--- a/arch/mips/kernel/smp.c
|
||||
+++ b/arch/mips/kernel/smp.c
|
||||
@@ -386,3 +386,21 @@ void flush_tlb_one(unsigned long vaddr)
|
||||
|
||||
EXPORT_SYMBOL(flush_tlb_page);
|
||||
EXPORT_SYMBOL(flush_tlb_one);
|
||||
+
|
||||
+#if defined(CONFIG_KEXEC)
|
||||
+void (*dump_ipi_function_ptr)(void *) = NULL;
|
||||
+void dump_send_ipi(void (*dump_ipi_callback)(void *))
|
||||
+{
|
||||
+ int i;
|
||||
+ int cpu = smp_processor_id();
|
||||
+
|
||||
+ dump_ipi_function_ptr = dump_ipi_callback;
|
||||
+ smp_mb();
|
||||
+ for_each_online_cpu(i)
|
||||
+ if (i != cpu)
|
||||
+ core_send_ipi(i, SMP_DUMP);
|
||||
+
|
||||
+}
|
||||
+EXPORT_SYMBOL(dump_send_ipi);
|
||||
+#endif
|
||||
+
|
||||
--- a/arch/mips/include/asm/kexec.h
|
||||
+++ b/arch/mips/include/asm/kexec.h
|
||||
@@ -9,22 +9,45 @@
|
||||
#ifndef _MIPS_KEXEC
|
||||
# define _MIPS_KEXEC
|
||||
|
||||
+#include <asm/stacktrace.h>
|
||||
+
|
||||
+extern unsigned long long elfcorehdr_addr;
|
||||
+
|
||||
/* Maximum physical address we can use pages from */
|
||||
#define KEXEC_SOURCE_MEMORY_LIMIT (0x20000000)
|
||||
/* Maximum address we can reach in physical address mode */
|
||||
#define KEXEC_DESTINATION_MEMORY_LIMIT (0x20000000)
|
||||
/* Maximum address we can use for the control code buffer */
|
||||
#define KEXEC_CONTROL_MEMORY_LIMIT (0x20000000)
|
||||
-
|
||||
-#define KEXEC_CONTROL_PAGE_SIZE 4096
|
||||
+/* Reserve 3*4096 bytes for board-specific info */
|
||||
+#define KEXEC_CONTROL_PAGE_SIZE (4096 + 3*4096)
|
||||
|
||||
/* The native architecture */
|
||||
#define KEXEC_ARCH KEXEC_ARCH_MIPS
|
||||
+#define MAX_NOTE_BYTES 1024
|
||||
|
||||
static inline void crash_setup_regs(struct pt_regs *newregs,
|
||||
- struct pt_regs *oldregs)
|
||||
+ struct pt_regs *oldregs)
|
||||
{
|
||||
- /* Dummy implementation for now */
|
||||
+ if (oldregs)
|
||||
+ memcpy(newregs, oldregs, sizeof(*newregs));
|
||||
+ else
|
||||
+ prepare_frametrace(newregs);
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_KEXEC
|
||||
+struct kimage;
|
||||
+extern unsigned long kexec_args[4];
|
||||
+extern int (*_machine_kexec_prepare)(struct kimage *);
|
||||
+extern void (*_machine_kexec_shutdown)(void);
|
||||
+extern void (*_machine_crash_shutdown)(struct pt_regs *regs);
|
||||
+extern void default_machine_crash_shutdown(struct pt_regs *regs);
|
||||
+#ifdef CONFIG_SMP
|
||||
+extern const unsigned char kexec_smp_wait[];
|
||||
+extern unsigned long secondary_kexec_args[4];
|
||||
+extern void (*relocated_kexec_smp_wait) (void *);
|
||||
+extern atomic_t kexec_ready_to_reboot;
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
#endif /* !_MIPS_KEXEC */
|
||||
--- a/arch/mips/include/asm/smp.h
|
||||
+++ b/arch/mips/include/asm/smp.h
|
||||
@@ -40,6 +40,8 @@ extern int __cpu_logical_map[NR_CPUS];
|
||||
#define SMP_CALL_FUNCTION 0x2
|
||||
/* Octeon - Tell another core to flush its icache */
|
||||
#define SMP_ICACHE_FLUSH 0x4
|
||||
+/* Used by kexec crashdump to save all cpu's state */
|
||||
+#define SMP_DUMP 0x8
|
||||
|
||||
extern volatile cpumask_t cpu_callin_map;
|
||||
|
||||
@@ -91,4 +93,9 @@ static inline void arch_send_call_functi
|
||||
mp_ops->send_ipi_mask(mask, SMP_CALL_FUNCTION);
|
||||
}
|
||||
|
||||
+extern void core_send_ipi(int cpu, unsigned int action);
|
||||
+#if defined(CONFIG_KEXEC)
|
||||
+extern void (*dump_ipi_function_ptr)(void *);
|
||||
+void dump_send_ipi(void (*dump_ipi_callback)(void *));
|
||||
+#endif
|
||||
#endif /* __ASM_SMP_H */
|
@ -1,157 +0,0 @@
|
||||
From 03cd81fbca6b91317ec1a7b3b3c09fb8d08f83a6 Mon Sep 17 00:00:00 2001
|
||||
From: Wu Zhangjin <wuzhangjin@gmail.com>
|
||||
Date: Tue, 11 Jan 2011 18:42:08 +0000
|
||||
Subject: MIPS: Kexec: Enhance the support
|
||||
|
||||
Changes:
|
||||
o Print more information in machine_kexec() for debugging
|
||||
E.g. with this information, the kexec_start_address has been found
|
||||
it was wrong with 64bit kernel / o32 kexec-tools. Which must be
|
||||
fixed later.
|
||||
o Link relocate_kernel.S to a section for future extension
|
||||
This allows more functions can be added for the kexec relocation
|
||||
part even written in C. to add code into that section, you just need
|
||||
to mark your function or data with __kexec or
|
||||
__attribute__((__section__(".__kexec.relocate")))
|
||||
|
||||
TODO:
|
||||
|
||||
1. Make 64bit kernel / o32|n32|64 kexec-tools works
|
||||
|
||||
Fix the user-space kexec-tools, seems the tool only work for 32bit
|
||||
machine. So, we need to add 64bit support for it. The address of the
|
||||
entry point(kexec_start_address) is wrong and make the "kexec -e" fail.
|
||||
the real entry point must be read from the new kernel image by the
|
||||
user-space kexec-tools, otherwise, it will not work. The above 64bit
|
||||
support tested is 64bit kernel with o32 user-space kexec-tools. The root
|
||||
cause may be the different definition of virt_to_phys() and
|
||||
phys_to_virt() in the kexec-tools and kernel space for 64bit system /
|
||||
o32 kernel.
|
||||
|
||||
Ref: http://www.linux-mips.org/archives/linux-mips/2009-08/msg00149.html
|
||||
|
||||
2. Pass the arguments from kexec-tools to the new kernel image
|
||||
|
||||
Please refer to: "MIPS: Loongson: Kexec: Pass parameters to new kernel"
|
||||
|
||||
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
|
||||
---
|
||||
--- a/arch/mips/include/asm/kexec.h
|
||||
+++ b/arch/mips/include/asm/kexec.h
|
||||
@@ -36,6 +36,16 @@ static inline void crash_setup_regs(stru
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KEXEC
|
||||
+
|
||||
+#define __kexec __attribute__((__section__(".__kexec.relocate")))
|
||||
+
|
||||
+/* The linker tells us where the relocate_new_kernel part is. */
|
||||
+extern const unsigned char __start___kexec_relocate;
|
||||
+extern const unsigned char __end___kexec_relocate;
|
||||
+
|
||||
+extern unsigned long kexec_start_address;
|
||||
+extern unsigned long kexec_indirection_page;
|
||||
+
|
||||
struct kimage;
|
||||
extern unsigned long kexec_args[4];
|
||||
extern int (*_machine_kexec_prepare)(struct kimage *);
|
||||
--- a/arch/mips/kernel/machine_kexec.c
|
||||
+++ b/arch/mips/kernel/machine_kexec.c
|
||||
@@ -14,10 +14,6 @@
|
||||
#include <asm/page.h>
|
||||
|
||||
extern const unsigned char relocate_new_kernel[];
|
||||
-extern const size_t relocate_new_kernel_size;
|
||||
-
|
||||
-extern unsigned long kexec_start_address;
|
||||
-extern unsigned long kexec_indirection_page;
|
||||
|
||||
int (*_machine_kexec_prepare)(struct kimage *) = NULL;
|
||||
void (*_machine_kexec_shutdown)(void) = NULL;
|
||||
@@ -61,21 +57,34 @@ typedef void (*noretfun_t)(void) __attri
|
||||
void
|
||||
machine_kexec(struct kimage *image)
|
||||
{
|
||||
+ unsigned long kexec_relocate_size;
|
||||
unsigned long reboot_code_buffer;
|
||||
unsigned long entry;
|
||||
unsigned long *ptr;
|
||||
|
||||
+ kexec_relocate_size = (unsigned long)(&__end___kexec_relocate) -
|
||||
+ (unsigned long)(&__start___kexec_relocate);
|
||||
+ pr_info("kexec_relocate_size = %lu\n", kexec_relocate_size);
|
||||
+
|
||||
reboot_code_buffer =
|
||||
(unsigned long)page_address(image->control_code_page);
|
||||
+ pr_info("reboot_code_buffer = %p\n", (void *)reboot_code_buffer);
|
||||
|
||||
kexec_start_address =
|
||||
(unsigned long) phys_to_virt(image->start);
|
||||
+ pr_info("kexec_start_address(entry point of new kernel) = %p\n",
|
||||
+ (void *)kexec_start_address);
|
||||
|
||||
kexec_indirection_page =
|
||||
(unsigned long) phys_to_virt(image->head & PAGE_MASK);
|
||||
+ pr_info("kexec_indirection_page = %p\n",
|
||||
+ (void *)kexec_indirection_page);
|
||||
|
||||
- memcpy((void*)reboot_code_buffer, relocate_new_kernel,
|
||||
- relocate_new_kernel_size);
|
||||
+ memcpy((void *)reboot_code_buffer, &__start___kexec_relocate,
|
||||
+ kexec_relocate_size);
|
||||
+
|
||||
+ pr_info("Copy kexec_relocate section from %p to reboot_code_buffer: %p\n",
|
||||
+ &__start___kexec_relocate, (void *)reboot_code_buffer);
|
||||
|
||||
/*
|
||||
* The generic kexec code builds a page list with physical
|
||||
@@ -96,8 +105,8 @@ machine_kexec(struct kimage *image)
|
||||
*/
|
||||
local_irq_disable();
|
||||
|
||||
- printk("Will call new kernel at %08lx\n", image->start);
|
||||
- printk("Bye ...\n");
|
||||
+ pr_info("Will call new kernel at %p\n", (void *)kexec_start_address);
|
||||
+ pr_info("Bye ...\n");
|
||||
__flush_cache_all();
|
||||
#ifdef CONFIG_SMP
|
||||
/* All secondary cpus now may jump to kexec_wait cycle */
|
||||
@@ -108,4 +117,3 @@ machine_kexec(struct kimage *image)
|
||||
#endif
|
||||
((noretfun_t) reboot_code_buffer)();
|
||||
}
|
||||
-
|
||||
--- a/arch/mips/kernel/relocate_kernel.S
|
||||
+++ b/arch/mips/kernel/relocate_kernel.S
|
||||
@@ -14,6 +14,8 @@
|
||||
#include <asm/stackframe.h>
|
||||
#include <asm/addrspace.h>
|
||||
|
||||
+ .section .kexec.relocate, "ax"
|
||||
+
|
||||
LEAF(relocate_new_kernel)
|
||||
PTR_L a0, arg0
|
||||
PTR_L a1, arg1
|
||||
@@ -155,9 +157,3 @@ EXPORT(kexec_start_address)
|
||||
EXPORT(kexec_indirection_page)
|
||||
PTR 0
|
||||
.size kexec_indirection_page, PTRSIZE
|
||||
-
|
||||
-relocate_new_kernel_end:
|
||||
-
|
||||
-EXPORT(relocate_new_kernel_size)
|
||||
- PTR relocate_new_kernel_end - relocate_new_kernel
|
||||
- .size relocate_new_kernel_size, PTRSIZE
|
||||
--- a/arch/mips/kernel/vmlinux.lds.S
|
||||
+++ b/arch/mips/kernel/vmlinux.lds.S
|
||||
@@ -58,6 +58,10 @@ SECTIONS
|
||||
*(.text.*)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
+ __start___kexec_relocate = .;
|
||||
+ KEEP(*(.kexec.relocate))
|
||||
+ KEEP(*(.__kexec.relocate))
|
||||
+ __end___kexec_relocate = .;
|
||||
} :text = 0
|
||||
_etext = .; /* End of text section */
|
||||
|
@ -1,52 +0,0 @@
|
||||
From 49d07a29653b1f2c6ae273b3d8fe93d981f43004 Mon Sep 17 00:00:00 2001
|
||||
From: Wu Zhangjin <wuzhangjin@gmail.com>
|
||||
Date: Wed, 12 Jan 2011 20:59:32 +0000
|
||||
Subject: MIPS: Kexec: Init the arguments for the new kernel image
|
||||
|
||||
Whenever the kexec-tools pass the command lines to the new kernel image,
|
||||
init the arguments as the ones for the 1st kernel image. This fixed the
|
||||
booting failure of Kexec on YeeLoong.
|
||||
|
||||
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
|
||||
---
|
||||
--- a/arch/mips/kernel/machine_kexec.c
|
||||
+++ b/arch/mips/kernel/machine_kexec.c
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
+#include <asm/bootinfo.h>
|
||||
#include <asm/cacheflush.h>
|
||||
#include <asm/page.h>
|
||||
|
||||
@@ -23,9 +24,30 @@ void (*relocated_kexec_smp_wait) (void *
|
||||
atomic_t kexec_ready_to_reboot = ATOMIC_INIT(0);
|
||||
#endif
|
||||
|
||||
+static void machine_kexec_init_args(void)
|
||||
+{
|
||||
+ kexec_args[0] = fw_arg0;
|
||||
+ kexec_args[1] = fw_arg1;
|
||||
+ kexec_args[2] = fw_arg2;
|
||||
+ kexec_args[3] = fw_arg3;
|
||||
+
|
||||
+ pr_info("kexec_args[0] (argc): %lu\n", kexec_args[0]);
|
||||
+ pr_info("kexec_args[1] (argv): %p\n", (void *)kexec_args[1]);
|
||||
+ pr_info("kexec_args[2] (env ): %p\n", (void *)kexec_args[2]);
|
||||
+ pr_info("kexec_args[3] (desc): %p\n", (void *)kexec_args[3]);
|
||||
+}
|
||||
+
|
||||
int
|
||||
machine_kexec_prepare(struct kimage *kimage)
|
||||
{
|
||||
+ /*
|
||||
+ * Whenever arguments passed from kexec-tools, Init the arguments as
|
||||
+ * the original ones to avoid booting failure.
|
||||
+ *
|
||||
+ * This can be overrided by _machine_kexec_prepare().
|
||||
+ */
|
||||
+ machine_kexec_init_args();
|
||||
+
|
||||
if (_machine_kexec_prepare)
|
||||
return _machine_kexec_prepare(kimage);
|
||||
return 0;
|
@ -1,88 +0,0 @@
|
||||
From 240c76841b26f1b09aaced33414ee1d08b6454cf Mon Sep 17 00:00:00 2001
|
||||
From: Wu Zhangjin <wuzhangjin@gmail.com>
|
||||
Date: Sat, 15 Jan 2011 12:46:03 +0000
|
||||
Subject: MIPS: Get kernel parameters from kexec-tools
|
||||
|
||||
Before, we simply use the command lines from the original bootloader,
|
||||
but it is not convenient. Now, we accept the kernel parameters from the
|
||||
--command-line or --append option of the kexec-tools. But If not
|
||||
--command-line or --apend option indicated, will fall back to use the
|
||||
ones from the original bootloader.
|
||||
|
||||
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
|
||||
---
|
||||
--- a/arch/mips/kernel/machine_kexec.c
|
||||
+++ b/arch/mips/kernel/machine_kexec.c
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <asm/bootinfo.h>
|
||||
#include <asm/cacheflush.h>
|
||||
#include <asm/page.h>
|
||||
+#include <asm/uaccess.h>
|
||||
|
||||
extern const unsigned char relocate_new_kernel[];
|
||||
|
||||
@@ -37,6 +38,56 @@ static void machine_kexec_init_args(void
|
||||
pr_info("kexec_args[3] (desc): %p\n", (void *)kexec_args[3]);
|
||||
}
|
||||
|
||||
+#define ARGV_MAX_ARGS (COMMAND_LINE_SIZE / 15)
|
||||
+
|
||||
+int machine_kexec_pass_args(struct kimage *image)
|
||||
+{
|
||||
+ int i, argc = 0;
|
||||
+ char *bootloader = "kexec";
|
||||
+ int *kexec_argv = (int *)kexec_args[1];
|
||||
+
|
||||
+ for (i = 0; i < image->nr_segments; i++) {
|
||||
+ if (!strncmp(bootloader, (char *)image->segment[i].buf,
|
||||
+ strlen(bootloader))) {
|
||||
+ /*
|
||||
+ * convert command line string to array
|
||||
+ * of parameters (as bootloader does).
|
||||
+ */
|
||||
+ /*
|
||||
+ * Note: we do treat the 1st string "kexec" as an
|
||||
+ * argument ;-) so, argc here is 1.
|
||||
+ */
|
||||
+ char *str = (char *)image->segment[i].buf;
|
||||
+ char *ptr = strchr(str, ' ');
|
||||
+ char *kbuf = (char *)kexec_argv[0];
|
||||
+ /* Whenever --command-line or --append used, "kexec" is copied */
|
||||
+ argc = 1;
|
||||
+ /* Parse the offset */
|
||||
+ while (ptr && (ARGV_MAX_ARGS > argc)) {
|
||||
+ *ptr = '\0';
|
||||
+ if (ptr[1] != ' ' && ptr[1] != '\0') {
|
||||
+ int offt = (int)(ptr - str + 1);
|
||||
+ kexec_argv[argc] = (int)kbuf + offt;
|
||||
+ argc++;
|
||||
+ }
|
||||
+ ptr = strchr(ptr + 1, ' ');
|
||||
+ }
|
||||
+ if (argc > 1) {
|
||||
+ /* Copy to kernel space */
|
||||
+ copy_from_user(kbuf, (char *)image->segment[i].buf, image->segment[i].bufsz);
|
||||
+ fw_arg0 = kexec_args[0] = argc;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ pr_info("argc = %lu\n", kexec_args[0]);
|
||||
+ for (i = 0; i < kexec_args[0]; i++)
|
||||
+ pr_info("argv[%d] = %p, %s\n", i, (char *)kexec_argv[i], (char *)kexec_argv[i]);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int
|
||||
machine_kexec_prepare(struct kimage *kimage)
|
||||
{
|
||||
@@ -47,6 +98,7 @@ machine_kexec_prepare(struct kimage *kim
|
||||
* This can be overrided by _machine_kexec_prepare().
|
||||
*/
|
||||
machine_kexec_init_args();
|
||||
+ machine_kexec_pass_args(kimage);
|
||||
|
||||
if (_machine_kexec_prepare)
|
||||
return _machine_kexec_prepare(kimage);
|
@ -1,83 +0,0 @@
|
||||
From 4aded085fa0057a9a1e1dcec631f950307360c1f Mon Sep 17 00:00:00 2001
|
||||
From: Wu Zhangjin <wuzhangjin@gmail.com>
|
||||
Date: Tue, 11 Jan 2011 13:46:19 +0000
|
||||
Subject: MIPS: Fix compiling failure of relocate_kernel.S
|
||||
|
||||
The following errors is fixed with the help of <asm/asm_nosec.h>. for
|
||||
this file need to put different symbols in the same section, the
|
||||
original LEAF, NESTED and EXPORT (without explicit section indication)
|
||||
must be used, <asm/asm_nosec.h> does it.
|
||||
|
||||
arch/mips/kernel/relocate_kernel.S: Assembler messages:
|
||||
arch/mips/kernel/relocate_kernel.S:162: Error: operation combines symbols in different segments
|
||||
|
||||
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
|
||||
---
|
||||
(limited to 'arch/mips/kernel')
|
||||
|
||||
--- a/arch/mips/kernel/relocate_kernel.S
|
||||
+++ b/arch/mips/kernel/relocate_kernel.S
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <asm/asm.h>
|
||||
+#include <asm/asm_nosec.h>
|
||||
#include <asm/asmmacro.h>
|
||||
#include <asm/regdef.h>
|
||||
#include <asm/page.h>
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/include/asm/asm_nosec.h
|
||||
@@ -0,0 +1,53 @@
|
||||
+/*
|
||||
+ * This file is subject to the terms and conditions of the GNU General Public
|
||||
+ * License. See the file "COPYING" in the main directory of this archive
|
||||
+ * for more details.
|
||||
+ *
|
||||
+ * Copyright (C) 1995, 1996, 1997, 1999, 2001 by Ralf Baechle
|
||||
+ * Copyright (C) 1999 by Silicon Graphics, Inc.
|
||||
+ * Copyright (C) 2001 MIPS Technologies, Inc.
|
||||
+ * Copyright (C) 2002 Maciej W. Rozycki
|
||||
+ * Copyright (C) 2010 Wu Zhangjin <wuzhangjin@gmail.com>
|
||||
+ *
|
||||
+ * Derive from <asm/asm.h>
|
||||
+ *
|
||||
+ * Override the macros without -ffunction-sections and -fdata-sections support.
|
||||
+ * If several functions or data must be put in the same section, please include
|
||||
+ * this header file after the <asm/asm.h> to override the generic definition.
|
||||
+ */
|
||||
+
|
||||
+#ifndef __ASM_ASM_NOSEC_H
|
||||
+#define __ASM_ASM_NOSEC_H
|
||||
+
|
||||
+#undef LEAF
|
||||
+#undef NESTED
|
||||
+#undef EXPORT
|
||||
+
|
||||
+/*
|
||||
+ * LEAF - declare leaf routine
|
||||
+ */
|
||||
+#define LEAF(symbol) \
|
||||
+ .globl symbol; \
|
||||
+ .align 2; \
|
||||
+ .type symbol, @function; \
|
||||
+ .ent symbol, 0; \
|
||||
+symbol: .frame sp, 0, ra
|
||||
+
|
||||
+/*
|
||||
+ * NESTED - declare nested routine entry point
|
||||
+ */
|
||||
+#define NESTED(symbol, framesize, rpc) \
|
||||
+ .globl symbol; \
|
||||
+ .align 2; \
|
||||
+ .type symbol, @function; \
|
||||
+ .ent symbol, 0; \
|
||||
+symbol: .frame sp, framesize, rpc
|
||||
+
|
||||
+/*
|
||||
+ * EXPORT - export definition of symbol
|
||||
+ */
|
||||
+#define EXPORT(symbol) \
|
||||
+ .globl symbol; \
|
||||
+symbol:
|
||||
+
|
||||
+#endif /* __ASM_ASM_NOSEC_H */
|
@ -1,186 +0,0 @@
|
||||
--- a/arch/mips/kernel/machine_kexec.c
|
||||
+++ b/arch/mips/kernel/machine_kexec.c
|
||||
@@ -25,67 +25,104 @@ void (*relocated_kexec_smp_wait) (void *
|
||||
atomic_t kexec_ready_to_reboot = ATOMIC_INIT(0);
|
||||
#endif
|
||||
|
||||
-static void machine_kexec_init_args(void)
|
||||
+#define KEXEC_MIPS_ARGV_BUF_SIZE COMMAND_LINE_SIZE
|
||||
+#define KEXEC_MIPS_ARGV_MAX_ARGS (COMMAND_LINE_SIZE / 15)
|
||||
+
|
||||
+char kexec_argv_buf[KEXEC_MIPS_ARGV_BUF_SIZE] __kexec;
|
||||
+char *kexec_argv[KEXEC_MIPS_ARGV_MAX_ARGS] __kexec;
|
||||
+
|
||||
+static void
|
||||
+machine_kexec_print_args(void)
|
||||
{
|
||||
- kexec_args[0] = fw_arg0;
|
||||
- kexec_args[1] = fw_arg1;
|
||||
- kexec_args[2] = fw_arg2;
|
||||
- kexec_args[3] = fw_arg3;
|
||||
+ int i;
|
||||
|
||||
pr_info("kexec_args[0] (argc): %lu\n", kexec_args[0]);
|
||||
pr_info("kexec_args[1] (argv): %p\n", (void *)kexec_args[1]);
|
||||
pr_info("kexec_args[2] (env ): %p\n", (void *)kexec_args[2]);
|
||||
pr_info("kexec_args[3] (desc): %p\n", (void *)kexec_args[3]);
|
||||
-}
|
||||
|
||||
-#define ARGV_MAX_ARGS (COMMAND_LINE_SIZE / 15)
|
||||
+ for (i = 0; i < kexec_args[0]; i++)
|
||||
+ pr_info("kexec_argv[%d] = %p, %s\n", i,
|
||||
+ (char *)kexec_argv[i], (char *)kexec_argv[i]);
|
||||
+}
|
||||
|
||||
-int machine_kexec_pass_args(struct kimage *image)
|
||||
+static void
|
||||
+machine_kexec_init_argv(struct kimage *image)
|
||||
{
|
||||
- int i, argc = 0;
|
||||
- char *bootloader = "kexec";
|
||||
- int *kexec_argv = (int *)kexec_args[1];
|
||||
+ void __user *buf = NULL;
|
||||
+ size_t bufsz;
|
||||
+ size_t size;
|
||||
+ int i;
|
||||
|
||||
+ bufsz = 0;
|
||||
for (i = 0; i < image->nr_segments; i++) {
|
||||
- if (!strncmp(bootloader, (char *)image->segment[i].buf,
|
||||
- strlen(bootloader))) {
|
||||
- /*
|
||||
- * convert command line string to array
|
||||
- * of parameters (as bootloader does).
|
||||
- */
|
||||
- /*
|
||||
- * Note: we do treat the 1st string "kexec" as an
|
||||
- * argument ;-) so, argc here is 1.
|
||||
- */
|
||||
- char *str = (char *)image->segment[i].buf;
|
||||
- char *ptr = strchr(str, ' ');
|
||||
- char *kbuf = (char *)kexec_argv[0];
|
||||
- /* Whenever --command-line or --append used, "kexec" is copied */
|
||||
- argc = 1;
|
||||
- /* Parse the offset */
|
||||
- while (ptr && (ARGV_MAX_ARGS > argc)) {
|
||||
- *ptr = '\0';
|
||||
- if (ptr[1] != ' ' && ptr[1] != '\0') {
|
||||
- int offt = (int)(ptr - str + 1);
|
||||
- kexec_argv[argc] = (int)kbuf + offt;
|
||||
- argc++;
|
||||
- }
|
||||
- ptr = strchr(ptr + 1, ' ');
|
||||
- }
|
||||
- if (argc > 1) {
|
||||
- /* Copy to kernel space */
|
||||
- copy_from_user(kbuf, (char *)image->segment[i].buf, image->segment[i].bufsz);
|
||||
- fw_arg0 = kexec_args[0] = argc;
|
||||
- }
|
||||
- break;
|
||||
+ struct kexec_segment *seg;
|
||||
+
|
||||
+ seg = &image->segment[i];
|
||||
+ if (seg->bufsz < 6)
|
||||
+ continue;
|
||||
+
|
||||
+ if (strncmp((char *) seg->buf, "kexec", 5))
|
||||
+ continue;
|
||||
+
|
||||
+ /* don't copy "kexec" */
|
||||
+ buf = seg->buf + 5;
|
||||
+ bufsz = seg->bufsz - 5;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (!buf)
|
||||
+ return;
|
||||
+
|
||||
+ size = KEXEC_MIPS_ARGV_BUF_SIZE - 1;
|
||||
+ size = min(size, bufsz);
|
||||
+ if (size < bufsz)
|
||||
+ pr_warn("kexec command line truncated to %zd bytes\n", size);
|
||||
+
|
||||
+ /* Copy to kernel space */
|
||||
+ copy_from_user(kexec_argv_buf, buf, size);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+machine_kexec_parse_argv(struct kimage *image)
|
||||
+{
|
||||
+ char *reboot_code_buffer;
|
||||
+ int reloc_delta;
|
||||
+ char *ptr;
|
||||
+ int argc;
|
||||
+ int i;
|
||||
+
|
||||
+ ptr = kexec_argv_buf;
|
||||
+ argc = 0;
|
||||
+
|
||||
+ /*
|
||||
+ * convert command line string to array of parameters
|
||||
+ * (as bootloader does).
|
||||
+ */
|
||||
+ while (ptr && *ptr && (KEXEC_MIPS_ARGV_MAX_ARGS > argc)) {
|
||||
+ if (*ptr == ' ') {
|
||||
+ *ptr++ = '\0';
|
||||
+ continue;
|
||||
}
|
||||
+
|
||||
+ kexec_argv[argc++] = ptr;
|
||||
+ ptr = strchr(ptr, ' ');
|
||||
}
|
||||
|
||||
- pr_info("argc = %lu\n", kexec_args[0]);
|
||||
- for (i = 0; i < kexec_args[0]; i++)
|
||||
- pr_info("argv[%d] = %p, %s\n", i, (char *)kexec_argv[i], (char *)kexec_argv[i]);
|
||||
+ if (!argc)
|
||||
+ return;
|
||||
|
||||
- return 0;
|
||||
+ kexec_args[0] = argc;
|
||||
+ kexec_args[1] = (unsigned long)kexec_argv;
|
||||
+ kexec_args[2] = 0;
|
||||
+ kexec_args[3] = 0;
|
||||
+
|
||||
+ reboot_code_buffer = page_address(image->control_code_page);
|
||||
+ reloc_delta = reboot_code_buffer - (char *) &__start___kexec_relocate;
|
||||
+
|
||||
+ kexec_args[1] += reloc_delta;
|
||||
+ for (i = 0; i < argc; i++)
|
||||
+ kexec_argv[i] += reloc_delta;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -97,8 +134,14 @@ machine_kexec_prepare(struct kimage *kim
|
||||
*
|
||||
* This can be overrided by _machine_kexec_prepare().
|
||||
*/
|
||||
- machine_kexec_init_args();
|
||||
- machine_kexec_pass_args(kimage);
|
||||
+
|
||||
+ kexec_args[0] = fw_arg0;
|
||||
+ kexec_args[1] = fw_arg1;
|
||||
+ kexec_args[2] = fw_arg2;
|
||||
+ kexec_args[3] = fw_arg3;
|
||||
+
|
||||
+ machine_kexec_init_argv(kimage);
|
||||
+ machine_kexec_parse_argv(kimage);
|
||||
|
||||
if (_machine_kexec_prepare)
|
||||
return _machine_kexec_prepare(kimage);
|
||||
@@ -154,11 +197,13 @@ machine_kexec(struct kimage *image)
|
||||
pr_info("kexec_indirection_page = %p\n",
|
||||
(void *)kexec_indirection_page);
|
||||
|
||||
+ pr_info("Copy kexec_relocate section from %p to reboot_code_buffer: %p\n",
|
||||
+ &__start___kexec_relocate, (void *)reboot_code_buffer);
|
||||
+
|
||||
memcpy((void *)reboot_code_buffer, &__start___kexec_relocate,
|
||||
kexec_relocate_size);
|
||||
|
||||
- pr_info("Copy kexec_relocate section from %p to reboot_code_buffer: %p\n",
|
||||
- &__start___kexec_relocate, (void *)reboot_code_buffer);
|
||||
+ machine_kexec_print_args();
|
||||
|
||||
/*
|
||||
* The generic kexec code builds a page list with physical
|
@ -1,20 +0,0 @@
|
||||
--- a/kernel/module.c
|
||||
+++ b/kernel/module.c
|
||||
@@ -2398,12 +2398,15 @@ static void dynamic_debug_remove(struct
|
||||
|
||||
void * __weak module_alloc(unsigned long size)
|
||||
{
|
||||
- return size == 0 ? NULL : vmalloc_exec(size);
|
||||
+ return vmalloc_exec(size);
|
||||
}
|
||||
|
||||
static void *module_alloc_update_bounds(unsigned long size)
|
||||
{
|
||||
- void *ret = module_alloc(size);
|
||||
+ void *ret = NULL;
|
||||
+
|
||||
+ if (size)
|
||||
+ ret = module_alloc(size);
|
||||
|
||||
if (ret) {
|
||||
mutex_lock(&module_mutex);
|
@ -1,327 +0,0 @@
|
||||
--- a/drivers/mtd/Kconfig
|
||||
+++ b/drivers/mtd/Kconfig
|
||||
@@ -23,6 +23,14 @@ config MTD_TESTS
|
||||
WARNING: some of the tests will ERASE entire MTD device which they
|
||||
test. Do not use these tests unless you really know what you do.
|
||||
|
||||
+config MTD_ROOTFS_ROOT_DEV
|
||||
+ bool "Automatically set 'rootfs' partition to be root filesystem"
|
||||
+ default y
|
||||
+
|
||||
+config MTD_ROOTFS_SPLIT
|
||||
+ bool "Automatically split 'rootfs' partition for squashfs"
|
||||
+ default y
|
||||
+
|
||||
config MTD_REDBOOT_PARTS
|
||||
tristate "RedBoot partition table parsing"
|
||||
---help---
|
||||
--- a/drivers/mtd/mtdpart.c
|
||||
+++ b/drivers/mtd/mtdpart.c
|
||||
@@ -29,6 +29,8 @@
|
||||
#include <linux/kmod.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
+#include <linux/root_dev.h>
|
||||
+#include <linux/magic.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
#include "mtdcore.h"
|
||||
@@ -50,7 +52,7 @@ struct mtd_part {
|
||||
* the pointer to that structure with this macro.
|
||||
*/
|
||||
#define PART(x) ((struct mtd_part *)(x))
|
||||
-
|
||||
+#define IS_PART(mtd) (mtd->_read == part_read)
|
||||
|
||||
/*
|
||||
* MTD methods which simply translate the effective address and pass through
|
||||
@@ -613,6 +615,155 @@ int mtd_del_partition(struct mtd_info *m
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mtd_del_partition);
|
||||
|
||||
+#ifdef CONFIG_MTD_ROOTFS_SPLIT
|
||||
+#define ROOTFS_SPLIT_NAME "rootfs_data"
|
||||
+#define ROOTFS_REMOVED_NAME "<removed>"
|
||||
+
|
||||
+struct squashfs_super_block {
|
||||
+ __le32 s_magic;
|
||||
+ __le32 pad0[9];
|
||||
+ __le64 bytes_used;
|
||||
+};
|
||||
+
|
||||
+
|
||||
+static int split_squashfs(struct mtd_info *master, int offset, int *split_offset)
|
||||
+{
|
||||
+ struct squashfs_super_block sb;
|
||||
+ int len, ret;
|
||||
+
|
||||
+ ret = mtd_read(master, offset, sizeof(sb), &len, (void *) &sb);
|
||||
+ if (ret || (len != sizeof(sb))) {
|
||||
+ printk(KERN_ALERT "split_squashfs: error occured while reading "
|
||||
+ "from \"%s\"\n", master->name);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (SQUASHFS_MAGIC != le32_to_cpu(sb.s_magic) ) {
|
||||
+ printk(KERN_ALERT "split_squashfs: no squashfs found in \"%s\"\n",
|
||||
+ master->name);
|
||||
+ *split_offset = 0;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (le64_to_cpu((sb.bytes_used)) <= 0) {
|
||||
+ printk(KERN_ALERT "split_squashfs: squashfs is empty in \"%s\"\n",
|
||||
+ master->name);
|
||||
+ *split_offset = 0;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ len = (u32) le64_to_cpu(sb.bytes_used);
|
||||
+ len += (offset & 0x000fffff);
|
||||
+ len += (master->erasesize - 1);
|
||||
+ len &= ~(master->erasesize - 1);
|
||||
+ len -= (offset & 0x000fffff);
|
||||
+ *split_offset = offset + len;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int split_rootfs_data(struct mtd_info *master, struct mtd_info *rpart, const struct mtd_partition *part)
|
||||
+{
|
||||
+ struct mtd_partition *dpart;
|
||||
+ struct mtd_part *slave = NULL;
|
||||
+ struct mtd_part *spart;
|
||||
+ int ret, split_offset = 0;
|
||||
+
|
||||
+ spart = PART(rpart);
|
||||
+ ret = split_squashfs(master, spart->offset, &split_offset);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ if (split_offset <= 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ dpart = kmalloc(sizeof(*part)+sizeof(ROOTFS_SPLIT_NAME)+1, GFP_KERNEL);
|
||||
+ if (dpart == NULL) {
|
||||
+ printk(KERN_INFO "split_squashfs: no memory for partition \"%s\"\n",
|
||||
+ ROOTFS_SPLIT_NAME);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ memcpy(dpart, part, sizeof(*part));
|
||||
+ dpart->name = (unsigned char *)&dpart[1];
|
||||
+ strcpy(dpart->name, ROOTFS_SPLIT_NAME);
|
||||
+
|
||||
+ dpart->size = rpart->size - (split_offset - spart->offset);
|
||||
+ dpart->offset = split_offset;
|
||||
+
|
||||
+ if (dpart == NULL)
|
||||
+ return 1;
|
||||
+
|
||||
+ printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=%llX, len=%llX \n",
|
||||
+ ROOTFS_SPLIT_NAME, dpart->offset, dpart->size);
|
||||
+
|
||||
+ slave = allocate_partition(master, dpart, 0, split_offset);
|
||||
+ if (IS_ERR(slave))
|
||||
+ return PTR_ERR(slave);
|
||||
+ mutex_lock(&mtd_partitions_mutex);
|
||||
+ list_add(&slave->list, &mtd_partitions);
|
||||
+ mutex_unlock(&mtd_partitions_mutex);
|
||||
+
|
||||
+ add_mtd_device(&slave->mtd);
|
||||
+
|
||||
+ rpart->split = &slave->mtd;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int refresh_rootfs_split(struct mtd_info *mtd)
|
||||
+{
|
||||
+ struct mtd_partition tpart;
|
||||
+ struct mtd_part *part;
|
||||
+ char *name;
|
||||
+ //int index = 0;
|
||||
+ int offset, size;
|
||||
+ int ret;
|
||||
+
|
||||
+ part = PART(mtd);
|
||||
+
|
||||
+ /* check for the new squashfs offset first */
|
||||
+ ret = split_squashfs(part->master, part->offset, &offset);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ if ((offset > 0) && !mtd->split) {
|
||||
+ printk(KERN_INFO "%s: creating new split partition for \"%s\"\n", __func__, mtd->name);
|
||||
+ /* if we don't have a rootfs split partition, create a new one */
|
||||
+ tpart.name = (char *) mtd->name;
|
||||
+ tpart.size = mtd->size;
|
||||
+ tpart.offset = part->offset;
|
||||
+
|
||||
+ return split_rootfs_data(part->master, &part->mtd, &tpart);
|
||||
+ } else if ((offset > 0) && mtd->split) {
|
||||
+ /* update the offsets of the existing partition */
|
||||
+ size = mtd->size + part->offset - offset;
|
||||
+
|
||||
+ part = PART(mtd->split);
|
||||
+ part->offset = offset;
|
||||
+ part->mtd.size = size;
|
||||
+ printk(KERN_INFO "%s: %s partition \"" ROOTFS_SPLIT_NAME "\", offset: 0x%06x (0x%06x)\n",
|
||||
+ __func__, (!strcmp(part->mtd.name, ROOTFS_SPLIT_NAME) ? "updating" : "creating"),
|
||||
+ (u32) part->offset, (u32) part->mtd.size);
|
||||
+ name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL);
|
||||
+ strcpy(name, ROOTFS_SPLIT_NAME);
|
||||
+ part->mtd.name = name;
|
||||
+ } else if ((offset <= 0) && mtd->split) {
|
||||
+ printk(KERN_INFO "%s: removing partition \"%s\"\n", __func__, mtd->split->name);
|
||||
+
|
||||
+ /* mark existing partition as removed */
|
||||
+ part = PART(mtd->split);
|
||||
+ name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL);
|
||||
+ strcpy(name, ROOTFS_REMOVED_NAME);
|
||||
+ part->mtd.name = name;
|
||||
+ part->offset = 0;
|
||||
+ part->mtd.size = 0;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif /* CONFIG_MTD_ROOTFS_SPLIT */
|
||||
+
|
||||
/*
|
||||
* This function, given a master MTD object and a partition table, creates
|
||||
* and registers slave MTD objects which are bound to the master according to
|
||||
@@ -629,6 +780,9 @@ int add_mtd_partitions(struct mtd_info *
|
||||
struct mtd_part *slave;
|
||||
uint64_t cur_offset = 0;
|
||||
int i;
|
||||
+#ifdef CONFIG_MTD_ROOTFS_SPLIT
|
||||
+ int ret;
|
||||
+#endif
|
||||
|
||||
printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name);
|
||||
|
||||
@@ -643,12 +797,53 @@ int add_mtd_partitions(struct mtd_info *
|
||||
|
||||
add_mtd_device(&slave->mtd);
|
||||
|
||||
+ if (!strcmp(parts[i].name, "rootfs")) {
|
||||
+#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV
|
||||
+ if (ROOT_DEV == 0) {
|
||||
+ printk(KERN_NOTICE "mtd: partition \"rootfs\" "
|
||||
+ "set to be root filesystem\n");
|
||||
+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, slave->mtd.index);
|
||||
+ }
|
||||
+#endif
|
||||
+#ifdef CONFIG_MTD_ROOTFS_SPLIT
|
||||
+ ret = split_rootfs_data(master, &slave->mtd, &parts[i]);
|
||||
+ /* if (ret == 0)
|
||||
+ * j++; */
|
||||
+#endif
|
||||
+ }
|
||||
+
|
||||
cur_offset = slave->offset + slave->mtd.size;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+int mtd_device_refresh(struct mtd_info *mtd)
|
||||
+{
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if (IS_PART(mtd)) {
|
||||
+ struct mtd_part *part;
|
||||
+ struct mtd_info *master;
|
||||
+
|
||||
+ part = PART(mtd);
|
||||
+ master = part->master;
|
||||
+ if (master->refresh_device)
|
||||
+ ret = master->refresh_device(master);
|
||||
+ }
|
||||
+
|
||||
+ if (!ret && mtd->refresh_device)
|
||||
+ ret = mtd->refresh_device(mtd);
|
||||
+
|
||||
+#ifdef CONFIG_MTD_ROOTFS_SPLIT
|
||||
+ if (!ret && IS_PART(mtd) && !strcmp(mtd->name, "rootfs"))
|
||||
+ refresh_rootfs_split(mtd);
|
||||
+#endif
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(mtd_device_refresh);
|
||||
+
|
||||
static DEFINE_SPINLOCK(part_parser_lock);
|
||||
static LIST_HEAD(part_parsers);
|
||||
|
||||
--- a/drivers/mtd/mtdchar.c
|
||||
+++ b/drivers/mtd/mtdchar.c
|
||||
@@ -1012,6 +1012,12 @@ static int mtdchar_ioctl(struct file *fi
|
||||
break;
|
||||
}
|
||||
|
||||
+ case MTDREFRESH:
|
||||
+ {
|
||||
+ ret = mtd_device_refresh(mtd);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
default:
|
||||
ret = -ENOTTY;
|
||||
}
|
||||
--- a/include/linux/mtd/mtd.h
|
||||
+++ b/include/linux/mtd/mtd.h
|
||||
@@ -114,6 +114,7 @@ struct nand_ecclayout {
|
||||
|
||||
struct module; /* only needed for owner field in mtd_info */
|
||||
|
||||
+struct mtd_info;
|
||||
struct mtd_info {
|
||||
u_char type;
|
||||
uint32_t flags;
|
||||
@@ -226,6 +227,9 @@ struct mtd_info {
|
||||
int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs);
|
||||
int (*_suspend) (struct mtd_info *mtd);
|
||||
void (*_resume) (struct mtd_info *mtd);
|
||||
+ int (*refresh_device)(struct mtd_info *mtd);
|
||||
+ struct mtd_info *split;
|
||||
+
|
||||
/*
|
||||
* If the driver is something smart, like UBI, it may need to maintain
|
||||
* its own reference counting. The below functions are only for driver.
|
||||
@@ -368,6 +372,7 @@ extern int mtd_device_parse_register(str
|
||||
int defnr_parts);
|
||||
#define mtd_device_register(master, parts, nr_parts) \
|
||||
mtd_device_parse_register(master, NULL, NULL, parts, nr_parts)
|
||||
+extern int mtd_device_refresh(struct mtd_info *master);
|
||||
extern int mtd_device_unregister(struct mtd_info *master);
|
||||
extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num);
|
||||
extern int __get_mtd_device(struct mtd_info *mtd);
|
||||
--- a/include/linux/mtd/partitions.h
|
||||
+++ b/include/linux/mtd/partitions.h
|
||||
@@ -36,12 +36,14 @@
|
||||
* erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK).
|
||||
*/
|
||||
|
||||
+struct mtd_partition;
|
||||
struct mtd_partition {
|
||||
char *name; /* identifier string */
|
||||
uint64_t size; /* partition size */
|
||||
uint64_t offset; /* offset within the master MTD space */
|
||||
uint32_t mask_flags; /* master MTD flags to mask out for this partition */
|
||||
struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only) */
|
||||
+ int (*refresh_partition)(struct mtd_info *);
|
||||
};
|
||||
|
||||
#define MTDPART_OFS_RETAIN (-3)
|
||||
--- a/include/uapi/mtd/mtd-abi.h
|
||||
+++ b/include/uapi/mtd/mtd-abi.h
|
||||
@@ -202,6 +202,7 @@ struct otp_info {
|
||||
* without OOB, e.g., NOR flash.
|
||||
*/
|
||||
#define MEMWRITE _IOWR('M', 24, struct mtd_write_req)
|
||||
+#define MTDREFRESH _IO('M', 50)
|
||||
|
||||
/*
|
||||
* Obsolete legacy interface. Keep it in order not to break userspace
|
@ -1,145 +0,0 @@
|
||||
--- a/drivers/mtd/mtdpart.c
|
||||
+++ b/drivers/mtd/mtdpart.c
|
||||
@@ -35,6 +35,8 @@
|
||||
|
||||
#include "mtdcore.h"
|
||||
|
||||
+#define MTD_ERASE_PARTIAL 0x8000 /* partition only covers parts of an erase block */
|
||||
+
|
||||
/* Our partition linked list */
|
||||
static LIST_HEAD(mtd_partitions);
|
||||
static DEFINE_MUTEX(mtd_partitions_mutex);
|
||||
@@ -230,13 +232,60 @@ static int part_erase(struct mtd_info *m
|
||||
struct mtd_part *part = PART(mtd);
|
||||
int ret;
|
||||
|
||||
+
|
||||
+ instr->partial_start = false;
|
||||
+ if (mtd->flags & MTD_ERASE_PARTIAL) {
|
||||
+ size_t readlen = 0;
|
||||
+ u64 mtd_ofs;
|
||||
+
|
||||
+ instr->erase_buf = kmalloc(part->master->erasesize, GFP_ATOMIC);
|
||||
+ if (!instr->erase_buf)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ mtd_ofs = part->offset + instr->addr;
|
||||
+ instr->erase_buf_ofs = do_div(mtd_ofs, part->master->erasesize);
|
||||
+
|
||||
+ if (instr->erase_buf_ofs > 0) {
|
||||
+ instr->addr -= instr->erase_buf_ofs;
|
||||
+ ret = mtd_read(part->master,
|
||||
+ instr->addr + part->offset,
|
||||
+ part->master->erasesize,
|
||||
+ &readlen, instr->erase_buf);
|
||||
+
|
||||
+ instr->partial_start = true;
|
||||
+ } else {
|
||||
+ mtd_ofs = part->offset + part->mtd.size;
|
||||
+ instr->erase_buf_ofs = part->master->erasesize -
|
||||
+ do_div(mtd_ofs, part->master->erasesize);
|
||||
+
|
||||
+ if (instr->erase_buf_ofs > 0) {
|
||||
+ instr->len += instr->erase_buf_ofs;
|
||||
+ ret = mtd_read(part->master,
|
||||
+ part->offset + instr->addr +
|
||||
+ instr->len - part->master->erasesize,
|
||||
+ part->master->erasesize, &readlen,
|
||||
+ instr->erase_buf);
|
||||
+ } else {
|
||||
+ ret = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ if (ret < 0) {
|
||||
+ kfree(instr->erase_buf);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
instr->addr += part->offset;
|
||||
ret = part->master->_erase(part->master, instr);
|
||||
if (ret) {
|
||||
if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
|
||||
instr->fail_addr -= part->offset;
|
||||
instr->addr -= part->offset;
|
||||
+ if (mtd->flags & MTD_ERASE_PARTIAL)
|
||||
+ kfree(instr->erase_buf);
|
||||
}
|
||||
+
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -244,7 +293,25 @@ void mtd_erase_callback(struct erase_inf
|
||||
{
|
||||
if (instr->mtd->_erase == part_erase) {
|
||||
struct mtd_part *part = PART(instr->mtd);
|
||||
+ size_t wrlen = 0;
|
||||
|
||||
+ if (instr->mtd->flags & MTD_ERASE_PARTIAL) {
|
||||
+ if (instr->partial_start) {
|
||||
+ part->master->_write(part->master,
|
||||
+ instr->addr, instr->erase_buf_ofs,
|
||||
+ &wrlen, instr->erase_buf);
|
||||
+ instr->addr += instr->erase_buf_ofs;
|
||||
+ } else {
|
||||
+ instr->len -= instr->erase_buf_ofs;
|
||||
+ part->master->_write(part->master,
|
||||
+ instr->addr + instr->len,
|
||||
+ instr->erase_buf_ofs, &wrlen,
|
||||
+ instr->erase_buf +
|
||||
+ part->master->erasesize -
|
||||
+ instr->erase_buf_ofs);
|
||||
+ }
|
||||
+ kfree(instr->erase_buf);
|
||||
+ }
|
||||
if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
|
||||
instr->fail_addr -= part->offset;
|
||||
instr->addr -= part->offset;
|
||||
@@ -504,18 +571,24 @@ static struct mtd_part *allocate_partiti
|
||||
if ((slave->mtd.flags & MTD_WRITEABLE) &&
|
||||
mtd_mod_by_eb(slave->offset, &slave->mtd)) {
|
||||
/* Doesn't start on a boundary of major erase size */
|
||||
- /* FIXME: Let it be writable if it is on a boundary of
|
||||
- * _minor_ erase size though */
|
||||
- slave->mtd.flags &= ~MTD_WRITEABLE;
|
||||
- printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase block boundary -- force read-only\n",
|
||||
- part->name);
|
||||
+ slave->mtd.flags |= MTD_ERASE_PARTIAL;
|
||||
+ if (((u32) slave->mtd.size) > master->erasesize)
|
||||
+ slave->mtd.flags &= ~MTD_WRITEABLE;
|
||||
+ else
|
||||
+ slave->mtd.erasesize = slave->mtd.size;
|
||||
}
|
||||
if ((slave->mtd.flags & MTD_WRITEABLE) &&
|
||||
- mtd_mod_by_eb(slave->mtd.size, &slave->mtd)) {
|
||||
- slave->mtd.flags &= ~MTD_WRITEABLE;
|
||||
- printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase block -- force read-only\n",
|
||||
- part->name);
|
||||
+ mtd_mod_by_eb(slave->offset + slave->mtd.size, &slave->mtd)) {
|
||||
+ slave->mtd.flags |= MTD_ERASE_PARTIAL;
|
||||
+
|
||||
+ if ((u32) slave->mtd.size > master->erasesize)
|
||||
+ slave->mtd.flags &= ~MTD_WRITEABLE;
|
||||
+ else
|
||||
+ slave->mtd.erasesize = slave->mtd.size;
|
||||
}
|
||||
+ if ((slave->mtd.flags & (MTD_ERASE_PARTIAL|MTD_WRITEABLE)) == MTD_ERASE_PARTIAL)
|
||||
+ printk(KERN_WARNING"mtd: partition \"%s\" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only\n",
|
||||
+ part->name);
|
||||
|
||||
slave->mtd.ecclayout = master->ecclayout;
|
||||
slave->mtd.ecc_strength = master->ecc_strength;
|
||||
--- a/include/linux/mtd/mtd.h
|
||||
+++ b/include/linux/mtd/mtd.h
|
||||
@@ -58,6 +58,10 @@ struct erase_info {
|
||||
u_long priv;
|
||||
u_char state;
|
||||
struct erase_info *next;
|
||||
+
|
||||
+ u8 *erase_buf;
|
||||
+ u32 erase_buf_ofs;
|
||||
+ bool partial_start;
|
||||
};
|
||||
|
||||
struct mtd_erase_region_info {
|
@ -1,18 +0,0 @@
|
||||
--- a/include/linux/mtd/partitions.h
|
||||
+++ b/include/linux/mtd/partitions.h
|
||||
@@ -35,6 +35,7 @@
|
||||
* Note: writeable partitions require their size and offset be
|
||||
* erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK).
|
||||
*/
|
||||
+struct mtd_info;
|
||||
|
||||
struct mtd_partition;
|
||||
struct mtd_partition {
|
||||
@@ -52,7 +53,6 @@ struct mtd_partition {
|
||||
#define MTDPART_SIZ_FULL (0)
|
||||
|
||||
|
||||
-struct mtd_info;
|
||||
struct device_node;
|
||||
|
||||
/**
|
@ -1,30 +0,0 @@
|
||||
--- a/drivers/mtd/redboot.c
|
||||
+++ b/drivers/mtd/redboot.c
|
||||
@@ -265,14 +265,21 @@ static int parse_redboot_partitions(stru
|
||||
#endif
|
||||
names += strlen(names)+1;
|
||||
|
||||
-#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
|
||||
if(fl->next && fl->img->flash_base + fl->img->size + master->erasesize <= fl->next->img->flash_base) {
|
||||
- i++;
|
||||
- parts[i].offset = parts[i-1].size + parts[i-1].offset;
|
||||
- parts[i].size = fl->next->img->flash_base - parts[i].offset;
|
||||
- parts[i].name = nullname;
|
||||
- }
|
||||
+ if (!strcmp(parts[i].name, "rootfs")) {
|
||||
+ parts[i].size = fl->next->img->flash_base;
|
||||
+ parts[i].size &= ~(master->erasesize - 1);
|
||||
+ parts[i].size -= parts[i].offset;
|
||||
+#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
|
||||
+ nrparts--;
|
||||
+ } else {
|
||||
+ i++;
|
||||
+ parts[i].offset = parts[i-1].size + parts[i-1].offset;
|
||||
+ parts[i].size = fl->next->img->flash_base - parts[i].offset;
|
||||
+ parts[i].name = nullname;
|
||||
#endif
|
||||
+ }
|
||||
+ }
|
||||
tmp_fl = fl;
|
||||
fl = fl->next;
|
||||
kfree(tmp_fl);
|
@ -1,35 +0,0 @@
|
||||
--- a/drivers/mtd/Kconfig
|
||||
+++ b/drivers/mtd/Kconfig
|
||||
@@ -163,6 +163,22 @@ config MTD_BCM47XX_PARTS
|
||||
This provides partitions parser for devices based on BCM47xx
|
||||
boards.
|
||||
|
||||
+config MTD_MYLOADER_PARTS
|
||||
+ tristate "MyLoader partition parsing"
|
||||
+ depends on ADM5120 || ATHEROS_AR231X || ATHEROS_AR71XX || ATH79
|
||||
+ ---help---
|
||||
+ MyLoader is a bootloader which allows the user to define partitions
|
||||
+ in flash devices, by putting a table in the second erase block
|
||||
+ on the device, similar to a partition table. This table gives the
|
||||
+ offsets and lengths of the user defined partitions.
|
||||
+
|
||||
+ If you need code which can detect and parse these tables, and
|
||||
+ register MTD 'partitions' corresponding to each image detected,
|
||||
+ enable this option.
|
||||
+
|
||||
+ You will still need the parsing functions to be called by the driver
|
||||
+ for your particular device. It won't happen automatically.
|
||||
+
|
||||
comment "User Modules And Translation Layers"
|
||||
|
||||
config MTD_CHAR
|
||||
--- a/drivers/mtd/Makefile
|
||||
+++ b/drivers/mtd/Makefile
|
||||
@@ -13,6 +13,7 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o
|
||||
obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o
|
||||
obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o
|
||||
obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o
|
||||
+obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o
|
||||
|
||||
# 'Users' - code which presents functionality to userspace.
|
||||
obj-$(CONFIG_MTD_CHAR) += mtdchar.o
|
@ -1,116 +0,0 @@
|
||||
--- a/drivers/mtd/devices/block2mtd.c
|
||||
+++ b/drivers/mtd/devices/block2mtd.c
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <linux/list.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
+#include <linux/mtd/partitions.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/mount.h>
|
||||
#include <linux/slab.h>
|
||||
@@ -208,11 +209,12 @@ static void block2mtd_free_device(struct
|
||||
|
||||
|
||||
/* FIXME: ensure that mtd->size % erase_size == 0 */
|
||||
-static struct block2mtd_dev *add_device(char *devname, int erase_size)
|
||||
+static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname)
|
||||
{
|
||||
const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
|
||||
struct block_device *bdev;
|
||||
struct block2mtd_dev *dev;
|
||||
+ struct mtd_partition *part;
|
||||
char *name;
|
||||
|
||||
if (!devname)
|
||||
@@ -251,13 +253,16 @@ static struct block2mtd_dev *add_device(
|
||||
|
||||
/* Setup the MTD structure */
|
||||
/* make the name contain the block device in */
|
||||
- name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname);
|
||||
+ if (!mtdname)
|
||||
+ mtdname = devname;
|
||||
+ name = kmalloc(strlen(mtdname) + 1, GFP_KERNEL);
|
||||
if (!name)
|
||||
goto devinit_err;
|
||||
|
||||
+ strcpy(name, mtdname);
|
||||
dev->mtd.name = name;
|
||||
|
||||
- dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
|
||||
+ dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK & ~(erase_size - 1);
|
||||
dev->mtd.erasesize = erase_size;
|
||||
dev->mtd.writesize = 1;
|
||||
dev->mtd.writebufsize = PAGE_SIZE;
|
||||
@@ -270,14 +275,17 @@ static struct block2mtd_dev *add_device(
|
||||
dev->mtd.priv = dev;
|
||||
dev->mtd.owner = THIS_MODULE;
|
||||
|
||||
- if (mtd_device_register(&dev->mtd, NULL, 0)) {
|
||||
+ part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL);
|
||||
+ part->name = name;
|
||||
+ part->offset = 0;
|
||||
+ part->size = dev->mtd.size;
|
||||
+ if (mtd_device_register(&dev->mtd, part, 1)) {
|
||||
/* Device didn't get added, so free the entry */
|
||||
goto devinit_err;
|
||||
}
|
||||
list_add(&dev->list, &blkmtd_device_list);
|
||||
INFO("mtd%d: [%s] erase_size = %dKiB [%d]", dev->mtd.index,
|
||||
- dev->mtd.name + strlen("block2mtd: "),
|
||||
- dev->mtd.erasesize >> 10, dev->mtd.erasesize);
|
||||
+ mtdname, dev->mtd.erasesize >> 10, dev->mtd.erasesize);
|
||||
return dev;
|
||||
|
||||
devinit_err:
|
||||
@@ -350,9 +358,9 @@ static char block2mtd_paramline[80 + 12]
|
||||
|
||||
static int block2mtd_setup2(const char *val)
|
||||
{
|
||||
- char buf[80 + 12]; /* 80 for device, 12 for erase size */
|
||||
+ char buf[80 + 12 + 80]; /* 80 for device, 12 for erase size, 80 for name */
|
||||
char *str = buf;
|
||||
- char *token[2];
|
||||
+ char *token[3];
|
||||
char *name;
|
||||
size_t erase_size = PAGE_SIZE;
|
||||
int i, ret;
|
||||
@@ -363,7 +371,7 @@ static int block2mtd_setup2(const char *
|
||||
strcpy(str, val);
|
||||
kill_final_newline(str);
|
||||
|
||||
- for (i = 0; i < 2; i++)
|
||||
+ for (i = 0; i < 3; i++)
|
||||
token[i] = strsep(&str, ",");
|
||||
|
||||
if (str)
|
||||
@@ -382,8 +390,10 @@ static int block2mtd_setup2(const char *
|
||||
parse_err("illegal erase size");
|
||||
}
|
||||
}
|
||||
+ if (token[2] && (strlen(token[2]) + 1 > 80))
|
||||
+ parse_err("mtd device name too long");
|
||||
|
||||
- add_device(name, erase_size);
|
||||
+ add_device(name, erase_size, token[2]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -417,7 +427,7 @@ static int block2mtd_setup(const char *v
|
||||
|
||||
|
||||
module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200);
|
||||
-MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,<erasesize>]\"");
|
||||
+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,<erasesize>[,<name>]]\"");
|
||||
|
||||
static int __init block2mtd_init(void)
|
||||
{
|
||||
--- a/block/partition-generic.c
|
||||
+++ b/block/partition-generic.c
|
||||
@@ -548,6 +548,7 @@ int invalidate_partitions(struct gendisk
|
||||
|
||||
return 0;
|
||||
}
|
||||
+EXPORT_SYMBOL(rescan_partitions);
|
||||
|
||||
unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p)
|
||||
{
|
@ -1,268 +0,0 @@
|
||||
--- a/drivers/mtd/devices/block2mtd.c
|
||||
+++ b/drivers/mtd/devices/block2mtd.c
|
||||
@@ -29,6 +29,8 @@ struct block2mtd_dev {
|
||||
struct block_device *blkdev;
|
||||
struct mtd_info mtd;
|
||||
struct mutex write_mutex;
|
||||
+ rwlock_t bdev_mutex;
|
||||
+ char devname[0];
|
||||
};
|
||||
|
||||
|
||||
@@ -79,6 +81,12 @@ static int block2mtd_erase(struct mtd_in
|
||||
size_t len = instr->len;
|
||||
int err;
|
||||
|
||||
+ read_lock(&dev->bdev_mutex);
|
||||
+ if (!dev->blkdev) {
|
||||
+ err = -EINVAL;
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
instr->state = MTD_ERASING;
|
||||
mutex_lock(&dev->write_mutex);
|
||||
err = _block2mtd_erase(dev, from, len);
|
||||
@@ -90,6 +98,10 @@ static int block2mtd_erase(struct mtd_in
|
||||
instr->state = MTD_ERASE_DONE;
|
||||
|
||||
mtd_erase_callback(instr);
|
||||
+
|
||||
+done:
|
||||
+ read_unlock(&dev->bdev_mutex);
|
||||
+
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -101,7 +113,13 @@ static int block2mtd_read(struct mtd_inf
|
||||
struct page *page;
|
||||
int index = from >> PAGE_SHIFT;
|
||||
int offset = from & (PAGE_SIZE-1);
|
||||
- int cpylen;
|
||||
+ int cpylen, err = 0;
|
||||
+
|
||||
+ read_lock(&dev->bdev_mutex);
|
||||
+ if (!dev->blkdev || (from > mtd->size)) {
|
||||
+ err = -EINVAL;
|
||||
+ goto done;
|
||||
+ }
|
||||
|
||||
while (len) {
|
||||
if ((offset + len) > PAGE_SIZE)
|
||||
@@ -111,8 +129,10 @@ static int block2mtd_read(struct mtd_inf
|
||||
len = len - cpylen;
|
||||
|
||||
page = page_read(dev->blkdev->bd_inode->i_mapping, index);
|
||||
- if (IS_ERR(page))
|
||||
+ if (IS_ERR(page)) {
|
||||
return PTR_ERR(page);
|
||||
+ goto done;
|
||||
+ }
|
||||
|
||||
memcpy(buf, page_address(page) + offset, cpylen);
|
||||
page_cache_release(page);
|
||||
@@ -123,7 +143,10 @@ static int block2mtd_read(struct mtd_inf
|
||||
offset = 0;
|
||||
index++;
|
||||
}
|
||||
- return 0;
|
||||
+
|
||||
+done:
|
||||
+ read_unlock(&dev->bdev_mutex);
|
||||
+ return err;
|
||||
}
|
||||
|
||||
|
||||
@@ -171,13 +194,22 @@ static int block2mtd_write(struct mtd_in
|
||||
size_t *retlen, const u_char *buf)
|
||||
{
|
||||
struct block2mtd_dev *dev = mtd->priv;
|
||||
- int err;
|
||||
+ int err = 0;
|
||||
+
|
||||
+ read_lock(&dev->bdev_mutex);
|
||||
+ if (!dev->blkdev) {
|
||||
+ err = -EINVAL;
|
||||
+ goto done;
|
||||
+ }
|
||||
|
||||
mutex_lock(&dev->write_mutex);
|
||||
err = _block2mtd_write(dev, buf, to, len, retlen);
|
||||
mutex_unlock(&dev->write_mutex);
|
||||
if (err > 0)
|
||||
err = 0;
|
||||
+
|
||||
+done:
|
||||
+ read_unlock(&dev->bdev_mutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -186,33 +218,110 @@ static int block2mtd_write(struct mtd_in
|
||||
static void block2mtd_sync(struct mtd_info *mtd)
|
||||
{
|
||||
struct block2mtd_dev *dev = mtd->priv;
|
||||
+ read_lock(&dev->bdev_mutex);
|
||||
+ if (dev->blkdev)
|
||||
sync_blockdev(dev->blkdev);
|
||||
+ read_unlock(&dev->bdev_mutex);
|
||||
+
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+static int _open_bdev(struct block2mtd_dev *dev)
|
||||
+{
|
||||
+ const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
|
||||
+ struct block_device *bdev;
|
||||
+
|
||||
+ /* Get a handle on the device */
|
||||
+ bdev = blkdev_get_by_path(dev->devname, mode, dev);
|
||||
+#ifndef MODULE
|
||||
+ if (IS_ERR(bdev)) {
|
||||
+ dev_t devt;
|
||||
+
|
||||
+ /* We might not have rootfs mounted at this point. Try
|
||||
+ to resolve the device name by other means. */
|
||||
+
|
||||
+ devt = name_to_dev_t(dev->devname);
|
||||
+ if (devt)
|
||||
+ bdev = blkdev_get_by_dev(devt, mode, dev);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ if (IS_ERR(bdev)) {
|
||||
+ ERROR("error: cannot open device %s", dev->devname);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ dev->blkdev = bdev;
|
||||
+
|
||||
+ if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
|
||||
+ ERROR("attempting to use an MTD device as a block device");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void _close_bdev(struct block2mtd_dev *dev)
|
||||
+{
|
||||
+ struct block_device *bdev;
|
||||
+
|
||||
+ if (!dev->blkdev)
|
||||
+ return;
|
||||
+
|
||||
+ bdev = dev->blkdev;
|
||||
+ invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping, 0, -1);
|
||||
+ blkdev_put(dev->blkdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
|
||||
+ dev->blkdev = NULL;
|
||||
+}
|
||||
+
|
||||
static void block2mtd_free_device(struct block2mtd_dev *dev)
|
||||
{
|
||||
if (!dev)
|
||||
return;
|
||||
|
||||
kfree(dev->mtd.name);
|
||||
-
|
||||
- if (dev->blkdev) {
|
||||
- invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping,
|
||||
- 0, -1);
|
||||
- blkdev_put(dev->blkdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
|
||||
- }
|
||||
-
|
||||
+ _close_bdev(dev);
|
||||
kfree(dev);
|
||||
}
|
||||
|
||||
|
||||
-/* FIXME: ensure that mtd->size % erase_size == 0 */
|
||||
-static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname)
|
||||
+static int block2mtd_refresh(struct mtd_info *mtd)
|
||||
{
|
||||
- const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
|
||||
+ struct block2mtd_dev *dev = mtd->priv;
|
||||
struct block_device *bdev;
|
||||
+ dev_t devt;
|
||||
+ int err = 0;
|
||||
+
|
||||
+ /* no other mtd function can run at this point */
|
||||
+ write_lock(&dev->bdev_mutex);
|
||||
+
|
||||
+ /* get the device number for the whole disk */
|
||||
+ devt = MKDEV(MAJOR(dev->blkdev->bd_dev), 0);
|
||||
+
|
||||
+ /* close the old block device */
|
||||
+ _close_bdev(dev);
|
||||
+
|
||||
+ /* open the whole disk, issue a partition rescan, then */
|
||||
+ bdev = blkdev_get_by_dev(devt, FMODE_WRITE | FMODE_READ, mtd);
|
||||
+ if (!bdev || !bdev->bd_disk)
|
||||
+ err = -EINVAL;
|
||||
+#ifndef CONFIG_MTD_BLOCK2MTD_MODULE
|
||||
+ else
|
||||
+ err = rescan_partitions(bdev->bd_disk, bdev);
|
||||
+#endif
|
||||
+ if (bdev)
|
||||
+ blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
|
||||
+
|
||||
+ /* try to open the partition block device again */
|
||||
+ _open_bdev(dev);
|
||||
+ write_unlock(&dev->bdev_mutex);
|
||||
+
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+/* FIXME: ensure that mtd->size % erase_size == 0 */
|
||||
+static struct block2mtd_dev *add_device(char *devname, int erase_size, char *mtdname)
|
||||
+{
|
||||
struct block2mtd_dev *dev;
|
||||
struct mtd_partition *part;
|
||||
char *name;
|
||||
@@ -220,36 +329,17 @@ static struct block2mtd_dev *add_device(
|
||||
if (!devname)
|
||||
return NULL;
|
||||
|
||||
- dev = kzalloc(sizeof(struct block2mtd_dev), GFP_KERNEL);
|
||||
+ dev = kzalloc(sizeof(struct block2mtd_dev) + strlen(devname) + 1, GFP_KERNEL);
|
||||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
- /* Get a handle on the device */
|
||||
- bdev = blkdev_get_by_path(devname, mode, dev);
|
||||
-#ifndef MODULE
|
||||
- if (IS_ERR(bdev)) {
|
||||
+ strcpy(dev->devname, devname);
|
||||
|
||||
- /* We might not have rootfs mounted at this point. Try
|
||||
- to resolve the device name by other means. */
|
||||
-
|
||||
- dev_t devt = name_to_dev_t(devname);
|
||||
- if (devt)
|
||||
- bdev = blkdev_get_by_dev(devt, mode, dev);
|
||||
- }
|
||||
-#endif
|
||||
-
|
||||
- if (IS_ERR(bdev)) {
|
||||
- ERROR("error: cannot open device %s", devname);
|
||||
- goto devinit_err;
|
||||
- }
|
||||
- dev->blkdev = bdev;
|
||||
-
|
||||
- if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
|
||||
- ERROR("attempting to use an MTD device as a block device");
|
||||
+ if (_open_bdev(dev))
|
||||
goto devinit_err;
|
||||
- }
|
||||
|
||||
mutex_init(&dev->write_mutex);
|
||||
+ rwlock_init(&dev->bdev_mutex);
|
||||
|
||||
/* Setup the MTD structure */
|
||||
/* make the name contain the block device in */
|
||||
@@ -274,6 +364,7 @@ static struct block2mtd_dev *add_device(
|
||||
dev->mtd._read = block2mtd_read;
|
||||
dev->mtd.priv = dev;
|
||||
dev->mtd.owner = THIS_MODULE;
|
||||
+ dev->mtd.refresh_device = block2mtd_refresh;
|
||||
|
||||
part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL);
|
||||
part->name = name;
|
@ -1,10 +0,0 @@
|
||||
--- a/drivers/mtd/devices/block2mtd.c
|
||||
+++ b/drivers/mtd/devices/block2mtd.c
|
||||
@@ -241,6 +241,7 @@ static int _open_bdev(struct block2mtd_d
|
||||
/* We might not have rootfs mounted at this point. Try
|
||||
to resolve the device name by other means. */
|
||||
|
||||
+ wait_for_device_probe();
|
||||
devt = name_to_dev_t(dev->devname);
|
||||
if (devt)
|
||||
bdev = blkdev_get_by_dev(devt, mode, dev);
|
@ -1,37 +0,0 @@
|
||||
---
|
||||
drivers/mtd/nand/plat_nand.c | 13 ++++++++++++-
|
||||
include/linux/mtd/nand.h | 1 +
|
||||
2 files changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/include/linux/mtd/nand.h
|
||||
+++ b/include/linux/mtd/nand.h
|
||||
@@ -640,6 +640,7 @@ struct platform_nand_chip {
|
||||
unsigned int options;
|
||||
unsigned int bbt_options;
|
||||
const char **part_probe_types;
|
||||
+ int (*chip_fixup)(struct mtd_info *mtd);
|
||||
};
|
||||
|
||||
/* Keep gcc happy */
|
||||
--- a/drivers/mtd/nand/plat_nand.c
|
||||
+++ b/drivers/mtd/nand/plat_nand.c
|
||||
@@ -103,7 +103,18 @@ static int __devinit plat_nand_probe(str
|
||||
}
|
||||
|
||||
/* Scan to find existence of the device */
|
||||
- if (nand_scan(&data->mtd, pdata->chip.nr_chips)) {
|
||||
+ if (nand_scan_ident(&data->mtd, pdata->chip.nr_chips, NULL)) {
|
||||
+ err = -ENXIO;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (pdata->chip.chip_fixup) {
|
||||
+ err = pdata->chip.chip_fixup(&data->mtd);
|
||||
+ if (err)
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (nand_scan_tail(&data->mtd)) {
|
||||
err = -ENXIO;
|
||||
goto out;
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
--- a/drivers/mtd/nand/nand_ecc.c
|
||||
+++ b/drivers/mtd/nand/nand_ecc.c
|
||||
@@ -507,8 +507,7 @@ int __nand_correct_data(unsigned char *b
|
||||
if ((bitsperbyte[b0] + bitsperbyte[b1] + bitsperbyte[b2]) == 1)
|
||||
return 1; /* error in ECC data; no action needed */
|
||||
|
||||
- printk(KERN_ERR "uncorrectable error : ");
|
||||
- return -1;
|
||||
+ return -EBADMSG;
|
||||
}
|
||||
EXPORT_SYMBOL(__nand_correct_data);
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||
@@ -762,7 +762,7 @@ static int get_chip(struct map_info *map
|
||||
return 0;
|
||||
|
||||
case FL_ERASING:
|
||||
- if (!cfip || !(cfip->EraseSuspend & (0x1|0x2)) ||
|
||||
+ if (1 /* no suspend */ || !cfip || !(cfip->EraseSuspend & (0x1|0x2)) ||
|
||||
!(mode == FL_READY || mode == FL_POINT ||
|
||||
(mode == FL_WRITING && (cfip->EraseSuspend & 0x2))))
|
||||
goto sleep;
|
@ -1,39 +0,0 @@
|
||||
--- a/drivers/mtd/devices/m25p80.c
|
||||
+++ b/drivers/mtd/devices/m25p80.c
|
||||
@@ -45,6 +45,7 @@
|
||||
#define OPCODE_BE_4K 0x20 /* Erase 4KiB block */
|
||||
#define OPCODE_BE_32K 0x52 /* Erase 32KiB block */
|
||||
#define OPCODE_CHIP_ERASE 0xc7 /* Erase whole flash chip */
|
||||
+#define OPCODE_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips*/
|
||||
#define OPCODE_SE 0xd8 /* Sector erase (usually 64KiB) */
|
||||
#define OPCODE_RDID 0x9f /* Read JEDEC ID */
|
||||
|
||||
@@ -594,6 +595,7 @@ struct flash_info {
|
||||
u16 flags;
|
||||
#define SECT_4K 0x01 /* OPCODE_BE_4K works uniformly */
|
||||
#define M25P_NO_ERASE 0x02 /* No erase command needed */
|
||||
+#define SECT_4K_PMC 0x04 /* OPCODE_BE_4K_PMC works uniformly */
|
||||
};
|
||||
|
||||
#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \
|
||||
@@ -671,6 +673,10 @@ static const struct spi_device_id m25p_i
|
||||
{ "n25q128", INFO(0x20ba18, 0, 64 * 1024, 256, 0) },
|
||||
{ "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K) },
|
||||
|
||||
+ /* PMC -- pm25x "blocks" are 32K, sectors are 4K */
|
||||
+ { "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) },
|
||||
+ { "pm25lv010", INFO(0, 0, 32 * 1024, 4, SECT_4K_PMC) },
|
||||
+
|
||||
/* Spansion -- single (large) sector size only, at least
|
||||
* for the chips listed here (without boot sectors).
|
||||
*/
|
||||
@@ -911,6 +917,9 @@ static int __devinit m25p_probe(struct s
|
||||
if (info->flags & SECT_4K) {
|
||||
flash->erase_opcode = OPCODE_BE_4K;
|
||||
flash->mtd.erasesize = 4096;
|
||||
+ } else if (info->flags & SECT_4K_PMC) {
|
||||
+ flash->erase_opcode = OPCODE_BE_4K_PMC;
|
||||
+ flash->mtd.erasesize = 4096;
|
||||
} else {
|
||||
flash->erase_opcode = OPCODE_SE;
|
||||
flash->mtd.erasesize = info->sector_size;
|
@ -1,10 +0,0 @@
|
||||
--- a/drivers/mtd/devices/m25p80.c
|
||||
+++ b/drivers/mtd/devices/m25p80.c
|
||||
@@ -755,6 +755,7 @@ static const struct spi_device_id m25p_i
|
||||
{ "w25x64", INFO(0xef3017, 0, 64 * 1024, 128, SECT_4K) },
|
||||
{ "w25q64", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) },
|
||||
{ "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) },
|
||||
+ { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },
|
||||
|
||||
/* Catalyst / On Semiconductor -- non-JEDEC */
|
||||
{ "cat25c11", CAT25_INFO( 16, 8, 16, 1) },
|
@ -1,10 +0,0 @@
|
||||
--- a/drivers/mtd/devices/m25p80.c
|
||||
+++ b/drivers/mtd/devices/m25p80.c
|
||||
@@ -676,6 +676,7 @@ static const struct spi_device_id m25p_i
|
||||
/* PMC -- pm25x "blocks" are 32K, sectors are 4K */
|
||||
{ "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) },
|
||||
{ "pm25lv010", INFO(0, 0, 32 * 1024, 4, SECT_4K_PMC) },
|
||||
+ { "pm25lq032", INFO(0x7F9D46, 0, 64 * 1024, 64, SECT_4K) },
|
||||
|
||||
/* Spansion -- single (large) sector size only, at least
|
||||
* for the chips listed here (without boot sectors).
|
@ -1,18 +0,0 @@
|
||||
From: George Kashperko <george@znau.edu.ua>
|
||||
|
||||
Issue map read after Write Buffer Load command to ensure chip is ready
|
||||
to receive data.
|
||||
Signed-off-by: George Kashperko <george@znau.edu.ua>
|
||||
---
|
||||
drivers/mtd/chips/cfi_cmdset_0002.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||
@@ -1480,6 +1480,7 @@ static int __xipram do_write_buffer(stru
|
||||
|
||||
/* Write Buffer Load */
|
||||
map_write(map, CMD(0x25), cmd_adr);
|
||||
+ (void) map_read(map, cmd_adr);
|
||||
|
||||
chip->state = FL_WRITING_TO_BUFFER;
|
||||
|
@ -1,41 +0,0 @@
|
||||
--- a/drivers/mtd/devices/Kconfig
|
||||
+++ b/drivers/mtd/devices/Kconfig
|
||||
@@ -110,6 +110,14 @@ config MTD_SPEAR_SMI
|
||||
help
|
||||
This enable SNOR support on SPEAR platforms using SMI controller
|
||||
|
||||
+config M25PXX_PREFER_SMALL_SECTOR_ERASE
|
||||
+ bool "Prefer small sector erase"
|
||||
+ depends on MTD_M25P80
|
||||
+ default y
|
||||
+ help
|
||||
+ This option enables use of the small erase sectors if that is
|
||||
+ supported by the flash chip.
|
||||
+
|
||||
config MTD_SST25L
|
||||
tristate "Support SST25L (non JEDEC) SPI Flash chips"
|
||||
depends on SPI_MASTER
|
||||
--- a/drivers/mtd/devices/m25p80.c
|
||||
+++ b/drivers/mtd/devices/m25p80.c
|
||||
@@ -84,6 +84,12 @@
|
||||
|
||||
#define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16)
|
||||
|
||||
+#ifdef CONFIG_M25PXX_PREFER_SMALL_SECTOR_ERASE
|
||||
+#define PREFER_SMALL_SECTOR_ERASE 1
|
||||
+#else
|
||||
+#define PREFER_SMALL_SECTOR_ERASE 0
|
||||
+#endif
|
||||
+
|
||||
/****************************************************************************/
|
||||
|
||||
struct m25p {
|
||||
@@ -916,7 +922,7 @@ static int __devinit m25p_probe(struct s
|
||||
flash->mtd._write = m25p80_write;
|
||||
|
||||
/* prefer "small sector" erase if possible */
|
||||
- if (info->flags & SECT_4K) {
|
||||
+ if (PREFER_SMALL_SECTOR_ERASE && (info->flags & SECT_4K)) {
|
||||
flash->erase_opcode = OPCODE_BE_4K;
|
||||
flash->mtd.erasesize = 4096;
|
||||
} else if (info->flags & SECT_4K_PMC) {
|
@ -1,18 +0,0 @@
|
||||
--- a/drivers/mtd/mtdpart.c
|
||||
+++ b/drivers/mtd/mtdpart.c
|
||||
@@ -330,7 +330,14 @@ static int part_lock(struct mtd_info *mt
|
||||
static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
|
||||
{
|
||||
struct mtd_part *part = PART(mtd);
|
||||
- return part->master->_unlock(part->master, ofs + part->offset, len);
|
||||
+
|
||||
+ ofs += part->offset;
|
||||
+ if (mtd->flags & MTD_ERASE_PARTIAL) {
|
||||
+ /* round up len to next erasesize and round down offset to prev block */
|
||||
+ len = (mtd_div_by_eb(len, part->master) + 1) * part->master->erasesize;
|
||||
+ ofs &= ~(part->master->erasesize - 1);
|
||||
+ }
|
||||
+ return part->master->_unlock(part->master, ofs, len);
|
||||
}
|
||||
|
||||
static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
|
@ -1,18 +0,0 @@
|
||||
--- a/fs/Kconfig
|
||||
+++ b/fs/Kconfig
|
||||
@@ -39,6 +39,7 @@ source "fs/gfs2/Kconfig"
|
||||
source "fs/ocfs2/Kconfig"
|
||||
source "fs/btrfs/Kconfig"
|
||||
source "fs/nilfs2/Kconfig"
|
||||
+source "fs/yaffs2/Kconfig"
|
||||
|
||||
endif # BLOCK
|
||||
|
||||
--- a/fs/Makefile
|
||||
+++ b/fs/Makefile
|
||||
@@ -127,3 +127,5 @@ obj-$(CONFIG_GFS2_FS) += gfs2/
|
||||
obj-y += exofs/ # Multiple modules
|
||||
obj-$(CONFIG_CEPH_FS) += ceph/
|
||||
obj-$(CONFIG_PSTORE) += pstore/
|
||||
+obj-$(CONFIG_YAFFS_FS) += yaffs2/
|
||||
+
|
@ -1,31 +0,0 @@
|
||||
From 2505e8b0a13d3d5c5bbeaaae4eb889864f44c9df Mon Sep 17 00:00:00 2001
|
||||
From: Charles Manning <cdhmanning@gmail.com>
|
||||
Date: Thu, 3 Feb 2011 05:55:30 +1300
|
||||
Subject: [PATCH] yaffs: Fix directory unlinking in yaffs1 mode
|
||||
|
||||
commit 964b3425a71890e6701c830e38b04d8557c04f49 upstream.
|
||||
|
||||
Treat both yaffs2 and yaffs1 paths the same.
|
||||
|
||||
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
|
||||
---
|
||||
yaffs_guts.c | 8 +-------
|
||||
1 file changed, 1 insertion(+), 7 deletions(-)
|
||||
|
||||
--- a/fs/yaffs2/yaffs_guts.c
|
||||
+++ b/fs/yaffs2/yaffs_guts.c
|
||||
@@ -1708,13 +1708,7 @@ static int yaffs_change_obj_name(yaffs_o
|
||||
YBUG();
|
||||
}
|
||||
|
||||
- /* TODO: Do we need this different handling for YAFFS2 and YAFFS1?? */
|
||||
- if (obj->my_dev->param.is_yaffs2)
|
||||
- unlinkOp = (new_dir == obj->my_dev->unlinked_dir);
|
||||
- else
|
||||
- unlinkOp = (new_dir == obj->my_dev->unlinked_dir
|
||||
- && obj->variant_type == YAFFS_OBJECT_TYPE_FILE);
|
||||
-
|
||||
+ unlinkOp = (new_dir == obj->my_dev->unlinked_dir);
|
||||
deleteOp = (new_dir == obj->my_dev->del_dir);
|
||||
|
||||
existingTarget = yaffs_find_by_name(new_dir, new_name);
|
@ -1,138 +0,0 @@
|
||||
From c0c289363e84c53b5872f7c0c5069045096dca07 Mon Sep 17 00:00:00 2001
|
||||
From: Charles Manning <cdhmanning@gmail.com>
|
||||
Date: Wed, 3 Nov 2010 16:01:12 +1300
|
||||
Subject: [PATCH] yaffs: Switch from semaphores to mutexes
|
||||
|
||||
commit 73c54aa8c1de3f61a4c211cd47431293a6092f18 upstream.
|
||||
|
||||
Mutex is faster and init_MUTEX has been deprecated, so we'll just switch
|
||||
to mutexes.
|
||||
|
||||
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
|
||||
---
|
||||
yaffs_linux.h | 2 +-
|
||||
yaffs_vfs.c | 24 ++++++++++++------------
|
||||
yaffs_vfs_multi.c | 26 +++++++++++++-------------
|
||||
3 files changed, 26 insertions(+), 26 deletions(-)
|
||||
|
||||
--- a/fs/yaffs2/yaffs_linux.h
|
||||
+++ b/fs/yaffs2/yaffs_linux.h
|
||||
@@ -25,7 +25,7 @@ struct yaffs_LinuxContext {
|
||||
struct super_block * superBlock;
|
||||
struct task_struct *bgThread; /* Background thread for this device */
|
||||
int bgRunning;
|
||||
- struct semaphore grossLock; /* Gross locking semaphore */
|
||||
+ struct mutex grossLock; /* Gross locking mutex*/
|
||||
__u8 *spareBuffer; /* For mtdif2 use. Don't know the size of the buffer
|
||||
* at compile time so we have to allocate it.
|
||||
*/
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -515,14 +515,14 @@ static unsigned yaffs_gc_control_callbac
|
||||
static void yaffs_gross_lock(yaffs_dev_t *dev)
|
||||
{
|
||||
T(YAFFS_TRACE_LOCK, (TSTR("yaffs locking %p\n"), current));
|
||||
- down(&(yaffs_dev_to_lc(dev)->grossLock));
|
||||
+ mutex_lock(&(yaffs_dev_to_lc(dev)->grossLock));
|
||||
T(YAFFS_TRACE_LOCK, (TSTR("yaffs locked %p\n"), current));
|
||||
}
|
||||
|
||||
static void yaffs_gross_unlock(yaffs_dev_t *dev)
|
||||
{
|
||||
T(YAFFS_TRACE_LOCK, (TSTR("yaffs unlocking %p\n"), current));
|
||||
- up(&(yaffs_dev_to_lc(dev)->grossLock));
|
||||
+ mutex_unlock(&(yaffs_dev_to_lc(dev)->grossLock));
|
||||
}
|
||||
|
||||
#ifdef YAFFS_COMPILE_EXPORTFS
|
||||
@@ -2542,7 +2542,7 @@ static void yaffs_read_inode(struct inod
|
||||
#endif
|
||||
|
||||
static YLIST_HEAD(yaffs_context_list);
|
||||
-struct semaphore yaffs_context_lock;
|
||||
+struct mutex yaffs_context_lock;
|
||||
|
||||
static void yaffs_put_super(struct super_block *sb)
|
||||
{
|
||||
@@ -2568,9 +2568,9 @@ static void yaffs_put_super(struct super
|
||||
|
||||
yaffs_gross_unlock(dev);
|
||||
|
||||
- down(&yaffs_context_lock);
|
||||
+ mutex_lock(&yaffs_context_lock);
|
||||
ylist_del_init(&(yaffs_dev_to_lc(dev)->contextList));
|
||||
- up(&yaffs_context_lock);
|
||||
+ mutex_unlock(&yaffs_context_lock);
|
||||
|
||||
if (yaffs_dev_to_lc(dev)->spareBuffer) {
|
||||
YFREE(yaffs_dev_to_lc(dev)->spareBuffer);
|
||||
@@ -3016,7 +3016,7 @@ static struct super_block *yaffs_interna
|
||||
param->skip_checkpt_rd = options.skip_checkpoint_read;
|
||||
param->skip_checkpt_wr = options.skip_checkpoint_write;
|
||||
|
||||
- down(&yaffs_context_lock);
|
||||
+ mutex_lock(&yaffs_context_lock);
|
||||
/* Get a mount id */
|
||||
found = 0;
|
||||
for(mount_id=0; ! found; mount_id++){
|
||||
@@ -3030,13 +3030,13 @@ static struct super_block *yaffs_interna
|
||||
context->mount_id = mount_id;
|
||||
|
||||
ylist_add_tail(&(yaffs_dev_to_lc(dev)->contextList), &yaffs_context_list);
|
||||
- up(&yaffs_context_lock);
|
||||
+ mutex_unlock(&yaffs_context_lock);
|
||||
|
||||
/* Directory search handling...*/
|
||||
YINIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->searchContexts));
|
||||
param->remove_obj_fn = yaffs_remove_obj_callback;
|
||||
|
||||
- init_MUTEX(&(yaffs_dev_to_lc(dev)->grossLock));
|
||||
+ mutex_init(&(yaffs_dev_to_lc(dev)->grossLock));
|
||||
|
||||
yaffs_gross_lock(dev);
|
||||
|
||||
@@ -3268,7 +3268,7 @@ static int yaffs_proc_read(char *page,
|
||||
else {
|
||||
step-=2;
|
||||
|
||||
- down(&yaffs_context_lock);
|
||||
+ mutex_lock(&yaffs_context_lock);
|
||||
|
||||
/* Locate and print the Nth entry. Order N-squared but N is small. */
|
||||
ylist_for_each(item, &yaffs_context_list) {
|
||||
@@ -3287,7 +3287,7 @@ static int yaffs_proc_read(char *page,
|
||||
|
||||
break;
|
||||
}
|
||||
- up(&yaffs_context_lock);
|
||||
+ mutex_unlock(&yaffs_context_lock);
|
||||
}
|
||||
|
||||
return buf - page < count ? buf - page : count;
|
||||
@@ -3301,7 +3301,7 @@ static int yaffs_stats_proc_read(char *p
|
||||
char *buf = page;
|
||||
int n = 0;
|
||||
|
||||
- down(&yaffs_context_lock);
|
||||
+ mutex_lock(&yaffs_context_lock);
|
||||
|
||||
/* Locate and print the Nth entry. Order N-squared but N is small. */
|
||||
ylist_for_each(item, &yaffs_context_list) {
|
||||
@@ -3317,7 +3317,7 @@ static int yaffs_stats_proc_read(char *p
|
||||
dev->bg_gcs, dev->oldest_dirty_gc_count,
|
||||
dev->n_obj, dev->n_tnodes);
|
||||
}
|
||||
- up(&yaffs_context_lock);
|
||||
+ mutex_unlock(&yaffs_context_lock);
|
||||
|
||||
|
||||
return buf - page < count ? buf - page : count;
|
||||
@@ -3494,7 +3494,7 @@ static int __init init_yaffs_fs(void)
|
||||
|
||||
|
||||
|
||||
- init_MUTEX(&yaffs_context_lock);
|
||||
+ mutex_init(&yaffs_context_lock);
|
||||
|
||||
/* Install the proc_fs entries */
|
||||
my_proc_entry = create_proc_entry("yaffs",
|
@ -1,72 +0,0 @@
|
||||
From cd6657c4bde20886b0805ea9f2cbac7ec25ac2e5 Mon Sep 17 00:00:00 2001
|
||||
From: Charles Manning <cdhmanning@gmail.com>
|
||||
Date: Tue, 30 Nov 2010 16:01:28 +1300
|
||||
Subject: [PATCH 1/2] yaffs: Replace yaffs_dir_llseek with Linux generic
|
||||
llseek
|
||||
|
||||
commit ed8188fb7659cfb65b5adbe154d143190ade0324 upstream.
|
||||
|
||||
There was not much point in having the yaffs version as it is
|
||||
functionally equivalent to the kernel one.
|
||||
|
||||
This also gets rid of using BKL in yaffs2.
|
||||
|
||||
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
|
||||
---
|
||||
yaffs_vfs.c | 30 +-----------------------------
|
||||
yaffs_vfs_multi.c | 30 +-----------------------------
|
||||
2 files changed, 2 insertions(+), 58 deletions(-)
|
||||
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -342,8 +342,6 @@ static int yaffs_follow_link(struct dent
|
||||
|
||||
static void yaffs_touch_super(yaffs_dev_t *dev);
|
||||
|
||||
-static loff_t yaffs_dir_llseek(struct file *file, loff_t offset, int origin);
|
||||
-
|
||||
static int yaffs_vfs_setattr(struct inode *, struct iattr *);
|
||||
|
||||
|
||||
@@ -460,7 +458,7 @@ static const struct file_operations yaff
|
||||
.read = generic_read_dir,
|
||||
.readdir = yaffs_readdir,
|
||||
.fsync = yaffs_sync_object,
|
||||
- .llseek = yaffs_dir_llseek,
|
||||
+ .llseek = generic_file_llseek,
|
||||
};
|
||||
|
||||
static const struct super_operations yaffs_super_ops = {
|
||||
@@ -1534,32 +1532,6 @@ static void yaffs_release_space(struct f
|
||||
}
|
||||
|
||||
|
||||
-static loff_t yaffs_dir_llseek(struct file *file, loff_t offset, int origin)
|
||||
-{
|
||||
- long long retval;
|
||||
-
|
||||
- lock_kernel();
|
||||
-
|
||||
- switch (origin){
|
||||
- case 2:
|
||||
- offset += i_size_read(file->f_path.dentry->d_inode);
|
||||
- break;
|
||||
- case 1:
|
||||
- offset += file->f_pos;
|
||||
- }
|
||||
- retval = -EINVAL;
|
||||
-
|
||||
- if (offset >= 0){
|
||||
- if (offset != file->f_pos)
|
||||
- file->f_pos = offset;
|
||||
-
|
||||
- retval = offset;
|
||||
- }
|
||||
- unlock_kernel();
|
||||
- return retval;
|
||||
-}
|
||||
-
|
||||
-
|
||||
static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
|
||||
{
|
||||
yaffs_obj_t *obj;
|
@ -1,110 +0,0 @@
|
||||
From e1537a700c2e750c5eacc5ad93f30821f1e94424 Mon Sep 17 00:00:00 2001
|
||||
From: Charles Manning <cdhmanning@gmail.com>
|
||||
Date: Mon, 15 Aug 2011 11:40:30 +1200
|
||||
Subject: [PATCH 2/2] Mods for Linux 3.0 and fix a typo
|
||||
|
||||
commit a7b5dcf904ba6f7890e4b77ce1f56388b855d0f6 upstream.
|
||||
|
||||
Roll in NCB's patch and some other changes for Linux 3.0.
|
||||
Also fix a dumb type retired_writes->retried_writes
|
||||
|
||||
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
|
||||
---
|
||||
patch-ker.sh | 2 +-
|
||||
yaffs_vfs_glue.c | 42 ++++++++++++++++++++++++++++++++++--------
|
||||
2 files changed, 35 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -72,7 +72,9 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/proc_fs.h>
|
||||
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39))
|
||||
#include <linux/smp_lock.h>
|
||||
+#endif
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/interrupt.h>
|
||||
@@ -236,7 +238,9 @@ static int yaffs_file_flush(struct file
|
||||
static int yaffs_file_flush(struct file *file);
|
||||
#endif
|
||||
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
|
||||
+static int yaffs_sync_object(struct file *file, loff_t start, loff_t end, int datasync);
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
|
||||
static int yaffs_sync_object(struct file *file, int datasync);
|
||||
#else
|
||||
static int yaffs_sync_object(struct file *file, struct dentry *dentry,
|
||||
@@ -1864,7 +1868,9 @@ static int yaffs_symlink(struct inode *d
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
|
||||
+static int yaffs_sync_object(struct file *file, loff_t start, loff_t end, int datasync)
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
|
||||
static int yaffs_sync_object(struct file *file, int datasync)
|
||||
#else
|
||||
static int yaffs_sync_object(struct file *file, struct dentry *dentry,
|
||||
@@ -3067,7 +3073,13 @@ static int yaffs_internal_read_super_mtd
|
||||
return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL;
|
||||
}
|
||||
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
|
||||
+static struct dentry *yaffs_mount(struct file_system_type *fs_type, int flags,
|
||||
+ const char *dev_name, void *data)
|
||||
+{
|
||||
+ return mount_bdev(fs_type, flags, dev_name, data, yaffs_internal_read_super_mtd);
|
||||
+}
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
|
||||
static int yaffs_read_super(struct file_system_type *fs,
|
||||
int flags, const char *dev_name,
|
||||
void *data, struct vfsmount *mnt)
|
||||
@@ -3090,8 +3102,12 @@ static struct super_block *yaffs_read_su
|
||||
static struct file_system_type yaffs_fs_type = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "yaffs",
|
||||
- .get_sb = yaffs_read_super,
|
||||
- .kill_sb = kill_block_super,
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
|
||||
+ .mount = yaffs_mount,
|
||||
+#else
|
||||
+ .get_sb = yaffs_read_super,
|
||||
+#endif
|
||||
+ .kill_sb = kill_block_super,
|
||||
.fs_flags = FS_REQUIRES_DEV,
|
||||
};
|
||||
#else
|
||||
@@ -3115,7 +3131,13 @@ static int yaffs2_internal_read_super_mt
|
||||
return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL;
|
||||
}
|
||||
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
|
||||
+static struct dentry *yaffs2_mount(struct file_system_type *fs_type, int flags,
|
||||
+ const char *dev_name, void *data)
|
||||
+{
|
||||
+ return mount_bdev(fs_type, flags, dev_name, data, yaffs2_internal_read_super_mtd);
|
||||
+}
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
|
||||
static int yaffs2_read_super(struct file_system_type *fs,
|
||||
int flags, const char *dev_name, void *data,
|
||||
struct vfsmount *mnt)
|
||||
@@ -3137,8 +3159,12 @@ static struct super_block *yaffs2_read_s
|
||||
static struct file_system_type yaffs2_fs_type = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "yaffs2",
|
||||
- .get_sb = yaffs2_read_super,
|
||||
- .kill_sb = kill_block_super,
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
|
||||
+ .mount = yaffs2_mount,
|
||||
+#else
|
||||
+ .get_sb = yaffs2_read_super,
|
||||
+#endif
|
||||
+ .kill_sb = kill_block_super,
|
||||
.fs_flags = FS_REQUIRES_DEV,
|
||||
};
|
||||
#else
|
@ -1,54 +0,0 @@
|
||||
--- a/fs/yaffs2/yaffs_mtdif1.c
|
||||
+++ b/fs/yaffs2/yaffs_mtdif1.c
|
||||
@@ -127,7 +127,7 @@ int nandmtd1_WriteChunkWithTagsToNAND(ya
|
||||
#endif
|
||||
|
||||
memset(&ops, 0, sizeof(ops));
|
||||
- ops.mode = MTD_OOB_AUTO;
|
||||
+ ops.mode = MTD_OPS_AUTO_OOB;
|
||||
ops.len = (data) ? chunkBytes : 0;
|
||||
ops.ooblen = YTAG1_SIZE;
|
||||
ops.datbuf = (__u8 *)data;
|
||||
@@ -179,7 +179,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y
|
||||
int deleted;
|
||||
|
||||
memset(&ops, 0, sizeof(ops));
|
||||
- ops.mode = MTD_OOB_AUTO;
|
||||
+ ops.mode = MTD_OPS_AUTO_OOB;
|
||||
ops.len = (data) ? chunkBytes : 0;
|
||||
ops.ooblen = YTAG1_SIZE;
|
||||
ops.datbuf = data;
|
||||
--- a/fs/yaffs2/yaffs_mtdif2.c
|
||||
+++ b/fs/yaffs2/yaffs_mtdif2.c
|
||||
@@ -71,7 +71,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(ya
|
||||
yaffs_PackTags2(&pt, tags, !dev->param.no_tags_ecc);
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
|
||||
- ops.mode = MTD_OOB_AUTO;
|
||||
+ ops.mode = MTD_OPS_AUTO_OOB;
|
||||
ops.ooblen = (dev->param.inband_tags) ? 0 : packed_tags_size;
|
||||
ops.len = dev->param.total_bytes_per_chunk;
|
||||
ops.ooboffs = 0;
|
||||
@@ -136,7 +136,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y
|
||||
retval = mtd->read(mtd, addr, dev->param.total_bytes_per_chunk,
|
||||
&dummy, data);
|
||||
else if (tags) {
|
||||
- ops.mode = MTD_OOB_AUTO;
|
||||
+ ops.mode = MTD_OPS_AUTO_OOB;
|
||||
ops.ooblen = packed_tags_size;
|
||||
ops.len = data ? dev->data_bytes_per_chunk : packed_tags_size;
|
||||
ops.ooboffs = 0;
|
||||
--- a/fs/yaffs2/yaffs_mtdif.h
|
||||
+++ b/fs/yaffs2/yaffs_mtdif.h
|
||||
@@ -24,4 +24,11 @@ extern struct nand_oobinfo yaffs_noeccin
|
||||
#endif
|
||||
int nandmtd_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber);
|
||||
int nandmtd_InitialiseNAND(yaffs_dev_t *dev);
|
||||
+
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
|
||||
+#include <mtd/mtd-abi.h>
|
||||
+#else
|
||||
+#define MTD_OPS_AUTO_OOB MTD_OOB_AUTO
|
||||
+#endif
|
||||
+
|
||||
#endif
|
@ -1,78 +0,0 @@
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -220,6 +220,29 @@ static struct inode *yaffs_iget(struct s
|
||||
#define yaffs_SuperToDevice(sb) ((yaffs_dev_t *)sb->u.generic_sbp)
|
||||
#endif
|
||||
|
||||
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0))
|
||||
+static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink)
|
||||
+{
|
||||
+ set_nlink(inode, nlink);
|
||||
+}
|
||||
+
|
||||
+static inline void yaffs_dec_link_count(struct inode *inode)
|
||||
+{
|
||||
+ inode_dec_link_count(inode);
|
||||
+}
|
||||
+#else
|
||||
+static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink)
|
||||
+{
|
||||
+ inode->i_nlink = nlink;
|
||||
+}
|
||||
+
|
||||
+static inline void yaffs_dec_link_count(struct inode *inode)
|
||||
+{
|
||||
+ inode->i_nlink--;
|
||||
+ mark_inode_dirty(inode)
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
|
||||
#define update_dir_time(dir) do {\
|
||||
(dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \
|
||||
@@ -1362,7 +1385,7 @@ static void yaffs_fill_inode_from_obj(st
|
||||
inode->i_size = yaffs_get_obj_length(obj);
|
||||
inode->i_blocks = (inode->i_size + 511) >> 9;
|
||||
|
||||
- inode->i_nlink = yaffs_get_obj_link_count(obj);
|
||||
+ yaffs_set_nlink(inode, yaffs_get_obj_link_count(obj));
|
||||
|
||||
T(YAFFS_TRACE_OS,
|
||||
(TSTR("yaffs_fill_inode mode %x uid %d gid %d size %d count %d\n"),
|
||||
@@ -1784,10 +1807,9 @@ static int yaffs_unlink(struct inode *di
|
||||
retVal = yaffs_unlinker(obj, dentry->d_name.name);
|
||||
|
||||
if (retVal == YAFFS_OK) {
|
||||
- dentry->d_inode->i_nlink--;
|
||||
+ yaffs_dec_link_count(dentry->d_inode);
|
||||
dir->i_version++;
|
||||
yaffs_gross_unlock(dev);
|
||||
- mark_inode_dirty(dentry->d_inode);
|
||||
update_dir_time(dir);
|
||||
return 0;
|
||||
}
|
||||
@@ -1818,7 +1840,8 @@ static int yaffs_link(struct dentry *old
|
||||
obj);
|
||||
|
||||
if (link) {
|
||||
- old_dentry->d_inode->i_nlink = yaffs_get_obj_link_count(obj);
|
||||
+ yaffs_set_nlink(old_dentry->d_inode,
|
||||
+ yaffs_get_obj_link_count(obj));
|
||||
d_instantiate(dentry, old_dentry->d_inode);
|
||||
atomic_inc(&old_dentry->d_inode->i_count);
|
||||
T(YAFFS_TRACE_OS,
|
||||
@@ -1937,11 +1960,9 @@ static int yaffs_rename(struct inode *ol
|
||||
yaffs_gross_unlock(dev);
|
||||
|
||||
if (retVal == YAFFS_OK) {
|
||||
- if (target) {
|
||||
- new_dentry->d_inode->i_nlink--;
|
||||
- mark_inode_dirty(new_dentry->d_inode);
|
||||
- }
|
||||
-
|
||||
+ if (target)
|
||||
+ yaffs_dec_link_count(new_dentry->d_inode);
|
||||
+
|
||||
update_dir_time(old_dir);
|
||||
if(old_dir != new_dir)
|
||||
update_dir_time(new_dir);
|
@ -1,71 +0,0 @@
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -273,8 +273,13 @@ static int yaffs_sync_object(struct file
|
||||
static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir);
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
+static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
+ struct nameidata *n);
|
||||
+#else
|
||||
static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode,
|
||||
struct nameidata *n);
|
||||
+#endif
|
||||
static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
|
||||
struct nameidata *n);
|
||||
#else
|
||||
@@ -286,9 +291,17 @@ static int yaffs_link(struct dentry *old
|
||||
static int yaffs_unlink(struct inode *dir, struct dentry *dentry);
|
||||
static int yaffs_symlink(struct inode *dir, struct dentry *dentry,
|
||||
const char *symname);
|
||||
+
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
+static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
|
||||
+#else
|
||||
static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode);
|
||||
+#endif
|
||||
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
+static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
+ dev_t dev);
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
|
||||
dev_t dev);
|
||||
#else
|
||||
@@ -1679,7 +1692,10 @@ out:
|
||||
#define YCRED(x) (x->cred)
|
||||
#endif
|
||||
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
+static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
+ dev_t rdev)
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
|
||||
dev_t rdev)
|
||||
#else
|
||||
@@ -1769,7 +1785,11 @@ static int yaffs_mknod(struct inode *dir
|
||||
return error;
|
||||
}
|
||||
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
+static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
|
||||
+#else
|
||||
static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
|
||||
+#endif
|
||||
{
|
||||
int retVal;
|
||||
T(YAFFS_TRACE_OS, (TSTR("yaffs_mkdir\n")));
|
||||
@@ -1777,7 +1797,10 @@ static int yaffs_mkdir(struct inode *dir
|
||||
return retVal;
|
||||
}
|
||||
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
+static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
+ struct nameidata *n)
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode,
|
||||
struct nameidata *n)
|
||||
#else
|
@ -1,160 +0,0 @@
|
||||
--- a/fs/yaffs2/yaffs_mtdif1.c
|
||||
+++ b/fs/yaffs2/yaffs_mtdif1.c
|
||||
@@ -133,7 +133,7 @@ int nandmtd1_WriteChunkWithTagsToNAND(ya
|
||||
ops.datbuf = (__u8 *)data;
|
||||
ops.oobbuf = (__u8 *)&pt1;
|
||||
|
||||
- retval = mtd->write_oob(mtd, addr, &ops);
|
||||
+ retval = mtd_write_oob(mtd, addr, &ops);
|
||||
if (retval) {
|
||||
T(YAFFS_TRACE_MTD,
|
||||
(TSTR("write_oob failed, chunk %d, mtd error %d"TENDSTR),
|
||||
@@ -194,7 +194,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y
|
||||
/* Read page and oob using MTD.
|
||||
* Check status and determine ECC result.
|
||||
*/
|
||||
- retval = mtd->read_oob(mtd, addr, &ops);
|
||||
+ retval = mtd_read_oob(mtd, addr, &ops);
|
||||
if (retval) {
|
||||
T(YAFFS_TRACE_MTD,
|
||||
(TSTR("read_oob failed, chunk %d, mtd error %d"TENDSTR),
|
||||
@@ -218,7 +218,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y
|
||||
/* fall into... */
|
||||
default:
|
||||
rettags(etags, YAFFS_ECC_RESULT_UNFIXED, 0);
|
||||
- etags->block_bad = (mtd->block_isbad)(mtd, addr);
|
||||
+ etags->block_bad = mtd_block_isbad(mtd, addr);
|
||||
return YAFFS_FAIL;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ int nandmtd1_MarkNANDBlockBad(struct yaf
|
||||
|
||||
T(YAFFS_TRACE_BAD_BLOCKS,(TSTR("marking block %d bad"TENDSTR), block_no));
|
||||
|
||||
- retval = mtd->block_markbad(mtd, (loff_t)blocksize * block_no);
|
||||
+ retval = mtd_block_markbad(mtd, (loff_t)blocksize * block_no);
|
||||
return (retval) ? YAFFS_FAIL : YAFFS_OK;
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ int nandmtd1_QueryNANDBlock(struct yaffs
|
||||
return YAFFS_FAIL;
|
||||
|
||||
retval = nandmtd1_ReadChunkWithTagsFromNAND(dev, chunkNo, NULL, &etags);
|
||||
- etags.block_bad = (mtd->block_isbad)(mtd, addr);
|
||||
+ etags.block_bad = mtd_block_isbad(mtd, addr);
|
||||
if (etags.block_bad) {
|
||||
T(YAFFS_TRACE_BAD_BLOCKS,
|
||||
(TSTR("block %d is marked bad"TENDSTR), block_no));
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -2607,8 +2607,8 @@ static void yaffs_MTDPutSuper(struct sup
|
||||
{
|
||||
struct mtd_info *mtd = yaffs_dev_to_mtd(yaffs_SuperToDevice(sb));
|
||||
|
||||
- if (mtd->sync)
|
||||
- mtd->sync(mtd);
|
||||
+ if (mtd)
|
||||
+ mtd_sync(mtd);
|
||||
|
||||
put_mtd_device(mtd);
|
||||
}
|
||||
--- a/fs/yaffs2/yaffs_mtdif2.c
|
||||
+++ b/fs/yaffs2/yaffs_mtdif2.c
|
||||
@@ -77,7 +77,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(ya
|
||||
ops.ooboffs = 0;
|
||||
ops.datbuf = (__u8 *)data;
|
||||
ops.oobbuf = (dev->param.inband_tags) ? NULL : packed_tags_ptr;
|
||||
- retval = mtd->write_oob(mtd, addr, &ops);
|
||||
+ retval = mtd_write_oob(mtd, addr, &ops);
|
||||
|
||||
#else
|
||||
if (!dev->param.inband_tags) {
|
||||
@@ -133,7 +133,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
|
||||
if (dev->param.inband_tags || (data && !tags))
|
||||
- retval = mtd->read(mtd, addr, dev->param.total_bytes_per_chunk,
|
||||
+ retval = mtd_read(mtd, addr, dev->param.total_bytes_per_chunk,
|
||||
&dummy, data);
|
||||
else if (tags) {
|
||||
ops.mode = MTD_OPS_AUTO_OOB;
|
||||
@@ -142,7 +142,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y
|
||||
ops.ooboffs = 0;
|
||||
ops.datbuf = data;
|
||||
ops.oobbuf = yaffs_dev_to_lc(dev)->spareBuffer;
|
||||
- retval = mtd->read_oob(mtd, addr, &ops);
|
||||
+ retval = mtd_read_oob(mtd, addr, &ops);
|
||||
}
|
||||
#else
|
||||
if (!dev->param.inband_tags && data && tags) {
|
||||
@@ -201,7 +201,7 @@ int nandmtd2_MarkNANDBlockBad(struct yaf
|
||||
(TSTR("nandmtd2_MarkNANDBlockBad %d" TENDSTR), block_no));
|
||||
|
||||
retval =
|
||||
- mtd->block_markbad(mtd,
|
||||
+ mtd_block_markbad(mtd,
|
||||
block_no * dev->param.chunks_per_block *
|
||||
dev->param.total_bytes_per_chunk);
|
||||
|
||||
@@ -221,7 +221,7 @@ int nandmtd2_QueryNANDBlock(struct yaffs
|
||||
T(YAFFS_TRACE_MTD,
|
||||
(TSTR("nandmtd2_QueryNANDBlock %d" TENDSTR), block_no));
|
||||
retval =
|
||||
- mtd->block_isbad(mtd,
|
||||
+ mtd_block_isbad(mtd,
|
||||
block_no * dev->param.chunks_per_block *
|
||||
dev->param.total_bytes_per_chunk);
|
||||
|
||||
--- a/fs/yaffs2/yaffs_mtdif.h
|
||||
+++ b/fs/yaffs2/yaffs_mtdif.h
|
||||
@@ -31,4 +31,39 @@ int nandmtd_InitialiseNAND(yaffs_dev_t *
|
||||
#define MTD_OPS_AUTO_OOB MTD_OOB_AUTO
|
||||
#endif
|
||||
|
||||
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0))
|
||||
+static inline int mtd_erase(struct mdt_info *mtd, struct erase_info *ei)
|
||||
+{
|
||||
+ return mtd->erase(mtd, ei);
|
||||
+}
|
||||
+
|
||||
+static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs)
|
||||
+{
|
||||
+ return mtd->block_mark_bad(mtd, ofs);
|
||||
+}
|
||||
+
|
||||
+static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs)
|
||||
+{
|
||||
+ return mtd->block_is_bad(mtd, ofs);
|
||||
+}
|
||||
+
|
||||
+static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from,
|
||||
+ struct mtd_oob_ops *ops)
|
||||
+{
|
||||
+ return mtd->read_oob(mtd, from, ops);
|
||||
+}
|
||||
+
|
||||
+static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
|
||||
+ struct mtd_oob_ops *ops)
|
||||
+{
|
||||
+ return mtd->write_oob(mtd, to, ops);
|
||||
+}
|
||||
+
|
||||
+static inline void mtd_sync(struct mtd_info *mtd)
|
||||
+{
|
||||
+ if (mtd->sync)
|
||||
+ mtd->sync(mtd);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#endif
|
||||
--- a/fs/yaffs2/yaffs_mtdif.c
|
||||
+++ b/fs/yaffs2/yaffs_mtdif.c
|
||||
@@ -41,7 +41,7 @@ int nandmtd_EraseBlockInNAND(yaffs_dev_t
|
||||
ei.callback = NULL;
|
||||
ei.priv = (u_long) dev;
|
||||
|
||||
- retval = mtd->erase(mtd, &ei);
|
||||
+ retval = mtd_erase(mtd, &ei);
|
||||
|
||||
if (retval == 0)
|
||||
return YAFFS_OK;
|
@ -1,72 +0,0 @@
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -2793,6 +2793,15 @@ static struct super_block *yaffs_interna
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
|
||||
+ T(YAFFS_TRACE_OS, (TSTR(" erase %p\n"), mtd->_erase));
|
||||
+ T(YAFFS_TRACE_OS, (TSTR(" read %p\n"), mtd->_read));
|
||||
+ T(YAFFS_TRACE_OS, (TSTR(" write %p\n"), mtd->_write));
|
||||
+ T(YAFFS_TRACE_OS, (TSTR(" readoob %p\n"), mtd->_read_oob));
|
||||
+ T(YAFFS_TRACE_OS, (TSTR(" writeoob %p\n"), mtd->_write_oob));
|
||||
+ T(YAFFS_TRACE_OS, (TSTR(" block_isbad %p\n"), mtd->_block_isbad));
|
||||
+ T(YAFFS_TRACE_OS, (TSTR(" block_markbad %p\n"), mtd->_block_markbad));
|
||||
+#else
|
||||
T(YAFFS_TRACE_OS, (TSTR(" erase %p\n"), mtd->erase));
|
||||
T(YAFFS_TRACE_OS, (TSTR(" read %p\n"), mtd->read));
|
||||
T(YAFFS_TRACE_OS, (TSTR(" write %p\n"), mtd->write));
|
||||
@@ -2800,6 +2809,7 @@ static struct super_block *yaffs_interna
|
||||
T(YAFFS_TRACE_OS, (TSTR(" writeoob %p\n"), mtd->write_oob));
|
||||
T(YAFFS_TRACE_OS, (TSTR(" block_isbad %p\n"), mtd->block_isbad));
|
||||
T(YAFFS_TRACE_OS, (TSTR(" block_markbad %p\n"), mtd->block_markbad));
|
||||
+#endif
|
||||
T(YAFFS_TRACE_OS, (TSTR(" %s %d\n"), WRITE_SIZE_STR, WRITE_SIZE(mtd)));
|
||||
T(YAFFS_TRACE_OS, (TSTR(" oobsize %d\n"), mtd->oobsize));
|
||||
T(YAFFS_TRACE_OS, (TSTR(" erasesize %d\n"), mtd->erasesize));
|
||||
@@ -2828,6 +2838,15 @@ static struct super_block *yaffs_interna
|
||||
|
||||
if (yaffs_version == 2) {
|
||||
/* Check for version 2 style functions */
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
|
||||
+ if (!mtd->_erase ||
|
||||
+ !mtd->_block_isbad ||
|
||||
+ !mtd->_block_markbad ||
|
||||
+ !mtd->_read ||
|
||||
+ !mtd->_write ||
|
||||
+ !mtd->_read_oob ||
|
||||
+ !mtd->_write_oob) {
|
||||
+#else
|
||||
if (!mtd->erase ||
|
||||
!mtd->block_isbad ||
|
||||
!mtd->block_markbad ||
|
||||
@@ -2839,6 +2858,7 @@ static struct super_block *yaffs_interna
|
||||
!mtd->write_ecc ||
|
||||
!mtd->read_ecc || !mtd->read_oob || !mtd->write_oob) {
|
||||
#endif
|
||||
+#endif
|
||||
T(YAFFS_TRACE_ALWAYS,
|
||||
(TSTR("yaffs: MTD device does not support required "
|
||||
"functions\n")));
|
||||
@@ -2855,6 +2875,13 @@ static struct super_block *yaffs_interna
|
||||
}
|
||||
} else {
|
||||
/* Check for V1 style functions */
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
|
||||
+ if (!mtd->_erase ||
|
||||
+ !mtd->_read ||
|
||||
+ !mtd->_write ||
|
||||
+ !mtd->_read_oob ||
|
||||
+ !mtd->_write_oob) {
|
||||
+#else
|
||||
if (!mtd->erase ||
|
||||
!mtd->read ||
|
||||
!mtd->write ||
|
||||
@@ -2864,6 +2891,7 @@ static struct super_block *yaffs_interna
|
||||
!mtd->write_ecc ||
|
||||
!mtd->read_ecc || !mtd->read_oob || !mtd->write_oob) {
|
||||
#endif
|
||||
+#endif
|
||||
T(YAFFS_TRACE_ALWAYS,
|
||||
(TSTR("yaffs: MTD device does not support required "
|
||||
"functions\n")));
|
@ -1,14 +0,0 @@
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -3119,7 +3119,11 @@ static struct super_block *yaffs_interna
|
||||
|
||||
T(YAFFS_TRACE_OS, (TSTR("yaffs_read_super: got root inode\n")));
|
||||
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
|
||||
+ root = d_make_root(inode);
|
||||
+#else
|
||||
root = d_alloc_root(inode);
|
||||
+#endif
|
||||
|
||||
T(YAFFS_TRACE_OS, (TSTR("yaffs_read_super: d_alloc_root done\n")));
|
||||
|
@ -1,15 +0,0 @@
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -924,7 +924,11 @@ static void yaffs_evict_inode( struct in
|
||||
if (!inode->i_nlink && !is_bad_inode(inode))
|
||||
deleteme = 1;
|
||||
truncate_inode_pages(&inode->i_data,0);
|
||||
- end_writeback(inode);
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
|
||||
+ clear_inode(inode);
|
||||
+#else
|
||||
+ end_writeback(inode);
|
||||
+#endif
|
||||
|
||||
if(deleteme && obj){
|
||||
dev = obj->my_dev;
|
@ -1,570 +0,0 @@
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -243,11 +243,10 @@ static inline void yaffs_dec_link_count(
|
||||
}
|
||||
#endif
|
||||
|
||||
-
|
||||
#define update_dir_time(dir) do {\
|
||||
(dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \
|
||||
} while(0)
|
||||
-
|
||||
+
|
||||
static void yaffs_put_super(struct super_block *sb);
|
||||
|
||||
static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n,
|
||||
@@ -397,6 +396,33 @@ static struct address_space_operations y
|
||||
#endif
|
||||
};
|
||||
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0))
|
||||
+#define YCRED_FSUID() from_kuid(&init_user_ns, current_fsuid())
|
||||
+#define YCRED_FSGID() from_kgid(&init_user_ns, current_fsgid())
|
||||
+#else
|
||||
+#define YCRED_FSUID() YCRED(current)->fsuid
|
||||
+#define YCRED_FSGID() YCRED(current)->fsgid
|
||||
+
|
||||
+static inline uid_t i_uid_read(const struct inode *inode)
|
||||
+{
|
||||
+ return inode->i_uid;
|
||||
+}
|
||||
+
|
||||
+static inline gid_t i_gid_read(const struct inode *inode)
|
||||
+{
|
||||
+ return inode->i_gid;
|
||||
+}
|
||||
+
|
||||
+static inline void i_uid_write(struct inode *inode, uid_t uid)
|
||||
+{
|
||||
+ inode->i_uid = uid;
|
||||
+}
|
||||
+
|
||||
+static inline void i_gid_write(struct inode *inode, gid_t gid)
|
||||
+{
|
||||
+ inode->i_gid = gid;
|
||||
+}
|
||||
+#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22))
|
||||
static const struct file_operations yaffs_file_operations = {
|
||||
@@ -549,7 +575,7 @@ static unsigned yaffs_gc_control_callbac
|
||||
{
|
||||
return yaffs_gc_control;
|
||||
}
|
||||
-
|
||||
+
|
||||
static void yaffs_gross_lock(yaffs_dev_t *dev)
|
||||
{
|
||||
T(YAFFS_TRACE_LOCK, (TSTR("yaffs locking %p\n"), current));
|
||||
@@ -1379,8 +1405,8 @@ static void yaffs_fill_inode_from_obj(st
|
||||
|
||||
inode->i_ino = obj->obj_id;
|
||||
inode->i_mode = obj->yst_mode;
|
||||
- inode->i_uid = obj->yst_uid;
|
||||
- inode->i_gid = obj->yst_gid;
|
||||
+ i_uid_write(inode, obj->yst_uid);
|
||||
+ i_gid_write(inode, obj->yst_gid);
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
|
||||
inode->i_blksize = inode->i_sb->s_blocksize;
|
||||
#endif
|
||||
@@ -1406,7 +1432,7 @@ static void yaffs_fill_inode_from_obj(st
|
||||
|
||||
T(YAFFS_TRACE_OS,
|
||||
(TSTR("yaffs_fill_inode mode %x uid %d gid %d size %d count %d\n"),
|
||||
- inode->i_mode, inode->i_uid, inode->i_gid,
|
||||
+ inode->i_mode, i_uid_read(inode), i_gid_read(inode),
|
||||
(int)inode->i_size, atomic_read(&inode->i_count)));
|
||||
|
||||
switch (obj->yst_mode & S_IFMT) {
|
||||
@@ -1715,8 +1741,8 @@ static int yaffs_mknod(struct inode *dir
|
||||
yaffs_obj_t *parent = yaffs_InodeToObject(dir);
|
||||
|
||||
int error = -ENOSPC;
|
||||
- uid_t uid = YCRED(current)->fsuid;
|
||||
- gid_t gid = (dir->i_mode & S_ISGID) ? dir->i_gid : YCRED(current)->fsgid;
|
||||
+ uid_t uid = YCRED_FSUID();
|
||||
+ gid_t gid = (dir->i_mode & S_ISGID) ? i_gid_read(dir) : YCRED_FSGID();
|
||||
|
||||
if ((dir->i_mode & S_ISGID) && S_ISDIR(mode))
|
||||
mode |= S_ISGID;
|
||||
@@ -1892,8 +1918,8 @@ static int yaffs_symlink(struct inode *d
|
||||
{
|
||||
yaffs_obj_t *obj;
|
||||
yaffs_dev_t *dev;
|
||||
- uid_t uid = YCRED(current)->fsuid;
|
||||
- gid_t gid = (dir->i_mode & S_ISGID) ? dir->i_gid : YCRED(current)->fsgid;
|
||||
+ uid_t uid = YCRED_FSUID();
|
||||
+ gid_t gid = (dir->i_mode & S_ISGID) ? i_gid_read(dir) : YCRED_FSGID();
|
||||
|
||||
T(YAFFS_TRACE_OS, (TSTR("yaffs_symlink\n")));
|
||||
|
||||
@@ -2009,7 +2035,7 @@ static int yaffs_setattr(struct dentry *
|
||||
(TSTR("yaffs_setattr of object %d\n"),
|
||||
yaffs_InodeToObject(inode)->obj_id));
|
||||
|
||||
- /* Fail if a requested resize >= 2GB */
|
||||
+ /* Fail if a requested resize >= 2GB */
|
||||
if (attr->ia_valid & ATTR_SIZE &&
|
||||
(attr->ia_size >> 31))
|
||||
error = -EINVAL;
|
||||
@@ -2240,7 +2266,7 @@ static void yaffs_flush_inodes(struct su
|
||||
{
|
||||
struct inode *iptr;
|
||||
yaffs_obj_t *obj;
|
||||
-
|
||||
+
|
||||
list_for_each_entry(iptr,&sb->s_inodes, i_sb_list){
|
||||
obj = yaffs_InodeToObject(iptr);
|
||||
if(obj){
|
||||
@@ -2254,10 +2280,10 @@ static void yaffs_flush_inodes(struct su
|
||||
|
||||
static void yaffs_flush_super(struct super_block *sb, int do_checkpoint)
|
||||
{
|
||||
- yaffs_dev_t *dev = yaffs_SuperToDevice(sb);
|
||||
+ yaffs_dev_t *dev = yaffs_SuperToDevice(sb);
|
||||
if(!dev)
|
||||
return;
|
||||
-
|
||||
+
|
||||
yaffs_flush_inodes(sb);
|
||||
yaffs_update_dirty_dirs(dev);
|
||||
yaffs_flush_whole_cache(dev);
|
||||
@@ -2325,7 +2351,7 @@ static int yaffs_do_sync_fs(struct super
|
||||
* yaffs_bg_start() launches the background thread.
|
||||
* yaffs_bg_stop() cleans up the background thread.
|
||||
*
|
||||
- * NB:
|
||||
+ * NB:
|
||||
* The thread should only run after the yaffs is initialised
|
||||
* The thread should be stopped before yaffs is unmounted.
|
||||
* The thread should not do any writing while the fs is in read only.
|
||||
@@ -2924,7 +2950,7 @@ static struct super_block *yaffs_interna
|
||||
|
||||
dev = kmalloc(sizeof(yaffs_dev_t), GFP_KERNEL);
|
||||
context = kmalloc(sizeof(struct yaffs_LinuxContext),GFP_KERNEL);
|
||||
-
|
||||
+
|
||||
if(!dev || !context ){
|
||||
if(dev)
|
||||
kfree(dev);
|
||||
@@ -2957,7 +2983,7 @@ static struct super_block *yaffs_interna
|
||||
#else
|
||||
sb->u.generic_sbp = dev;
|
||||
#endif
|
||||
-
|
||||
+
|
||||
dev->driver_context = mtd;
|
||||
param->name = mtd->name;
|
||||
|
||||
@@ -3057,7 +3083,7 @@ static struct super_block *yaffs_interna
|
||||
param->gc_control = yaffs_gc_control_callback;
|
||||
|
||||
yaffs_dev_to_lc(dev)->superBlock= sb;
|
||||
-
|
||||
+
|
||||
|
||||
#ifndef CONFIG_YAFFS_DOES_ECC
|
||||
param->use_nand_ecc = 1;
|
||||
@@ -3099,10 +3125,10 @@ static struct super_block *yaffs_interna
|
||||
T(YAFFS_TRACE_OS,
|
||||
(TSTR("yaffs_read_super: guts initialised %s\n"),
|
||||
(err == YAFFS_OK) ? "OK" : "FAILED"));
|
||||
-
|
||||
+
|
||||
if(err == YAFFS_OK)
|
||||
yaffs_bg_start(dev);
|
||||
-
|
||||
+
|
||||
if(!context->bgThread)
|
||||
param->defered_dir_update = 0;
|
||||
|
||||
@@ -3345,7 +3371,7 @@ static int yaffs_proc_read(char *page,
|
||||
buf += sprintf(buf,"\n");
|
||||
else {
|
||||
step-=2;
|
||||
-
|
||||
+
|
||||
mutex_lock(&yaffs_context_lock);
|
||||
|
||||
/* Locate and print the Nth entry. Order N-squared but N is small. */
|
||||
@@ -3362,7 +3388,7 @@ static int yaffs_proc_read(char *page,
|
||||
buf = yaffs_dump_dev_part0(buf, dev);
|
||||
} else
|
||||
buf = yaffs_dump_dev_part1(buf, dev);
|
||||
-
|
||||
+
|
||||
break;
|
||||
}
|
||||
mutex_unlock(&yaffs_context_lock);
|
||||
@@ -3389,7 +3415,7 @@ static int yaffs_stats_proc_read(char *p
|
||||
int erasedChunks;
|
||||
|
||||
erasedChunks = dev->n_erased_blocks * dev->param.chunks_per_block;
|
||||
-
|
||||
+
|
||||
buf += sprintf(buf,"%d, %d, %d, %u, %u, %u, %u\n",
|
||||
n, dev->n_free_chunks, erasedChunks,
|
||||
dev->bg_gcs, dev->oldest_dirty_gc_count,
|
||||
--- a/fs/yaffs2/yaffs_guts.c
|
||||
+++ b/fs/yaffs2/yaffs_guts.c
|
||||
@@ -370,7 +370,7 @@ static int yaffs_verify_chunk_written(ya
|
||||
yaffs_ext_tags tempTags;
|
||||
__u8 *buffer = yaffs_get_temp_buffer(dev,__LINE__);
|
||||
int result;
|
||||
-
|
||||
+
|
||||
result = yaffs_rd_chunk_tags_nand(dev,nand_chunk,buffer,&tempTags);
|
||||
if(memcmp(buffer,data,dev->data_bytes_per_chunk) ||
|
||||
tempTags.obj_id != tags->obj_id ||
|
||||
@@ -424,7 +424,7 @@ static int yaffs_write_new_chunk(struct
|
||||
* lot of checks that are most likely not needed.
|
||||
*
|
||||
* Mods to the above
|
||||
- * If an erase check fails or the write fails we skip the
|
||||
+ * If an erase check fails or the write fails we skip the
|
||||
* rest of the block.
|
||||
*/
|
||||
|
||||
@@ -486,7 +486,7 @@ static int yaffs_write_new_chunk(struct
|
||||
}
|
||||
|
||||
|
||||
-
|
||||
+
|
||||
/*
|
||||
* Block retiring for handling a broken block.
|
||||
*/
|
||||
@@ -496,7 +496,7 @@ static void yaffs_retire_block(yaffs_dev
|
||||
yaffs_block_info_t *bi = yaffs_get_block_info(dev, flash_block);
|
||||
|
||||
yaffs2_checkpt_invalidate(dev);
|
||||
-
|
||||
+
|
||||
yaffs2_clear_oldest_dirty_seq(dev,bi);
|
||||
|
||||
if (yaffs_mark_bad(dev, flash_block) != YAFFS_OK) {
|
||||
@@ -899,7 +899,7 @@ static int yaffs_find_chunk_in_group(yaf
|
||||
for (j = 0; theChunk && j < dev->chunk_grp_size; j++) {
|
||||
if (yaffs_check_chunk_bit(dev, theChunk / dev->param.chunks_per_block,
|
||||
theChunk % dev->param.chunks_per_block)) {
|
||||
-
|
||||
+
|
||||
if(dev->chunk_grp_size == 1)
|
||||
return theChunk;
|
||||
else {
|
||||
@@ -1802,7 +1802,7 @@ int yaffs_rename_obj(yaffs_obj_t *old_di
|
||||
yaffs_update_parent(old_dir);
|
||||
if(new_dir != old_dir)
|
||||
yaffs_update_parent(new_dir);
|
||||
-
|
||||
+
|
||||
return result;
|
||||
}
|
||||
return YAFFS_FAIL;
|
||||
@@ -2125,7 +2125,7 @@ static int yaffs_gc_block(yaffs_dev_t *d
|
||||
|
||||
if(bi->block_state == YAFFS_BLOCK_STATE_FULL)
|
||||
bi->block_state = YAFFS_BLOCK_STATE_COLLECTING;
|
||||
-
|
||||
+
|
||||
bi->has_shrink_hdr = 0; /* clear the flag so that the block can erase */
|
||||
|
||||
dev->gc_disable = 1;
|
||||
@@ -2207,7 +2207,7 @@ static int yaffs_gc_block(yaffs_dev_t *d
|
||||
* No need to copy this, just forget about it and
|
||||
* fix up the object.
|
||||
*/
|
||||
-
|
||||
+
|
||||
/* Free chunks already includes softdeleted chunks.
|
||||
* How ever this chunk is going to soon be really deleted
|
||||
* which will increment free chunks.
|
||||
@@ -2752,7 +2752,7 @@ int yaffs_put_chunk_in_file(yaffs_obj_t
|
||||
NULL);
|
||||
if (!tn)
|
||||
return YAFFS_FAIL;
|
||||
-
|
||||
+
|
||||
if(!nand_chunk)
|
||||
/* Dummy insert, bail now */
|
||||
return YAFFS_OK;
|
||||
@@ -2881,7 +2881,7 @@ void yaffs_chunk_del(yaffs_dev_t *dev, i
|
||||
chunk_id));
|
||||
|
||||
bi = yaffs_get_block_info(dev, block);
|
||||
-
|
||||
+
|
||||
yaffs2_update_oldest_dirty_seq(dev, block, bi);
|
||||
|
||||
T(YAFFS_TRACE_DELETION,
|
||||
@@ -2966,8 +2966,8 @@ static int yaffs_wr_data_obj(yaffs_obj_t
|
||||
(TSTR("Writing %d bytes to chunk!!!!!!!!!" TENDSTR), n_bytes));
|
||||
YBUG();
|
||||
}
|
||||
-
|
||||
-
|
||||
+
|
||||
+
|
||||
newChunkId =
|
||||
yaffs_write_new_chunk(dev, buffer, &newTags,
|
||||
useReserve);
|
||||
@@ -3795,14 +3795,14 @@ int yaffs_resize_file(yaffs_obj_t *in, l
|
||||
|
||||
if (new_size == oldFileSize)
|
||||
return YAFFS_OK;
|
||||
-
|
||||
+
|
||||
if(new_size > oldFileSize){
|
||||
yaffs2_handle_hole(in,new_size);
|
||||
in->variant.file_variant.file_size = new_size;
|
||||
} else {
|
||||
- /* new_size < oldFileSize */
|
||||
+ /* new_size < oldFileSize */
|
||||
yaffs_resize_file_down(in, new_size);
|
||||
- }
|
||||
+ }
|
||||
|
||||
/* Write a new object header to reflect the resize.
|
||||
* show we've shrunk the file, if need be
|
||||
@@ -4231,7 +4231,7 @@ static void yaffs_strip_deleted_objs(yaf
|
||||
* This fixes the problem where directories might have inadvertently been deleted
|
||||
* leaving the object "hanging" without being rooted in the directory tree.
|
||||
*/
|
||||
-
|
||||
+
|
||||
static int yaffs_has_null_parent(yaffs_dev_t *dev, yaffs_obj_t *obj)
|
||||
{
|
||||
return (obj == dev->del_dir ||
|
||||
@@ -4262,7 +4262,7 @@ static void yaffs_fix_hanging_objs(yaffs
|
||||
if (lh) {
|
||||
obj = ylist_entry(lh, yaffs_obj_t, hash_link);
|
||||
parent= obj->parent;
|
||||
-
|
||||
+
|
||||
if(yaffs_has_null_parent(dev,obj)){
|
||||
/* These directories are not hanging */
|
||||
hanging = 0;
|
||||
@@ -4311,7 +4311,7 @@ static void yaffs_del_dir_contents(yaffs
|
||||
|
||||
if(dir->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY)
|
||||
YBUG();
|
||||
-
|
||||
+
|
||||
ylist_for_each_safe(lh, n, &dir->variant.dir_variant.children) {
|
||||
if (lh) {
|
||||
obj = ylist_entry(lh, yaffs_obj_t, siblings);
|
||||
@@ -4325,10 +4325,10 @@ static void yaffs_del_dir_contents(yaffs
|
||||
/* Need to use UnlinkObject since Delete would not handle
|
||||
* hardlinked objects correctly.
|
||||
*/
|
||||
- yaffs_unlink_obj(obj);
|
||||
+ yaffs_unlink_obj(obj);
|
||||
}
|
||||
}
|
||||
-
|
||||
+
|
||||
}
|
||||
|
||||
static void yaffs_empty_l_n_f(yaffs_dev_t *dev)
|
||||
@@ -4410,7 +4410,7 @@ static void yaffs_check_obj_details_load
|
||||
* If the directory updating is defered then yaffs_update_dirty_dirs must be
|
||||
* called periodically.
|
||||
*/
|
||||
-
|
||||
+
|
||||
static void yaffs_update_parent(yaffs_obj_t *obj)
|
||||
{
|
||||
yaffs_dev_t *dev;
|
||||
@@ -4422,8 +4422,8 @@ static void yaffs_update_parent(yaffs_ob
|
||||
obj->dirty = 1;
|
||||
obj->yst_mtime = obj->yst_ctime = Y_CURRENT_TIME;
|
||||
if(dev->param.defered_dir_update){
|
||||
- struct ylist_head *link = &obj->variant.dir_variant.dirty;
|
||||
-
|
||||
+ struct ylist_head *link = &obj->variant.dir_variant.dirty;
|
||||
+
|
||||
if(ylist_empty(link)){
|
||||
ylist_add(link,&dev->dirty_dirs);
|
||||
T(YAFFS_TRACE_BACKGROUND, (TSTR("Added object %d to dirty directories" TENDSTR),obj->obj_id));
|
||||
@@ -4446,7 +4446,7 @@ void yaffs_update_dirty_dirs(yaffs_dev_t
|
||||
while(!ylist_empty(&dev->dirty_dirs)){
|
||||
link = dev->dirty_dirs.next;
|
||||
ylist_del_init(link);
|
||||
-
|
||||
+
|
||||
dS=ylist_entry(link,yaffs_dir_s,dirty);
|
||||
oV = ylist_entry(dS,yaffs_obj_variant,dir_variant);
|
||||
obj = ylist_entry(oV,yaffs_obj_t,variant);
|
||||
@@ -4474,7 +4474,7 @@ static void yaffs_remove_obj_from_dir(ya
|
||||
|
||||
ylist_del_init(&obj->siblings);
|
||||
obj->parent = NULL;
|
||||
-
|
||||
+
|
||||
yaffs_verify_dir(parent);
|
||||
}
|
||||
|
||||
@@ -4645,7 +4645,7 @@ yaffs_obj_t *yaffs_get_equivalent_obj(ya
|
||||
* system to share files.
|
||||
*
|
||||
* These automatic unicode are stored slightly differently...
|
||||
- * - If the name can fit in the ASCII character space then they are saved as
|
||||
+ * - If the name can fit in the ASCII character space then they are saved as
|
||||
* ascii names as per above.
|
||||
* - If the name needs Unicode then the name is saved in Unicode
|
||||
* starting at oh->name[1].
|
||||
@@ -4686,7 +4686,7 @@ static void yaffs_load_name_from_oh(yaff
|
||||
asciiOhName++;
|
||||
n--;
|
||||
}
|
||||
- } else
|
||||
+ } else
|
||||
yaffs_strncpy(name,ohName+1, bufferSize -1);
|
||||
} else
|
||||
#endif
|
||||
@@ -4705,7 +4705,7 @@ static void yaffs_load_oh_from_name(yaff
|
||||
|
||||
isAscii = 1;
|
||||
w = name;
|
||||
-
|
||||
+
|
||||
/* Figure out if the name will fit in ascii character set */
|
||||
while(isAscii && *w){
|
||||
if((*w) & 0xff00)
|
||||
@@ -4729,7 +4729,7 @@ static void yaffs_load_oh_from_name(yaff
|
||||
yaffs_strncpy(ohName+1,name, YAFFS_MAX_NAME_LENGTH -2);
|
||||
}
|
||||
}
|
||||
- else
|
||||
+ else
|
||||
#endif
|
||||
yaffs_strncpy(ohName,name, YAFFS_MAX_NAME_LENGTH - 1);
|
||||
|
||||
@@ -4738,12 +4738,12 @@ static void yaffs_load_oh_from_name(yaff
|
||||
int yaffs_get_obj_name(yaffs_obj_t * obj, YCHAR * name, int buffer_size)
|
||||
{
|
||||
memset(name, 0, buffer_size * sizeof(YCHAR));
|
||||
-
|
||||
+
|
||||
yaffs_check_obj_details_loaded(obj);
|
||||
|
||||
if (obj->obj_id == YAFFS_OBJECTID_LOSTNFOUND) {
|
||||
yaffs_strncpy(name, YAFFS_LOSTNFOUND_NAME, buffer_size - 1);
|
||||
- }
|
||||
+ }
|
||||
#ifdef CONFIG_YAFFS_SHORT_NAMES_IN_RAM
|
||||
else if (obj->short_name[0]) {
|
||||
yaffs_strcpy(name, obj->short_name);
|
||||
@@ -4861,9 +4861,9 @@ int yaffs_set_attribs(yaffs_obj_t *obj,
|
||||
if (valid & ATTR_MODE)
|
||||
obj->yst_mode = attr->ia_mode;
|
||||
if (valid & ATTR_UID)
|
||||
- obj->yst_uid = attr->ia_uid;
|
||||
+ obj->yst_uid = ia_uid_read(attr);
|
||||
if (valid & ATTR_GID)
|
||||
- obj->yst_gid = attr->ia_gid;
|
||||
+ obj->yst_gid = ia_gid_read(attr);
|
||||
|
||||
if (valid & ATTR_ATIME)
|
||||
obj->yst_atime = Y_TIME_CONVERT(attr->ia_atime);
|
||||
@@ -4886,9 +4886,9 @@ int yaffs_get_attribs(yaffs_obj_t *obj,
|
||||
|
||||
attr->ia_mode = obj->yst_mode;
|
||||
valid |= ATTR_MODE;
|
||||
- attr->ia_uid = obj->yst_uid;
|
||||
+ ia_uid_write(attr, obj->yst_uid);
|
||||
valid |= ATTR_UID;
|
||||
- attr->ia_gid = obj->yst_gid;
|
||||
+ ia_gid_write(attr, obj->yst_gid);
|
||||
valid |= ATTR_GID;
|
||||
|
||||
Y_TIME_CONVERT(attr->ia_atime) = obj->yst_atime;
|
||||
--- a/fs/yaffs2/yportenv.h
|
||||
+++ b/fs/yaffs2/yportenv.h
|
||||
@@ -170,7 +170,7 @@
|
||||
#define O_RDWR 02
|
||||
#endif
|
||||
|
||||
-#ifndef O_CREAT
|
||||
+#ifndef O_CREAT
|
||||
#define O_CREAT 0100
|
||||
#endif
|
||||
|
||||
@@ -218,7 +218,7 @@
|
||||
#define EACCES 13
|
||||
#endif
|
||||
|
||||
-#ifndef EXDEV
|
||||
+#ifndef EXDEV
|
||||
#define EXDEV 18
|
||||
#endif
|
||||
|
||||
@@ -281,7 +281,7 @@
|
||||
#define S_IFREG 0100000
|
||||
#endif
|
||||
|
||||
-#ifndef S_IREAD
|
||||
+#ifndef S_IREAD
|
||||
#define S_IREAD 0000400
|
||||
#endif
|
||||
|
||||
--- a/fs/yaffs2/devextras.h
|
||||
+++ b/fs/yaffs2/devextras.h
|
||||
@@ -87,6 +87,8 @@ struct iattr {
|
||||
unsigned int ia_attr_flags;
|
||||
};
|
||||
|
||||
+/* TODO: add ia_* functions */
|
||||
+
|
||||
#endif
|
||||
|
||||
#else
|
||||
@@ -95,7 +97,48 @@ struct iattr {
|
||||
#include <linux/fs.h>
|
||||
#include <linux/stat.h>
|
||||
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0))
|
||||
+static inline uid_t ia_uid_read(const struct iattr *iattr)
|
||||
+{
|
||||
+ return from_kuid(&init_user_ns, iattr->ia_uid);
|
||||
+}
|
||||
+
|
||||
+static inline gid_t ia_gid_read(const struct iattr *iattr)
|
||||
+{
|
||||
+ return from_kgid(&init_user_ns, iattr->ia_gid);
|
||||
+}
|
||||
+
|
||||
+static inline void ia_uid_write(struct iattr *iattr, uid_t uid)
|
||||
+{
|
||||
+ iattr->ia_uid = make_kuid(&init_user_ns, uid);
|
||||
+}
|
||||
+
|
||||
+static inline void ia_gid_write(struct iattr *iattr, gid_t gid)
|
||||
+{
|
||||
+ iattr->ia_gid = make_kgid(&init_user_ns, gid);
|
||||
+}
|
||||
+#else
|
||||
+static inline uid_t ia_uid_read(const struct iattr *iattr)
|
||||
+{
|
||||
+ return iattr->ia_uid;
|
||||
+}
|
||||
+
|
||||
+static inline gid_t ia_gid_read(const struct iattr *inode)
|
||||
+{
|
||||
+ return iattr->ia_gid;
|
||||
+}
|
||||
+
|
||||
+static inline void ia_uid_write(struct iattr *iattr, uid_t uid)
|
||||
+{
|
||||
+ iattr->ia_uid = uid;
|
||||
+}
|
||||
+
|
||||
+static inline void ia_gid_write(struct iattr *iattr, gid_t gid)
|
||||
+{
|
||||
+ iattr->ia_gid = gid;
|
||||
+}
|
||||
#endif
|
||||
|
||||
+#endif
|
||||
|
||||
#endif
|
@ -1,60 +0,0 @@
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -271,20 +271,29 @@ static int yaffs_sync_object(struct file
|
||||
|
||||
static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir);
|
||||
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||
+static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
+ bool excl);
|
||||
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
struct nameidata *n);
|
||||
-#else
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode,
|
||||
struct nameidata *n);
|
||||
+#else
|
||||
+static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode);
|
||||
#endif
|
||||
+
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||
+static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
|
||||
+ unsigned int flags);
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
|
||||
struct nameidata *n);
|
||||
#else
|
||||
-static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode);
|
||||
static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry);
|
||||
#endif
|
||||
+
|
||||
static int yaffs_link(struct dentry *old_dentry, struct inode *dir,
|
||||
struct dentry *dentry);
|
||||
static int yaffs_unlink(struct inode *dir, struct dentry *dentry);
|
||||
@@ -837,7 +846,10 @@ struct inode *yaffs_get_inode(struct sup
|
||||
/*
|
||||
* Lookup is used to find objects in the fs
|
||||
*/
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||
+static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
|
||||
+ unsigned int flags)
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
|
||||
static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
|
||||
struct nameidata *n)
|
||||
@@ -1827,7 +1839,10 @@ static int yaffs_mkdir(struct inode *dir
|
||||
return retVal;
|
||||
}
|
||||
|
||||
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||
+static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
+ bool excl)
|
||||
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
struct nameidata *n)
|
||||
#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
@ -1,180 +0,0 @@
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -393,6 +393,84 @@ static void yaffs_touch_super(yaffs_dev_
|
||||
static int yaffs_vfs_setattr(struct inode *, struct iattr *);
|
||||
|
||||
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||
+
|
||||
+#define yaffs_super_to_dev(sb) ((struct yaffs_dev_s *)sb->s_fs_info)
|
||||
+
|
||||
+static inline struct yaffs_LinuxContext *
|
||||
+yaffs_sb_to_ylc(struct super_block *sb)
|
||||
+{
|
||||
+ struct yaffs_dev_s *ydev;
|
||||
+ struct yaffs_LinuxContext *ylc;
|
||||
+
|
||||
+ ydev = yaffs_super_to_dev(sb);
|
||||
+ ylc = yaffs_dev_to_lc(ydev);
|
||||
+ return ylc;
|
||||
+}
|
||||
+
|
||||
+static inline struct super_block *yaffs_work_to_sb(struct work_struct *work)
|
||||
+{
|
||||
+ struct delayed_work *dwork;
|
||||
+ struct yaffs_LinuxContext *ylc;
|
||||
+
|
||||
+ dwork = container_of(work, struct delayed_work, work);
|
||||
+ ylc = container_of(dwork, struct yaffs_LinuxContext, sb_sync_dwork);
|
||||
+ return ylc->superBlock;
|
||||
+}
|
||||
+
|
||||
+static void yaffs_sb_sync_dwork_func(struct work_struct *work)
|
||||
+{
|
||||
+ struct super_block *sb = yaffs_work_to_sb(work);
|
||||
+
|
||||
+ yaffs_write_super(sb);
|
||||
+}
|
||||
+
|
||||
+static void yaffs_init_sb_sync_dwork(struct yaffs_LinuxContext *ylc)
|
||||
+{
|
||||
+ INIT_DELAYED_WORK(&ylc->sb_sync_dwork, yaffs_sb_sync_dwork_func);
|
||||
+}
|
||||
+
|
||||
+static void yaffs_cancel_sb_sync_dwork(struct super_block *sb)
|
||||
+{
|
||||
+ struct yaffs_LinuxContext *ylc = yaffs_sb_to_ylc(sb);
|
||||
+
|
||||
+ cancel_delayed_work_sync(&ylc->sb_sync_dwork);
|
||||
+}
|
||||
+
|
||||
+static inline bool yaffs_sb_is_dirty(struct super_block *sb)
|
||||
+{
|
||||
+ struct yaffs_LinuxContext *ylc = yaffs_sb_to_ylc(sb);
|
||||
+
|
||||
+ return !!ylc->sb_dirty;
|
||||
+}
|
||||
+
|
||||
+static inline void yaffs_sb_set_dirty(struct super_block *sb, int dirty)
|
||||
+{
|
||||
+ struct yaffs_LinuxContext *ylc = yaffs_sb_to_ylc(sb);
|
||||
+
|
||||
+ if (ylc->sb_dirty == dirty)
|
||||
+ return;
|
||||
+
|
||||
+ ylc->sb_dirty = dirty;
|
||||
+ if (dirty)
|
||||
+ queue_delayed_work(system_long_wq, &ylc->sb_sync_dwork,
|
||||
+ msecs_to_jiffies(5000));
|
||||
+}
|
||||
+#else
|
||||
+static inline bool yaffs_sb_is_dirty(struct super_block *sb)
|
||||
+{
|
||||
+ return !!sb->s_dirt;
|
||||
+}
|
||||
+
|
||||
+static inline void yaffs_sb_set_dirty(struct super_block *sb, int dirty)
|
||||
+{
|
||||
+ sb->s_dirt = dirty;
|
||||
+}
|
||||
+
|
||||
+static inline void yaffs_init_sb_sync_dwork(struct yaffs_LinuxContext *ylc) {}
|
||||
+static inline void yaffs_cancel_sb_sync_dwork(struct super_block *sb) {}
|
||||
+#endif /* >= 3.6.0 */
|
||||
+
|
||||
static struct address_space_operations yaffs_file_address_operations = {
|
||||
.readpage = yaffs_readpage,
|
||||
.writepage = yaffs_writepage,
|
||||
@@ -553,7 +631,9 @@ static const struct super_operations yaf
|
||||
.clear_inode = yaffs_clear_inode,
|
||||
#endif
|
||||
.sync_fs = yaffs_sync_fs,
|
||||
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
|
||||
.write_super = yaffs_write_super,
|
||||
+#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -2340,7 +2420,7 @@ static int yaffs_do_sync_fs(struct super
|
||||
T(YAFFS_TRACE_OS | YAFFS_TRACE_SYNC | YAFFS_TRACE_BACKGROUND,
|
||||
(TSTR("yaffs_do_sync_fs: gc-urgency %d %s %s%s\n"),
|
||||
gc_urgent,
|
||||
- sb->s_dirt ? "dirty" : "clean",
|
||||
+ yaffs_sb_is_dirty(sb) ? "dirty" : "clean",
|
||||
request_checkpoint ? "checkpoint requested" : "no checkpoint",
|
||||
oneshot_checkpoint ? " one-shot" : "" ));
|
||||
|
||||
@@ -2349,9 +2429,9 @@ static int yaffs_do_sync_fs(struct super
|
||||
oneshot_checkpoint) &&
|
||||
!dev->is_checkpointed;
|
||||
|
||||
- if (sb->s_dirt || do_checkpoint) {
|
||||
+ if (yaffs_sb_is_dirty(sb) || do_checkpoint) {
|
||||
yaffs_flush_super(sb, !dev->is_checkpointed && do_checkpoint);
|
||||
- sb->s_dirt = 0;
|
||||
+ yaffs_sb_set_dirty(sb, 0);
|
||||
if(oneshot_checkpoint)
|
||||
yaffs_auto_checkpoint &= ~4;
|
||||
}
|
||||
@@ -2627,6 +2707,8 @@ static void yaffs_put_super(struct super
|
||||
|
||||
yaffs_flush_super(sb,1);
|
||||
|
||||
+ yaffs_cancel_sb_sync_dwork(sb);
|
||||
+
|
||||
if (yaffs_dev_to_lc(dev)->putSuperFunc)
|
||||
yaffs_dev_to_lc(dev)->putSuperFunc(sb);
|
||||
|
||||
@@ -2665,7 +2747,7 @@ static void yaffs_touch_super(yaffs_dev_
|
||||
|
||||
T(YAFFS_TRACE_OS, (TSTR("yaffs_touch_super() sb = %p\n"), sb));
|
||||
if (sb)
|
||||
- sb->s_dirt = 1;
|
||||
+ yaffs_sb_set_dirty(sb, 1);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@@ -2991,6 +3073,8 @@ static struct super_block *yaffs_interna
|
||||
context->dev = dev;
|
||||
context->superBlock = sb;
|
||||
|
||||
+ yaffs_init_sb_sync_dwork(context);
|
||||
+
|
||||
dev->read_only = read_only;
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
@@ -3177,7 +3261,7 @@ static struct super_block *yaffs_interna
|
||||
return NULL;
|
||||
}
|
||||
sb->s_root = root;
|
||||
- sb->s_dirt = !dev->is_checkpointed;
|
||||
+ yaffs_sb_set_dirty(sb, !dev->is_checkpointed);
|
||||
T(YAFFS_TRACE_ALWAYS,
|
||||
(TSTR("yaffs_read_super: is_checkpointed %d\n"),
|
||||
dev->is_checkpointed));
|
||||
--- a/fs/yaffs2/yaffs_linux.h
|
||||
+++ b/fs/yaffs2/yaffs_linux.h
|
||||
@@ -34,6 +34,11 @@ struct yaffs_LinuxContext {
|
||||
|
||||
struct task_struct *readdirProcess;
|
||||
unsigned mount_id;
|
||||
+
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||
+ struct delayed_work sb_sync_dwork; /* superblock write-out work */
|
||||
+ int sb_dirty; /* superblock is dirty */
|
||||
+#endif
|
||||
};
|
||||
|
||||
#define yaffs_dev_to_lc(dev) ((struct yaffs_LinuxContext *)((dev)->os_context))
|
||||
--- a/fs/yaffs2/yportenv.h
|
||||
+++ b/fs/yaffs2/yportenv.h
|
||||
@@ -49,6 +49,9 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/xattr.h>
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||
+#include <linux/workqueue.h>
|
||||
+#endif
|
||||
|
||||
#define YCHAR char
|
||||
#define YUCHAR unsigned char
|
@ -1,25 +0,0 @@
|
||||
From f31b7c0efa255dd17a5f584022a319387f09b0d8 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
Date: Tue, 12 Apr 2011 19:55:41 +0200
|
||||
Subject: [PATCH] squashfs: update xz compressor options struct.
|
||||
|
||||
Update the xz compressor options struct to match the squashfs userspace
|
||||
one.
|
||||
---
|
||||
fs/squashfs/xz_wrapper.c | 4 +++-
|
||||
1 files changed, 3 insertions(+), 1 deletions(-)
|
||||
|
||||
--- a/fs/squashfs/xz_wrapper.c
|
||||
+++ b/fs/squashfs/xz_wrapper.c
|
||||
@@ -39,8 +39,10 @@ struct squashfs_xz {
|
||||
};
|
||||
|
||||
struct comp_opts {
|
||||
- __le32 dictionary_size;
|
||||
__le32 flags;
|
||||
+ __le16 bit_opts;
|
||||
+ __le16 fb;
|
||||
+ __le32 dictionary_size;
|
||||
};
|
||||
|
||||
static void *squashfs_xz_init(struct squashfs_sb_info *msblk, void *buff,
|
File diff suppressed because it is too large
Load Diff
@ -1,485 +0,0 @@
|
||||
--- a/include/linux/lzma/LzmaDec.h
|
||||
+++ b/include/linux/lzma/LzmaDec.h
|
||||
@@ -31,14 +31,6 @@ typedef struct _CLzmaProps
|
||||
UInt32 dicSize;
|
||||
} CLzmaProps;
|
||||
|
||||
-/* LzmaProps_Decode - decodes properties
|
||||
-Returns:
|
||||
- SZ_OK
|
||||
- SZ_ERROR_UNSUPPORTED - Unsupported properties
|
||||
-*/
|
||||
-
|
||||
-SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
|
||||
-
|
||||
|
||||
/* ---------- LZMA Decoder state ---------- */
|
||||
|
||||
@@ -70,8 +62,6 @@ typedef struct
|
||||
|
||||
#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; }
|
||||
|
||||
-void LzmaDec_Init(CLzmaDec *p);
|
||||
-
|
||||
/* There are two types of LZMA streams:
|
||||
0) Stream with end mark. That end mark adds about 6 bytes to compressed size.
|
||||
1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */
|
||||
@@ -108,97 +98,6 @@ typedef enum
|
||||
|
||||
/* ELzmaStatus is used only as output value for function call */
|
||||
|
||||
-
|
||||
-/* ---------- Interfaces ---------- */
|
||||
-
|
||||
-/* There are 3 levels of interfaces:
|
||||
- 1) Dictionary Interface
|
||||
- 2) Buffer Interface
|
||||
- 3) One Call Interface
|
||||
- You can select any of these interfaces, but don't mix functions from different
|
||||
- groups for same object. */
|
||||
-
|
||||
-
|
||||
-/* There are two variants to allocate state for Dictionary Interface:
|
||||
- 1) LzmaDec_Allocate / LzmaDec_Free
|
||||
- 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
|
||||
- You can use variant 2, if you set dictionary buffer manually.
|
||||
- For Buffer Interface you must always use variant 1.
|
||||
-
|
||||
-LzmaDec_Allocate* can return:
|
||||
- SZ_OK
|
||||
- SZ_ERROR_MEM - Memory allocation error
|
||||
- SZ_ERROR_UNSUPPORTED - Unsupported properties
|
||||
-*/
|
||||
-
|
||||
-SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc);
|
||||
-void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
|
||||
-
|
||||
-SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc);
|
||||
-void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc);
|
||||
-
|
||||
-/* ---------- Dictionary Interface ---------- */
|
||||
-
|
||||
-/* You can use it, if you want to eliminate the overhead for data copying from
|
||||
- dictionary to some other external buffer.
|
||||
- You must work with CLzmaDec variables directly in this interface.
|
||||
-
|
||||
- STEPS:
|
||||
- LzmaDec_Constr()
|
||||
- LzmaDec_Allocate()
|
||||
- for (each new stream)
|
||||
- {
|
||||
- LzmaDec_Init()
|
||||
- while (it needs more decompression)
|
||||
- {
|
||||
- LzmaDec_DecodeToDic()
|
||||
- use data from CLzmaDec::dic and update CLzmaDec::dicPos
|
||||
- }
|
||||
- }
|
||||
- LzmaDec_Free()
|
||||
-*/
|
||||
-
|
||||
-/* LzmaDec_DecodeToDic
|
||||
-
|
||||
- The decoding to internal dictionary buffer (CLzmaDec::dic).
|
||||
- You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
|
||||
-
|
||||
-finishMode:
|
||||
- It has meaning only if the decoding reaches output limit (dicLimit).
|
||||
- LZMA_FINISH_ANY - Decode just dicLimit bytes.
|
||||
- LZMA_FINISH_END - Stream must be finished after dicLimit.
|
||||
-
|
||||
-Returns:
|
||||
- SZ_OK
|
||||
- status:
|
||||
- LZMA_STATUS_FINISHED_WITH_MARK
|
||||
- LZMA_STATUS_NOT_FINISHED
|
||||
- LZMA_STATUS_NEEDS_MORE_INPUT
|
||||
- LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
|
||||
- SZ_ERROR_DATA - Data error
|
||||
-*/
|
||||
-
|
||||
-SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
|
||||
- const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
|
||||
-
|
||||
-
|
||||
-/* ---------- Buffer Interface ---------- */
|
||||
-
|
||||
-/* It's zlib-like interface.
|
||||
- See LzmaDec_DecodeToDic description for information about STEPS and return results,
|
||||
- but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
|
||||
- to work with CLzmaDec variables manually.
|
||||
-
|
||||
-finishMode:
|
||||
- It has meaning only if the decoding reaches output limit (*destLen).
|
||||
- LZMA_FINISH_ANY - Decode just destLen bytes.
|
||||
- LZMA_FINISH_END - Stream must be finished after (*destLen).
|
||||
-*/
|
||||
-
|
||||
-SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
|
||||
- const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
|
||||
-
|
||||
-
|
||||
/* ---------- One Call Interface ---------- */
|
||||
|
||||
/* LzmaDecode
|
||||
--- a/lib/lzma/LzmaDec.c
|
||||
+++ b/lib/lzma/LzmaDec.c
|
||||
@@ -682,7 +682,7 @@ static void LzmaDec_InitRc(CLzmaDec *p,
|
||||
p->needFlush = 0;
|
||||
}
|
||||
|
||||
-void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
|
||||
+static void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
|
||||
{
|
||||
p->needFlush = 1;
|
||||
p->remainLen = 0;
|
||||
@@ -698,7 +698,7 @@ void LzmaDec_InitDicAndState(CLzmaDec *p
|
||||
p->needInitState = 1;
|
||||
}
|
||||
|
||||
-void LzmaDec_Init(CLzmaDec *p)
|
||||
+static void LzmaDec_Init(CLzmaDec *p)
|
||||
{
|
||||
p->dicPos = 0;
|
||||
LzmaDec_InitDicAndState(p, True, True);
|
||||
@@ -716,7 +716,7 @@ static void LzmaDec_InitStateReal(CLzmaD
|
||||
p->needInitState = 0;
|
||||
}
|
||||
|
||||
-SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
|
||||
+static SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
|
||||
ELzmaFinishMode finishMode, ELzmaStatus *status)
|
||||
{
|
||||
SizeT inSize = *srcLen;
|
||||
@@ -837,7 +837,7 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, Si
|
||||
return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA;
|
||||
}
|
||||
|
||||
-SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
|
||||
+static __maybe_unused SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
|
||||
{
|
||||
SizeT outSize = *destLen;
|
||||
SizeT inSize = *srcLen;
|
||||
@@ -877,7 +877,7 @@ SRes LzmaDec_DecodeToBuf(CLzmaDec *p, By
|
||||
}
|
||||
}
|
||||
|
||||
-void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
|
||||
+static void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
|
||||
{
|
||||
alloc->Free(alloc, p->probs);
|
||||
p->probs = 0;
|
||||
@@ -889,13 +889,13 @@ static void LzmaDec_FreeDict(CLzmaDec *p
|
||||
p->dic = 0;
|
||||
}
|
||||
|
||||
-void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc)
|
||||
+static void __maybe_unused LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc)
|
||||
{
|
||||
LzmaDec_FreeProbs(p, alloc);
|
||||
LzmaDec_FreeDict(p, alloc);
|
||||
}
|
||||
|
||||
-SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
|
||||
+static SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
|
||||
{
|
||||
UInt32 dicSize;
|
||||
Byte d;
|
||||
@@ -935,7 +935,7 @@ static SRes LzmaDec_AllocateProbs2(CLzma
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
-SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
|
||||
+static SRes __maybe_unused LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
|
||||
{
|
||||
CLzmaProps propNew;
|
||||
RINOK(LzmaProps_Decode(&propNew, props, propsSize));
|
||||
@@ -944,7 +944,7 @@ SRes LzmaDec_AllocateProbs(CLzmaDec *p,
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
-SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
|
||||
+static SRes __maybe_unused LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
|
||||
{
|
||||
CLzmaProps propNew;
|
||||
SizeT dicBufSize;
|
||||
--- a/include/linux/lzma/LzmaEnc.h
|
||||
+++ b/include/linux/lzma/LzmaEnc.h
|
||||
@@ -31,9 +31,6 @@ typedef struct _CLzmaEncProps
|
||||
} CLzmaEncProps;
|
||||
|
||||
void LzmaEncProps_Init(CLzmaEncProps *p);
|
||||
-void LzmaEncProps_Normalize(CLzmaEncProps *p);
|
||||
-UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
|
||||
-
|
||||
|
||||
/* ---------- CLzmaEncHandle Interface ---------- */
|
||||
|
||||
@@ -53,26 +50,9 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc *
|
||||
void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||
SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
|
||||
SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
|
||||
-SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
|
||||
- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||
SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
|
||||
int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||
|
||||
-/* ---------- One Call Interface ---------- */
|
||||
-
|
||||
-/* LzmaEncode
|
||||
-Return code:
|
||||
- SZ_OK - OK
|
||||
- SZ_ERROR_MEM - Memory allocation error
|
||||
- SZ_ERROR_PARAM - Incorrect paramater
|
||||
- SZ_ERROR_OUTPUT_EOF - output buffer overflow
|
||||
- SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
|
||||
-*/
|
||||
-
|
||||
-SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
|
||||
- const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
|
||||
- ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||
-
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
--- a/lib/lzma/LzmaEnc.c
|
||||
+++ b/lib/lzma/LzmaEnc.c
|
||||
@@ -53,7 +53,7 @@ void LzmaEncProps_Init(CLzmaEncProps *p)
|
||||
p->writeEndMark = 0;
|
||||
}
|
||||
|
||||
-void LzmaEncProps_Normalize(CLzmaEncProps *p)
|
||||
+static void LzmaEncProps_Normalize(CLzmaEncProps *p)
|
||||
{
|
||||
int level = p->level;
|
||||
if (level < 0) level = 5;
|
||||
@@ -76,7 +76,7 @@ void LzmaEncProps_Normalize(CLzmaEncProp
|
||||
#endif
|
||||
}
|
||||
|
||||
-UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
|
||||
+static UInt32 __maybe_unused LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
|
||||
{
|
||||
CLzmaEncProps props = *props2;
|
||||
LzmaEncProps_Normalize(&props);
|
||||
@@ -93,7 +93,7 @@ UInt32 LzmaEncProps_GetDictSize(const CL
|
||||
|
||||
#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); }
|
||||
|
||||
-UInt32 GetPosSlot1(UInt32 pos)
|
||||
+static UInt32 GetPosSlot1(UInt32 pos)
|
||||
{
|
||||
UInt32 res;
|
||||
BSR2_RET(pos, res);
|
||||
@@ -107,7 +107,7 @@ UInt32 GetPosSlot1(UInt32 pos)
|
||||
#define kNumLogBits (9 + (int)sizeof(size_t) / 2)
|
||||
#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7)
|
||||
|
||||
-void LzmaEnc_FastPosInit(Byte *g_FastPos)
|
||||
+static void LzmaEnc_FastPosInit(Byte *g_FastPos)
|
||||
{
|
||||
int c = 2, slotFast;
|
||||
g_FastPos[0] = 0;
|
||||
@@ -339,7 +339,7 @@ typedef struct
|
||||
CSaveState saveState;
|
||||
} CLzmaEnc;
|
||||
|
||||
-void LzmaEnc_SaveState(CLzmaEncHandle pp)
|
||||
+static void __maybe_unused LzmaEnc_SaveState(CLzmaEncHandle pp)
|
||||
{
|
||||
CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||
CSaveState *dest = &p->saveState;
|
||||
@@ -365,7 +365,7 @@ void LzmaEnc_SaveState(CLzmaEncHandle pp
|
||||
memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb));
|
||||
}
|
||||
|
||||
-void LzmaEnc_RestoreState(CLzmaEncHandle pp)
|
||||
+static void __maybe_unused LzmaEnc_RestoreState(CLzmaEncHandle pp)
|
||||
{
|
||||
CLzmaEnc *dest = (CLzmaEnc *)pp;
|
||||
const CSaveState *p = &dest->saveState;
|
||||
@@ -600,7 +600,7 @@ static void LitEnc_EncodeMatched(CRangeE
|
||||
while (symbol < 0x10000);
|
||||
}
|
||||
|
||||
-void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
|
||||
+static void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
|
||||
{
|
||||
UInt32 i;
|
||||
for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits))
|
||||
@@ -1676,7 +1676,7 @@ static void FillDistancesPrices(CLzmaEnc
|
||||
p->matchPriceCount = 0;
|
||||
}
|
||||
|
||||
-void LzmaEnc_Construct(CLzmaEnc *p)
|
||||
+static void LzmaEnc_Construct(CLzmaEnc *p)
|
||||
{
|
||||
RangeEnc_Construct(&p->rc);
|
||||
MatchFinder_Construct(&p->matchFinderBase);
|
||||
@@ -1709,7 +1709,7 @@ CLzmaEncHandle LzmaEnc_Create(ISzAlloc *
|
||||
return p;
|
||||
}
|
||||
|
||||
-void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
|
||||
+static void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
|
||||
{
|
||||
alloc->Free(alloc, p->litProbs);
|
||||
alloc->Free(alloc, p->saveState.litProbs);
|
||||
@@ -2074,7 +2074,7 @@ SRes LzmaEnc_MemPrepare(CLzmaEncHandle p
|
||||
return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
|
||||
}
|
||||
|
||||
-void LzmaEnc_Finish(CLzmaEncHandle pp)
|
||||
+static void LzmaEnc_Finish(CLzmaEncHandle pp)
|
||||
{
|
||||
#ifndef _7ZIP_ST
|
||||
CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||
@@ -2108,7 +2108,7 @@ static size_t MyWrite(void *pp, const vo
|
||||
}
|
||||
|
||||
|
||||
-UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
|
||||
+static UInt32 __maybe_unused LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
|
||||
{
|
||||
const CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||
return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
|
||||
@@ -2120,7 +2120,7 @@ const Byte *LzmaEnc_GetCurBuf(CLzmaEncHa
|
||||
return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
|
||||
}
|
||||
|
||||
-SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit,
|
||||
+static SRes __maybe_unused LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit,
|
||||
Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
|
||||
{
|
||||
CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||
@@ -2248,7 +2248,7 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp
|
||||
return res;
|
||||
}
|
||||
|
||||
-SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
|
||||
+static __maybe_unused SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
|
||||
const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
|
||||
ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
|
||||
{
|
||||
--- a/include/linux/lzma/LzFind.h
|
||||
+++ b/include/linux/lzma/LzFind.h
|
||||
@@ -55,11 +55,6 @@ typedef struct _CMatchFinder
|
||||
|
||||
#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
|
||||
|
||||
-int MatchFinder_NeedMove(CMatchFinder *p);
|
||||
-Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
|
||||
-void MatchFinder_MoveBlock(CMatchFinder *p);
|
||||
-void MatchFinder_ReadIfRequired(CMatchFinder *p);
|
||||
-
|
||||
void MatchFinder_Construct(CMatchFinder *p);
|
||||
|
||||
/* Conditions:
|
||||
@@ -70,12 +65,6 @@ int MatchFinder_Create(CMatchFinder *p,
|
||||
UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
|
||||
ISzAlloc *alloc);
|
||||
void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
|
||||
-void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
|
||||
-void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
|
||||
-
|
||||
-UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
|
||||
- UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
|
||||
- UInt32 *distances, UInt32 maxLen);
|
||||
|
||||
/*
|
||||
Conditions:
|
||||
@@ -102,12 +91,6 @@ typedef struct _IMatchFinder
|
||||
|
||||
void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
|
||||
|
||||
-void MatchFinder_Init(CMatchFinder *p);
|
||||
-UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
|
||||
-UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
|
||||
-void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
|
||||
-void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
|
||||
-
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
--- a/lib/lzma/LzFind.c
|
||||
+++ b/lib/lzma/LzFind.c
|
||||
@@ -42,12 +42,12 @@ static int LzInWindow_Create(CMatchFinde
|
||||
return (p->bufferBase != 0);
|
||||
}
|
||||
|
||||
-Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
|
||||
-Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
|
||||
+static Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
|
||||
+static Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
|
||||
|
||||
-UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
|
||||
+static UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
|
||||
|
||||
-void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
|
||||
+static void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
|
||||
{
|
||||
p->posLimit -= subValue;
|
||||
p->pos -= subValue;
|
||||
@@ -268,7 +268,7 @@ static void MatchFinder_SetLimits(CMatch
|
||||
p->posLimit = p->pos + limit;
|
||||
}
|
||||
|
||||
-void MatchFinder_Init(CMatchFinder *p)
|
||||
+static void MatchFinder_Init(CMatchFinder *p)
|
||||
{
|
||||
UInt32 i;
|
||||
for (i = 0; i < p->hashSizeSum; i++)
|
||||
@@ -287,7 +287,7 @@ static UInt32 MatchFinder_GetSubValue(CM
|
||||
return (p->pos - p->historySize - 1) & kNormalizeMask;
|
||||
}
|
||||
|
||||
-void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
|
||||
+static void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
|
||||
{
|
||||
UInt32 i;
|
||||
for (i = 0; i < numItems; i++)
|
||||
@@ -350,7 +350,7 @@ static UInt32 * Hc_GetMatchesSpec(UInt32
|
||||
}
|
||||
}
|
||||
|
||||
-UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
|
||||
+static UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
|
||||
UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
|
||||
UInt32 *distances, UInt32 maxLen)
|
||||
{
|
||||
@@ -492,7 +492,7 @@ static UInt32 Bt2_MatchFinder_GetMatches
|
||||
GET_MATCHES_FOOTER(offset, 1)
|
||||
}
|
||||
|
||||
-UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
||||
+static __maybe_unused UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
||||
{
|
||||
UInt32 offset;
|
||||
GET_MATCHES_HEADER(3)
|
||||
@@ -632,7 +632,7 @@ static UInt32 Hc4_MatchFinder_GetMatches
|
||||
MOVE_POS_RET
|
||||
}
|
||||
|
||||
-UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
||||
+static __maybe_unused UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
||||
{
|
||||
UInt32 offset;
|
||||
GET_MATCHES_HEADER(3)
|
||||
@@ -657,7 +657,7 @@ static void Bt2_MatchFinder_Skip(CMatchF
|
||||
while (--num != 0);
|
||||
}
|
||||
|
||||
-void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
||||
+static __maybe_unused void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
||||
{
|
||||
do
|
||||
{
|
||||
@@ -718,7 +718,7 @@ static void Hc4_MatchFinder_Skip(CMatchF
|
||||
while (--num != 0);
|
||||
}
|
||||
|
||||
-void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
||||
+static __maybe_unused void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
||||
{
|
||||
do
|
||||
{
|
@ -1,53 +0,0 @@
|
||||
--- a/fs/jffs2/build.c
|
||||
+++ b/fs/jffs2/build.c
|
||||
@@ -114,6 +114,16 @@ static int jffs2_build_filesystem(struct
|
||||
dbg_fsbuild("scanned flash completely\n");
|
||||
jffs2_dbg_dump_block_lists_nolock(c);
|
||||
|
||||
+ if (c->flags & (1 << 7)) {
|
||||
+ printk("%s(): unlocking the mtd device... ", __func__);
|
||||
+ mtd_unlock(c->mtd, 0, c->mtd->size);
|
||||
+ printk("done.\n");
|
||||
+
|
||||
+ printk("%s(): erasing all blocks after the end marker... ", __func__);
|
||||
+ jffs2_erase_pending_blocks(c, -1);
|
||||
+ printk("done.\n");
|
||||
+ }
|
||||
+
|
||||
dbg_fsbuild("pass 1 starting\n");
|
||||
c->flags |= JFFS2_SB_FLAG_BUILDING;
|
||||
/* Now scan the directory tree, increasing nlink according to every dirent found. */
|
||||
--- a/fs/jffs2/scan.c
|
||||
+++ b/fs/jffs2/scan.c
|
||||
@@ -148,8 +148,11 @@ int jffs2_scan_medium(struct jffs2_sb_in
|
||||
/* reset summary info for next eraseblock scan */
|
||||
jffs2_sum_reset_collected(s);
|
||||
|
||||
- ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
|
||||
- buf_size, s);
|
||||
+ if (c->flags & (1 << 7))
|
||||
+ ret = BLK_STATE_ALLFF;
|
||||
+ else
|
||||
+ ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
|
||||
+ buf_size, s);
|
||||
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
@@ -556,6 +559,17 @@ static int jffs2_scan_eraseblock (struct
|
||||
return err;
|
||||
}
|
||||
|
||||
+ if ((buf[0] == 0xde) &&
|
||||
+ (buf[1] == 0xad) &&
|
||||
+ (buf[2] == 0xc0) &&
|
||||
+ (buf[3] == 0xde)) {
|
||||
+ /* end of filesystem. erase everything after this point */
|
||||
+ printk("%s(): End of filesystem marker found at 0x%x\n", __func__, jeb->offset);
|
||||
+ c->flags |= (1 << 7);
|
||||
+
|
||||
+ return BLK_STATE_ALLFF;
|
||||
+ }
|
||||
+
|
||||
/* We temporarily use 'ofs' as a pointer into the buffer/jeb */
|
||||
ofs = 0;
|
||||
max_ofs = EMPTY_SCAN_SIZE(c->sector_size);
|
@ -1,146 +0,0 @@
|
||||
--- a/crypto/Kconfig
|
||||
+++ b/crypto/Kconfig
|
||||
@@ -1181,6 +1181,13 @@ config CRYPTO_842
|
||||
help
|
||||
This is the 842 algorithm.
|
||||
|
||||
+config CRYPTO_XZ
|
||||
+ tristate "XZ compression algorithm"
|
||||
+ select CRYPTO_ALGAPI
|
||||
+ select XZ_DEC
|
||||
+ help
|
||||
+ This is the XZ algorithm. Only decompression is supported for now.
|
||||
+
|
||||
comment "Random Number Generation"
|
||||
|
||||
config CRYPTO_ANSI_CPRNG
|
||||
--- a/crypto/Makefile
|
||||
+++ b/crypto/Makefile
|
||||
@@ -82,6 +82,7 @@ obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += mich
|
||||
obj-$(CONFIG_CRYPTO_CRC32C) += crc32c.o
|
||||
obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o
|
||||
obj-$(CONFIG_CRYPTO_LZO) += lzo.o
|
||||
+obj-$(CONFIG_CRYPTO_XZ) += xz.o
|
||||
obj-$(CONFIG_CRYPTO_842) += 842.o
|
||||
obj-$(CONFIG_CRYPTO_RNG2) += rng.o
|
||||
obj-$(CONFIG_CRYPTO_RNG2) += krng.o
|
||||
--- /dev/null
|
||||
+++ b/crypto/xz.c
|
||||
@@ -0,0 +1,117 @@
|
||||
+/*
|
||||
+ * Cryptographic API.
|
||||
+ *
|
||||
+ * XZ decompression support.
|
||||
+ *
|
||||
+ * Copyright (c) 2012 Gabor Juhos <juhosg@openwrt.org>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 as published by
|
||||
+ * the Free Software Foundation.
|
||||
+ *
|
||||
+ */
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/crypto.h>
|
||||
+#include <linux/xz.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/mm.h>
|
||||
+#include <linux/net.h>
|
||||
+
|
||||
+struct xz_comp_ctx {
|
||||
+ struct xz_dec *decomp_state;
|
||||
+ struct xz_buf decomp_buf;
|
||||
+};
|
||||
+
|
||||
+static int crypto_xz_decomp_init(struct xz_comp_ctx *ctx)
|
||||
+{
|
||||
+ ctx->decomp_state = xz_dec_init(XZ_SINGLE, 0);
|
||||
+ if (!ctx->decomp_state)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void crypto_xz_decomp_exit(struct xz_comp_ctx *ctx)
|
||||
+{
|
||||
+ xz_dec_end(ctx->decomp_state);
|
||||
+}
|
||||
+
|
||||
+static int crypto_xz_init(struct crypto_tfm *tfm)
|
||||
+{
|
||||
+ struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||
+
|
||||
+ return crypto_xz_decomp_init(ctx);
|
||||
+}
|
||||
+
|
||||
+static void crypto_xz_exit(struct crypto_tfm *tfm)
|
||||
+{
|
||||
+ struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||
+
|
||||
+ crypto_xz_decomp_exit(ctx);
|
||||
+}
|
||||
+
|
||||
+static int crypto_xz_compress(struct crypto_tfm *tfm, const u8 *src,
|
||||
+ unsigned int slen, u8 *dst, unsigned int *dlen)
|
||||
+{
|
||||
+ return -EOPNOTSUPP;
|
||||
+}
|
||||
+
|
||||
+static int crypto_xz_decompress(struct crypto_tfm *tfm, const u8 *src,
|
||||
+ unsigned int slen, u8 *dst, unsigned int *dlen)
|
||||
+{
|
||||
+ struct xz_comp_ctx *dctx = crypto_tfm_ctx(tfm);
|
||||
+ struct xz_buf *xz_buf = &dctx->decomp_buf;
|
||||
+ int ret;
|
||||
+
|
||||
+ memset(xz_buf, '\0', sizeof(struct xz_buf));
|
||||
+
|
||||
+ xz_buf->in = (u8 *) src;
|
||||
+ xz_buf->in_pos = 0;
|
||||
+ xz_buf->in_size = slen;
|
||||
+ xz_buf->out = (u8 *) dst;
|
||||
+ xz_buf->out_pos = 0;
|
||||
+ xz_buf->out_size = *dlen;
|
||||
+
|
||||
+ ret = xz_dec_run(dctx->decomp_state, xz_buf);
|
||||
+ if (ret != XZ_STREAM_END) {
|
||||
+ ret = -EINVAL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ *dlen = xz_buf->out_pos;
|
||||
+ ret = 0;
|
||||
+
|
||||
+out:
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static struct crypto_alg crypto_xz_alg = {
|
||||
+ .cra_name = "xz",
|
||||
+ .cra_flags = CRYPTO_ALG_TYPE_COMPRESS,
|
||||
+ .cra_ctxsize = sizeof(struct xz_comp_ctx),
|
||||
+ .cra_module = THIS_MODULE,
|
||||
+ .cra_list = LIST_HEAD_INIT(crypto_xz_alg.cra_list),
|
||||
+ .cra_init = crypto_xz_init,
|
||||
+ .cra_exit = crypto_xz_exit,
|
||||
+ .cra_u = { .compress = {
|
||||
+ .coa_compress = crypto_xz_compress,
|
||||
+ .coa_decompress = crypto_xz_decompress } }
|
||||
+};
|
||||
+
|
||||
+static int __init crypto_xz_mod_init(void)
|
||||
+{
|
||||
+ return crypto_register_alg(&crypto_xz_alg);
|
||||
+}
|
||||
+
|
||||
+static void __exit crypto_xz_mod_exit(void)
|
||||
+{
|
||||
+ crypto_unregister_alg(&crypto_xz_alg);
|
||||
+}
|
||||
+
|
||||
+module_init(crypto_xz_mod_init);
|
||||
+module_exit(crypto_xz_mod_exit);
|
||||
+
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
+MODULE_DESCRIPTION("Crypto XZ decompression support");
|
||||
+MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
|
@ -1,92 +0,0 @@
|
||||
--- a/fs/ubifs/Kconfig
|
||||
+++ b/fs/ubifs/Kconfig
|
||||
@@ -5,8 +5,10 @@ config UBIFS_FS
|
||||
select CRYPTO if UBIFS_FS_ADVANCED_COMPR
|
||||
select CRYPTO if UBIFS_FS_LZO
|
||||
select CRYPTO if UBIFS_FS_ZLIB
|
||||
+ select CRYPTO if UBIFS_FS_XZ
|
||||
select CRYPTO_LZO if UBIFS_FS_LZO
|
||||
select CRYPTO_DEFLATE if UBIFS_FS_ZLIB
|
||||
+ select CRYPTO_XZ if UBIFS_FS_XZ
|
||||
depends on MTD_UBI
|
||||
help
|
||||
UBIFS is a file system for flash devices which works on top of UBI.
|
||||
@@ -35,3 +37,12 @@ config UBIFS_FS_ZLIB
|
||||
default y
|
||||
help
|
||||
Zlib compresses better than LZO but it is slower. Say 'Y' if unsure.
|
||||
+
|
||||
+config UBIFS_FS_XZ
|
||||
+ bool "XZ decompression support" if UBIFS_FS_ADVANCED_COMPR
|
||||
+ depends on UBIFS_FS
|
||||
+ default y
|
||||
+ help
|
||||
+ XZ compresses better the ZLIB but it is slower..
|
||||
+ Say 'Y' if unsure.
|
||||
+
|
||||
--- a/fs/ubifs/compress.c
|
||||
+++ b/fs/ubifs/compress.c
|
||||
@@ -71,6 +71,24 @@ static struct ubifs_compressor zlib_comp
|
||||
};
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_UBIFS_FS_XZ
|
||||
+static DEFINE_MUTEX(xz_enc_mutex);
|
||||
+static DEFINE_MUTEX(xz_dec_mutex);
|
||||
+
|
||||
+static struct ubifs_compressor xz_compr = {
|
||||
+ .compr_type = UBIFS_COMPR_XZ,
|
||||
+ .comp_mutex = &xz_enc_mutex,
|
||||
+ .decomp_mutex = &xz_dec_mutex,
|
||||
+ .name = "xz",
|
||||
+ .capi_name = "xz",
|
||||
+};
|
||||
+#else
|
||||
+static struct ubifs_compressor xz_compr = {
|
||||
+ .compr_type = UBIFS_COMPR_XZ,
|
||||
+ .name = "xz",
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
/* All UBIFS compressors */
|
||||
struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
|
||||
|
||||
@@ -232,9 +250,15 @@ int __init ubifs_compressors_init(void)
|
||||
if (err)
|
||||
goto out_lzo;
|
||||
|
||||
+ err = compr_init(&xz_compr);
|
||||
+ if (err)
|
||||
+ goto out_zlib;
|
||||
+
|
||||
ubifs_compressors[UBIFS_COMPR_NONE] = &none_compr;
|
||||
return 0;
|
||||
|
||||
+out_zlib:
|
||||
+ compr_exit(&zlib_compr);
|
||||
out_lzo:
|
||||
compr_exit(&lzo_compr);
|
||||
return err;
|
||||
@@ -247,4 +271,5 @@ void ubifs_compressors_exit(void)
|
||||
{
|
||||
compr_exit(&lzo_compr);
|
||||
compr_exit(&zlib_compr);
|
||||
+ compr_exit(&xz_compr);
|
||||
}
|
||||
--- a/fs/ubifs/ubifs-media.h
|
||||
+++ b/fs/ubifs/ubifs-media.h
|
||||
@@ -332,12 +332,14 @@ enum {
|
||||
* UBIFS_COMPR_NONE: no compression
|
||||
* UBIFS_COMPR_LZO: LZO compression
|
||||
* UBIFS_COMPR_ZLIB: ZLIB compression
|
||||
+ * UBIFS_COMPR_XZ: XZ compression
|
||||
* UBIFS_COMPR_TYPES_CNT: count of supported compression types
|
||||
*/
|
||||
enum {
|
||||
UBIFS_COMPR_NONE,
|
||||
UBIFS_COMPR_LZO,
|
||||
UBIFS_COMPR_ZLIB,
|
||||
+ UBIFS_COMPR_XZ,
|
||||
UBIFS_COMPR_TYPES_CNT,
|
||||
};
|
||||
|
@ -1,67 +0,0 @@
|
||||
--- a/fs/ubifs/file.c
|
||||
+++ b/fs/ubifs/file.c
|
||||
@@ -1574,6 +1574,12 @@ const struct inode_operations ubifs_syml
|
||||
.follow_link = ubifs_follow_link,
|
||||
.setattr = ubifs_setattr,
|
||||
.getattr = ubifs_getattr,
|
||||
+#ifdef CONFIG_UBIFS_FS_XATTR
|
||||
+ .setxattr = ubifs_setxattr,
|
||||
+ .getxattr = ubifs_getxattr,
|
||||
+ .listxattr = ubifs_listxattr,
|
||||
+ .removexattr = ubifs_removexattr,
|
||||
+#endif
|
||||
};
|
||||
|
||||
const struct file_operations ubifs_file_operations = {
|
||||
--- a/fs/ubifs/journal.c
|
||||
+++ b/fs/ubifs/journal.c
|
||||
@@ -553,7 +553,8 @@ int ubifs_jnl_update(struct ubifs_info *
|
||||
|
||||
dbg_jnl("ino %lu, dent '%.*s', data len %d in dir ino %lu",
|
||||
inode->i_ino, nm->len, nm->name, ui->data_len, dir->i_ino);
|
||||
- ubifs_assert(dir_ui->data_len == 0);
|
||||
+ if (!xent)
|
||||
+ ubifs_assert(dir_ui->data_len == 0);
|
||||
ubifs_assert(mutex_is_locked(&dir_ui->ui_mutex));
|
||||
|
||||
dlen = UBIFS_DENT_NODE_SZ + nm->len + 1;
|
||||
@@ -573,6 +574,13 @@ int ubifs_jnl_update(struct ubifs_info *
|
||||
aligned_dlen = ALIGN(dlen, 8);
|
||||
aligned_ilen = ALIGN(ilen, 8);
|
||||
len = aligned_dlen + aligned_ilen + UBIFS_INO_NODE_SZ;
|
||||
+ if (xent) {
|
||||
+ /*
|
||||
+ * Make sure to account for dir_ui->data_len in
|
||||
+ * length calculation in case there is extended attribute.
|
||||
+ */
|
||||
+ len += dir_ui->data_len;
|
||||
+ }
|
||||
dent = kmalloc(len, GFP_NOFS);
|
||||
if (!dent)
|
||||
return -ENOMEM;
|
||||
@@ -649,7 +657,8 @@ int ubifs_jnl_update(struct ubifs_info *
|
||||
|
||||
ino_key_init(c, &ino_key, dir->i_ino);
|
||||
ino_offs += aligned_ilen;
|
||||
- err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs, UBIFS_INO_NODE_SZ);
|
||||
+ err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs,
|
||||
+ UBIFS_INO_NODE_SZ + dir_ui->data_len);
|
||||
if (err)
|
||||
goto out_ro;
|
||||
|
||||
--- a/fs/ubifs/xattr.c
|
||||
+++ b/fs/ubifs/xattr.c
|
||||
@@ -209,12 +209,12 @@ static int change_xattr(struct ubifs_inf
|
||||
goto out_free;
|
||||
}
|
||||
inode->i_size = ui->ui_size = size;
|
||||
- ui->data_len = size;
|
||||
|
||||
mutex_lock(&host_ui->ui_mutex);
|
||||
host->i_ctime = ubifs_current_time(host);
|
||||
host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len);
|
||||
host_ui->xattr_size += CALC_XATTR_BYTES(size);
|
||||
+ ui->data_len = size;
|
||||
|
||||
/*
|
||||
* It is important to write the host inode after the xattr inode
|
@ -1,29 +0,0 @@
|
||||
--- a/fs/ubifs/sb.c
|
||||
+++ b/fs/ubifs/sb.c
|
||||
@@ -63,6 +63,17 @@
|
||||
/* Default time granularity in nanoseconds */
|
||||
#define DEFAULT_TIME_GRAN 1000000000
|
||||
|
||||
+static int get_default_compressor(void)
|
||||
+{
|
||||
+ if (ubifs_compr_present(UBIFS_COMPR_LZO))
|
||||
+ return UBIFS_COMPR_LZO;
|
||||
+
|
||||
+ if (ubifs_compr_present(UBIFS_COMPR_ZLIB))
|
||||
+ return UBIFS_COMPR_ZLIB;
|
||||
+
|
||||
+ return UBIFS_COMPR_NONE;
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* create_default_filesystem - format empty UBI volume.
|
||||
* @c: UBIFS file-system description object
|
||||
@@ -183,7 +194,7 @@ static int create_default_filesystem(str
|
||||
if (c->mount_opts.override_compr)
|
||||
sup->default_compr = cpu_to_le16(c->mount_opts.compr_type);
|
||||
else
|
||||
- sup->default_compr = cpu_to_le16(UBIFS_COMPR_LZO);
|
||||
+ sup->default_compr = cpu_to_le16(get_default_compressor());
|
||||
|
||||
generate_random_uuid(sup->uuid);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,108 +0,0 @@
|
||||
--- a/include/linux/netfilter/xt_layer7.h
|
||||
+++ b/include/linux/netfilter/xt_layer7.h
|
||||
@@ -8,6 +8,7 @@ struct xt_layer7_info {
|
||||
char protocol[MAX_PROTOCOL_LEN];
|
||||
char pattern[MAX_PATTERN_LEN];
|
||||
u_int8_t invert;
|
||||
+ u_int8_t pkt;
|
||||
};
|
||||
|
||||
#endif /* _XT_LAYER7_H */
|
||||
--- a/net/netfilter/xt_layer7.c
|
||||
+++ b/net/netfilter/xt_layer7.c
|
||||
@@ -314,33 +314,35 @@ static int match_no_append(struct nf_con
|
||||
}
|
||||
|
||||
/* add the new app data to the conntrack. Return number of bytes added. */
|
||||
-static int add_data(struct nf_conn * master_conntrack,
|
||||
- char * app_data, int appdatalen)
|
||||
+static int add_datastr(char *target, int offset, char *app_data, int len)
|
||||
{
|
||||
int length = 0, i;
|
||||
- int oldlength = master_conntrack->layer7.app_data_len;
|
||||
-
|
||||
- /* This is a fix for a race condition by Deti Fliegl. However, I'm not
|
||||
- clear on whether the race condition exists or whether this really
|
||||
- fixes it. I might just be being dense... Anyway, if it's not really
|
||||
- a fix, all it does is waste a very small amount of time. */
|
||||
- if(!master_conntrack->layer7.app_data) return 0;
|
||||
+ if (!target) return 0;
|
||||
|
||||
/* Strip nulls. Make everything lower case (our regex lib doesn't
|
||||
do case insensitivity). Add it to the end of the current data. */
|
||||
- for(i = 0; i < maxdatalen-oldlength-1 &&
|
||||
- i < appdatalen; i++) {
|
||||
+ for(i = 0; i < maxdatalen-offset-1 && i < len; i++) {
|
||||
if(app_data[i] != '\0') {
|
||||
/* the kernel version of tolower mungs 'upper ascii' */
|
||||
- master_conntrack->layer7.app_data[length+oldlength] =
|
||||
+ target[length+offset] =
|
||||
isascii(app_data[i])?
|
||||
tolower(app_data[i]) : app_data[i];
|
||||
length++;
|
||||
}
|
||||
}
|
||||
+ target[length+offset] = '\0';
|
||||
+
|
||||
+ return length;
|
||||
+}
|
||||
+
|
||||
+/* add the new app data to the conntrack. Return number of bytes added. */
|
||||
+static int add_data(struct nf_conn * master_conntrack,
|
||||
+ char * app_data, int appdatalen)
|
||||
+{
|
||||
+ int length;
|
||||
|
||||
- master_conntrack->layer7.app_data[length+oldlength] = '\0';
|
||||
- master_conntrack->layer7.app_data_len = length + oldlength;
|
||||
+ length = add_datastr(master_conntrack->layer7.app_data, master_conntrack->layer7.app_data_len, app_data, appdatalen);
|
||||
+ master_conntrack->layer7.app_data_len += length;
|
||||
|
||||
return length;
|
||||
}
|
||||
@@ -438,7 +440,7 @@ match(const struct sk_buff *skbin,
|
||||
|
||||
enum ip_conntrack_info master_ctinfo, ctinfo;
|
||||
struct nf_conn *master_conntrack, *conntrack;
|
||||
- unsigned char * app_data;
|
||||
+ unsigned char *app_data, *tmp_data;
|
||||
unsigned int pattern_result, appdatalen;
|
||||
regexp * comppattern;
|
||||
|
||||
@@ -466,8 +468,8 @@ match(const struct sk_buff *skbin,
|
||||
master_conntrack = master_ct(master_conntrack);
|
||||
|
||||
/* if we've classified it or seen too many packets */
|
||||
- if(total_acct_packets(master_conntrack) > num_packets ||
|
||||
- master_conntrack->layer7.app_proto) {
|
||||
+ if(!info->pkt && (total_acct_packets(master_conntrack) > num_packets ||
|
||||
+ master_conntrack->layer7.app_proto)) {
|
||||
|
||||
pattern_result = match_no_append(conntrack, master_conntrack,
|
||||
ctinfo, master_ctinfo, info);
|
||||
@@ -500,6 +502,25 @@ match(const struct sk_buff *skbin,
|
||||
/* the return value gets checked later, when we're ready to use it */
|
||||
comppattern = compile_and_cache(info->pattern, info->protocol);
|
||||
|
||||
+ if (info->pkt) {
|
||||
+ tmp_data = kmalloc(maxdatalen, GFP_ATOMIC);
|
||||
+ if(!tmp_data){
|
||||
+ if (net_ratelimit())
|
||||
+ printk(KERN_ERR "layer7: out of memory in match, bailing.\n");
|
||||
+ return info->invert;
|
||||
+ }
|
||||
+
|
||||
+ tmp_data[0] = '\0';
|
||||
+ add_datastr(tmp_data, 0, app_data, appdatalen);
|
||||
+ pattern_result = ((comppattern && regexec(comppattern, tmp_data)) ? 1 : 0);
|
||||
+
|
||||
+ kfree(tmp_data);
|
||||
+ tmp_data = NULL;
|
||||
+ spin_unlock_bh(&l7_lock);
|
||||
+
|
||||
+ return (pattern_result ^ info->invert);
|
||||
+ }
|
||||
+
|
||||
/* On the first packet of a connection, allocate space for app data */
|
||||
if(total_acct_packets(master_conntrack) == 1 && !skb->cb[0] &&
|
||||
!master_conntrack->layer7.app_data){
|
@ -1,51 +0,0 @@
|
||||
--- a/net/netfilter/xt_layer7.c
|
||||
+++ b/net/netfilter/xt_layer7.c
|
||||
@@ -415,7 +415,9 @@ static int layer7_write_proc(struct file
|
||||
}
|
||||
|
||||
static bool
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
|
||||
+match(const struct sk_buff *skbin, struct xt_action_param *par)
|
||||
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
|
||||
match(const struct sk_buff *skbin, const struct xt_match_param *par)
|
||||
#else
|
||||
match(const struct sk_buff *skbin,
|
||||
@@ -597,14 +599,19 @@ match(const struct sk_buff *skbin,
|
||||
}
|
||||
|
||||
// load nf_conntrack_ipv4
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
|
||||
+static int
|
||||
+#else
|
||||
+static bool
|
||||
+#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
|
||||
-static bool check(const struct xt_mtchk_param *par)
|
||||
+check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
if (nf_ct_l3proto_try_module_get(par->match->family) < 0) {
|
||||
printk(KERN_WARNING "can't load conntrack support for "
|
||||
"proto=%d\n", par->match->family);
|
||||
#else
|
||||
-static bool check(const char *tablename, const void *inf,
|
||||
+check(const char *tablename, const void *inf,
|
||||
const struct xt_match *match, void *matchinfo,
|
||||
unsigned int hook_mask)
|
||||
{
|
||||
@@ -612,9 +619,15 @@ static bool check(const char *tablename,
|
||||
printk(KERN_WARNING "can't load conntrack support for "
|
||||
"proto=%d\n", match->family);
|
||||
#endif
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ return 0;
|
||||
+#else
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user