diff --git a/debian/changelog b/debian/changelog index a1a424261..8676411fe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,11 @@ linux-2.6 (2.6.37~rc8-1~experimental.1) UNRELEASED; urgency=low * watchdog: Improve failure message and documentation (Closes: #608138) * [x86] Staging: Enable R8712U as module (r8712u, replacing r8192s_usb) - Enable loading external firmware, thanks to Stefan Lippers-Hollmann + * linux-base: Look for GRUB 1 configuration in both /boot/grub and + /boot/boot/grub (Closes: #607863) + * btrfs: Require CAP_SYS_ADMIN for filesystem rebalance (Closes: #608185) + * r8169: Change RTL8111D/RTL8168D initialisation and firmware loading to + match upstream version (Closes: #596390 with firmware-realtek 0.28) -- Ben Hutchings Tue, 28 Dec 2010 03:15:05 +0000 diff --git a/debian/linux-base.postinst b/debian/linux-base.postinst index fc1d33965..b9fb9a02c 100644 --- a/debian/linux-base.postinst +++ b/debian/linux-base.postinst @@ -238,6 +238,15 @@ sub shellvars_quote { ### GRUB 1 (grub-legacy) config +sub grub1_path { + for ('/boot/grub', '/boot/boot/grub') { + if (-d) { + return "$_/menu.lst"; + } + } + return undef; +} + sub grub1_parse { my ($file) = @_; my @results = (); @@ -928,7 +937,7 @@ my @config_files = ({packages => 'mount', list => \&fstab_list, update => \&fstab_update}, {packages => 'grub grub-legacy', - path => '/boot/grub/menu.lst', + path => grub1_path(), list => \&grub1_list, update => \&grub1_update, post_update => \&grub1_post, diff --git a/debian/patches/bugfix/all/btrfs-Require-CAP_SYS_ADMIN-for-filesystem-rebalance.patch b/debian/patches/bugfix/all/btrfs-Require-CAP_SYS_ADMIN-for-filesystem-rebalance.patch new file mode 100644 index 000000000..1adfdcdaa --- /dev/null +++ b/debian/patches/bugfix/all/btrfs-Require-CAP_SYS_ADMIN-for-filesystem-rebalance.patch @@ -0,0 +1,41 @@ +Subject: [PATCH] btrfs: Require CAP_SYS_ADMIN for filesystem rebalance +From: Ben Hutchings +Date: Wed, 29 Dec 2010 14:55:03 +0000 + +Filesystem rebalancing (BTRFS_IOC_BALANCE) affects the entire +filesystem and may run uninterruptibly for a long time. This does not +seem to be something that an unprivileged user should be able to do. + +Reported-by: Aron Xu +Signed-off-by: Ben Hutchings +--- + fs/btrfs/volumes.c | 4 ++++ + 1 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c +index cc04dc1..2313e8b 100644 +--- a/fs/btrfs/volumes.c ++++ b/fs/btrfs/volumes.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + #include + #include "compat.h" + #include "ctree.h" +@@ -1905,6 +1906,9 @@ int btrfs_balance(struct btrfs_root *dev_root) + if (dev_root->fs_info->sb->s_flags & MS_RDONLY) + return -EROFS; + ++ if (!capable(CAP_SYS_ADMIN)) ++ return -EPERM; ++ + mutex_lock(&dev_root->fs_info->volume_mutex); + dev_root = dev_root->fs_info->dev_root; + +-- +1.7.2.3 + + + diff --git a/debian/patches/features/all/r8169-remove-the-firmware-of-RTL8111D.patch b/debian/patches/features/all/r8169-remove-the-firmware-of-RTL8111D.patch new file mode 100644 index 000000000..d6011c0e6 --- /dev/null +++ b/debian/patches/features/all/r8169-remove-the-firmware-of-RTL8111D.patch @@ -0,0 +1,311 @@ +From: Francois Romieu +Date: Mon, 3 Jan 2011 00:35:52 +0100 +Subject: [PATCH] r8169: remove the firmware of RTL8111D. + +commit bca03d5f32c8ee9b5cfa1d32640a63fded6cb3c0 upstream. + +The binary file of the firmware is moved to linux-firmware repository. +The firmwares are rtl_nic/rtl8168d-1.fw and rtl_nic/rtl8168d-2.fw. +The driver goes along if the firmware couldn't be found. However, it +is suggested to be done with the suitable firmware. + +Some wrong PHY parameters are directly corrected in the driver. + +Simple firmware checking added per Ben Hutchings suggestion. + +Signed-off-by: Hayes Wang +Signed-off-by: Francois Romieu +Cc: Ben Hutchings +Signed-off-by: David S. Miller +[bwh: Adjust for Debian's 2.6.37] +--- + drivers/net/Kconfig | 1 + + drivers/net/r8169.c | 157 ++++++++++++++++++++++++++++++++++++++++++++------- + 2 files changed, 138 insertions(+), 20 deletions(-) + +diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig +index 4f1755b..c647651 100644 +--- a/drivers/net/Kconfig ++++ b/drivers/net/Kconfig +@@ -2233,6 +2233,7 @@ config YELLOWFIN + config R8169 + tristate "Realtek 8169 gigabit ethernet support" + depends on PCI ++ select FW_LOADER + select CRC32 + select MII + ---help--- +diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c +index c9c6f0a..49a6db6 100644 +--- a/drivers/net/r8169.c ++++ b/drivers/net/r8169.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -33,6 +34,9 @@ + #define MODULENAME "r8169" + #define PFX MODULENAME ": " + ++#define FIRMWARE_8168D_1 "rtl_nic/rtl8168d-1.fw" ++#define FIRMWARE_8168D_2 "rtl_nic/rtl8168d-2.fw" ++ + #ifdef RTL8169_DEBUG + #define assert(expr) \ + if (!(expr)) { \ +@@ -514,6 +518,8 @@ module_param_named(debug, debug.msg_enable, int, 0); + MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)"); + MODULE_LICENSE("GPL"); + MODULE_VERSION(RTL8169_VERSION); ++MODULE_FIRMWARE(FIRMWARE_8168D_1); ++MODULE_FIRMWARE(FIRMWARE_8168D_2); + + static int rtl8169_open(struct net_device *dev); + static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, +@@ -1393,6 +1399,65 @@ static void rtl_phy_write(void __iomem *ioaddr, const struct phy_reg *regs, int + } + } + ++#define PHY_READ 0x00000000 ++#define PHY_DATA_OR 0x10000000 ++#define PHY_DATA_AND 0x20000000 ++#define PHY_BJMPN 0x30000000 ++#define PHY_READ_EFUSE 0x40000000 ++#define PHY_READ_MAC_BYTE 0x50000000 ++#define PHY_WRITE_MAC_BYTE 0x60000000 ++#define PHY_CLEAR_READCOUNT 0x70000000 ++#define PHY_WRITE 0x80000000 ++#define PHY_READCOUNT_EQ_SKIP 0x90000000 ++#define PHY_COMP_EQ_SKIPN 0xa0000000 ++#define PHY_COMP_NEQ_SKIPN 0xb0000000 ++#define PHY_WRITE_PREVIOUS 0xc0000000 ++#define PHY_SKIPN 0xd0000000 ++#define PHY_DELAY_MS 0xe0000000 ++#define PHY_WRITE_ERI_WORD 0xf0000000 ++ ++static void ++rtl_phy_write_fw(struct rtl8169_private *tp, const struct firmware *fw) ++{ ++ void __iomem *ioaddr = tp->mmio_addr; ++ __le32 *phytable = (__le32 *)fw->data; ++ struct net_device *dev = tp->dev; ++ size_t i; ++ ++ if (fw->size % sizeof(*phytable)) { ++ netif_err(tp, probe, dev, "odd sized firmware %zd\n", fw->size); ++ return; ++ } ++ ++ for (i = 0; i < fw->size / sizeof(*phytable); i++) { ++ u32 action = le32_to_cpu(phytable[i]); ++ ++ if (!action) ++ break; ++ ++ if ((action & 0xf0000000) != PHY_WRITE) { ++ netif_err(tp, probe, dev, ++ "unknown action 0x%08x\n", action); ++ return; ++ } ++ } ++ ++ while (i-- != 0) { ++ u32 action = le32_to_cpu(*phytable); ++ u32 data = action & 0x0000ffff; ++ u32 reg = (action & 0x0fff0000) >> 16; ++ ++ switch(action & 0xf0000000) { ++ case PHY_WRITE: ++ mdio_write(ioaddr, reg, data); ++ phytable++; ++ break; ++ default: ++ BUG(); ++ } ++ } ++} ++ + static void rtl8169s_hw_phy_config(void __iomem *ioaddr) + { + static const struct phy_reg phy_reg_init[] = { +@@ -1725,9 +1790,10 @@ static void rtl8168c_4_hw_phy_config(void __iomem *ioaddr) + rtl8168c_3_hw_phy_config(ioaddr); + } + +-static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr) ++static void rtl8168d_1_hw_phy_config(struct rtl8169_private *tp) + { + static const struct phy_reg phy_reg_init_0[] = { ++ /* Channel Estimation */ + { 0x1f, 0x0001 }, + { 0x06, 0x4064 }, + { 0x07, 0x2863 }, +@@ -1744,24 +1810,41 @@ static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr) + { 0x12, 0xf49f }, + { 0x13, 0x070b }, + { 0x1a, 0x05ad }, +- { 0x14, 0x94c0 } +- }; +- static const struct phy_reg phy_reg_init_1[] = { ++ { 0x14, 0x94c0 }, ++ ++ /* ++ * Tx Error Issue ++ * enhance line driver power ++ */ + { 0x1f, 0x0002 }, + { 0x06, 0x5561 }, + { 0x1f, 0x0005 }, + { 0x05, 0x8332 }, +- { 0x06, 0x5561 } ++ { 0x06, 0x5561 }, ++ ++ /* ++ * Can not link to 1Gbps with bad cable ++ * Decrease SNR threshold form 21.07dB to 19.04dB ++ */ ++ { 0x1f, 0x0001 }, ++ { 0x17, 0x0cc0 }, ++ ++ { 0x1f, 0x0000 }, ++ { 0x0d, 0xf880 } + }; ++ void __iomem *ioaddr = tp->mmio_addr; ++ const struct firmware *fw; + + rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0)); + ++ /* ++ * Rx Error Issue ++ * Fine Tune Switching regulator parameter ++ */ + mdio_write(ioaddr, 0x1f, 0x0002); + mdio_plus_minus(ioaddr, 0x0b, 0x0010, 0x00ef); + mdio_plus_minus(ioaddr, 0x0c, 0xa200, 0x5d00); + +- rtl_phy_write(ioaddr, phy_reg_init_1, ARRAY_SIZE(phy_reg_init_1)); +- + if (rtl8168d_efuse_read(ioaddr, 0x01) == 0xb1) { + static const struct phy_reg phy_reg_init[] = { + { 0x1f, 0x0002 }, +@@ -1802,22 +1885,33 @@ static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr) + rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); + } + ++ /* RSET couple improve */ + mdio_write(ioaddr, 0x1f, 0x0002); + mdio_patch(ioaddr, 0x0d, 0x0300); + mdio_patch(ioaddr, 0x0f, 0x0010); + ++ /* Fine tune PLL performance */ + mdio_write(ioaddr, 0x1f, 0x0002); + mdio_plus_minus(ioaddr, 0x02, 0x0100, 0x0600); + mdio_plus_minus(ioaddr, 0x03, 0x0000, 0xe000); + +-#ifdef CONFIG_BROKEN +- rtl_phy_write(ioaddr, phy_reg_init_2, ARRAY_SIZE(phy_reg_init_2)); +-#endif ++ mdio_write(ioaddr, 0x1f, 0x0005); ++ mdio_write(ioaddr, 0x05, 0x001b); ++ if (mdio_read(ioaddr, 0x06) == 0xbf00 && ++ request_firmware(&fw, FIRMWARE_8168D_1, &tp->pci_dev->dev) == 0) { ++ rtl_phy_write_fw(tp, fw); ++ release_firmware(fw); ++ } else { ++ netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n"); ++ } ++ ++ mdio_write(ioaddr, 0x1f, 0x0000); + } + +-static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr) ++static void rtl8168d_2_hw_phy_config(struct rtl8169_private *tp) + { + static const struct phy_reg phy_reg_init_0[] = { ++ /* Channel Estimation */ + { 0x1f, 0x0001 }, + { 0x06, 0x4064 }, + { 0x07, 0x2863 }, +@@ -1836,12 +1930,28 @@ static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr) + { 0x1a, 0x05ad }, + { 0x14, 0x94c0 }, + ++ /* ++ * Tx Error Issue ++ * enhance line driver power ++ */ + { 0x1f, 0x0002 }, + { 0x06, 0x5561 }, + { 0x1f, 0x0005 }, + { 0x05, 0x8332 }, +- { 0x06, 0x5561 } ++ { 0x06, 0x5561 }, ++ ++ /* ++ * Can not link to 1Gbps with bad cable ++ * Decrease SNR threshold form 21.07dB to 19.04dB ++ */ ++ { 0x1f, 0x0001 }, ++ { 0x17, 0x0cc0 }, ++ ++ { 0x1f, 0x0000 }, ++ { 0x0d, 0xf880 } + }; ++ void __iomem *ioaddr = tp->mmio_addr; ++ const struct firmware *fw; + + rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0)); + +@@ -1885,19 +1995,26 @@ static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr) + rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); + } + ++ /* Fine tune PLL performance */ + mdio_write(ioaddr, 0x1f, 0x0002); + mdio_plus_minus(ioaddr, 0x02, 0x0100, 0x0600); + mdio_plus_minus(ioaddr, 0x03, 0x0000, 0xe000); + +- mdio_write(ioaddr, 0x1f, 0x0001); +- mdio_write(ioaddr, 0x17, 0x0cc0); +- ++ /* Switching regulator Slew rate */ + mdio_write(ioaddr, 0x1f, 0x0002); + mdio_patch(ioaddr, 0x0f, 0x0017); + +-#ifdef CONFIG_BROKEN +- rtl_phy_write(ioaddr, phy_reg_init_1, ARRAY_SIZE(phy_reg_init_1)); +-#endif ++ mdio_write(ioaddr, 0x1f, 0x0005); ++ mdio_write(ioaddr, 0x05, 0x001b); ++ if (mdio_read(ioaddr, 0x06) == 0xb300 && ++ request_firmware(&fw, FIRMWARE_8168D_2, &tp->pci_dev->dev) == 0) { ++ rtl_phy_write_fw(tp, fw); ++ release_firmware(fw); ++ } else { ++ netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n"); ++ } ++ ++ mdio_write(ioaddr, 0x1f, 0x0000); + } + + static void rtl8168d_3_hw_phy_config(void __iomem *ioaddr) +@@ -2035,10 +2152,10 @@ static void rtl_hw_phy_config(struct net_device *dev) + rtl8168cp_2_hw_phy_config(ioaddr); + break; + case RTL_GIGA_MAC_VER_25: +- rtl8168d_1_hw_phy_config(ioaddr); ++ rtl8168d_1_hw_phy_config(tp); + break; + case RTL_GIGA_MAC_VER_26: +- rtl8168d_2_hw_phy_config(ioaddr); ++ rtl8168d_2_hw_phy_config(tp); + break; + case RTL_GIGA_MAC_VER_27: + rtl8168d_3_hw_phy_config(ioaddr); +-- +1.7.2.3 + diff --git a/debian/patches/features/all/r8169-rtl8168d-1-2-request_firmware-2.patch b/debian/patches/features/all/r8169-rtl8168d-1-2-request_firmware-2.patch deleted file mode 100644 index 09bb70eb5..000000000 --- a/debian/patches/features/all/r8169-rtl8168d-1-2-request_firmware-2.patch +++ /dev/null @@ -1,135 +0,0 @@ -From: Ben Hutchings -Subject: [PATCH] r8169: remove firmware for RTL8169D PHY - -The recently added support for RTL8169D chips included some machine -code without accompanying source code. Replace this with use of the -firmware loader. - ---- a/drivers/net/Kconfig -+++ b/drivers/net/Kconfig -@@ -2172,6 +2172,7 @@ config R8169 - depends on PCI - select CRC32 - select MII -+ select FW_LOADER - ---help--- - Say Y here if you have a Realtek 8169 PCI Gigabit Ethernet adapter. - ---- a/drivers/net/r8169.c -+++ b/drivers/net/r8169.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -1359,6 +1360,23 @@ static void rtl_phy_write(void __iomem *ioaddr, struct phy_reg *regs, int len) - } - } - -+struct phy_reg_le { -+ __le16 reg; -+ __le16 val; -+}; -+ -+static void rtl_phy_write_fw(void __iomem *ioaddr, const struct firmware *fw) -+{ -+ const struct phy_reg_le *regs = (const struct phy_reg_le *)fw->data; -+ size_t len = fw->size / sizeof(*regs); -+ -+ while (len-- > 0) { -+ mdio_write(ioaddr, le16_to_cpu(regs->reg), -+ le16_to_cpu(regs->val)); -+ regs++; -+ } -+} -+ - static void rtl8169s_hw_phy_config(void __iomem *ioaddr) - { - static const struct phy_reg phy_reg_init[] = { -@@ -1691,7 +1709,7 @@ static void rtl8168c_4_hw_phy_config(void __iomem *ioaddr) - rtl8168c_3_hw_phy_config(ioaddr); - } - --static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr) -+static void rtl8168d_1_hw_phy_config(struct rtl8169_private *tp) - { - static const struct phy_reg phy_reg_init_0[] = { - { 0x1f, 0x0001 }, -@@ -1719,6 +1737,8 @@ static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr) - { 0x05, 0x8332 }, - { 0x06, 0x5561 } - }; -+ void __iomem *ioaddr = tp->mmio_addr; -+ const struct firmware *fw; - - rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0)); - -@@ -1776,12 +1801,18 @@ static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr) - mdio_plus_minus(ioaddr, 0x02, 0x0100, 0x0600); - mdio_plus_minus(ioaddr, 0x03, 0x0000, 0xe000); - --#ifdef CONFIG_BROKEN -- rtl_phy_write(ioaddr, phy_reg_init_2, ARRAY_SIZE(phy_reg_init_2)); --#endif -+ if (request_firmware(&fw, "rtl8168d-1.fw", &tp->pci_dev->dev) == 0) { -+ rtl_phy_write_fw(ioaddr, fw); -+ release_firmware(fw); -+ } else { -+ printk(KERN_WARNING "%s: unable to apply firmware patch\n", -+ tp->dev->name); -+ } - } - --static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr) -+MODULE_FIRMWARE("rtl8168d-1.fw"); -+ -+static void rtl8168d_2_hw_phy_config(struct rtl8169_private *tp) - { - static const struct phy_reg phy_reg_init_0[] = { - { 0x1f, 0x0001 }, -@@ -1808,6 +1836,8 @@ static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr) - { 0x05, 0x8332 }, - { 0x06, 0x5561 } - }; -+ void __iomem *ioaddr = tp->mmio_addr; -+ const struct firmware *fw; - - rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0)); - -@@ -1861,11 +1896,17 @@ static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr) - mdio_write(ioaddr, 0x1f, 0x0002); - mdio_patch(ioaddr, 0x0f, 0x0017); - --#ifdef CONFIG_BROKEN -- rtl_phy_write(ioaddr, phy_reg_init_1, ARRAY_SIZE(phy_reg_init_1)); --#endif -+ if (request_firmware(&fw, "rtl8168d-2.fw", &tp->pci_dev->dev) == 0) { -+ rtl_phy_write_fw(ioaddr, fw); -+ release_firmware(fw); -+ } else { -+ printk(KERN_WARNING "%s: unable to apply firmware patch\n", -+ tp->dev->name); -+ } - } - -+MODULE_FIRMWARE("rtl8168d-2.fw"); -+ - static void rtl8168d_3_hw_phy_config(void __iomem *ioaddr) - { - static const struct phy_reg phy_reg_init[] = { -@@ -2001,10 +2039,10 @@ static int rtl_hw_phy_config(struct net_device *dev) - rtl8168cp_2_hw_phy_config(ioaddr); - break; - case RTL_GIGA_MAC_VER_25: -- rtl8168d_1_hw_phy_config(ioaddr); -+ rtl8168d_1_hw_phy_config(tp); - break; - case RTL_GIGA_MAC_VER_26: -- rtl8168d_2_hw_phy_config(ioaddr); -+ rtl8168d_2_hw_phy_config(tp); - break; - case RTL_GIGA_MAC_VER_27: - rtl8168d_3_hw_phy_config(ioaddr); diff --git a/debian/patches/series/base b/debian/patches/series/base index fcb1d1467..491a0a945 100644 --- a/debian/patches/series/base +++ b/debian/patches/series/base @@ -4,7 +4,6 @@ + features/all/drivers-media-dvb-usb-af9005-request_firmware.patch -+ features/all/r8169-rtl8168d-1-2-request_firmware-2.patch + features/all/sound-pci-cs46xx-request_firmware.patch # patches from aufs2 repository, with s/EXPORT_SYMBOL/&_GPL/ @@ -49,3 +48,5 @@ + features/all/watchdog-Improve-failure-message-and-documentation.patch + features/all/r8712u-Switch-driver-to-use-external-firmware.patch + features/all/r8712u-Fix-external-firmware-loading.patch ++ bugfix/all/btrfs-Require-CAP_SYS_ADMIN-for-filesystem-rebalance.patch ++ features/all/r8169-remove-the-firmware-of-RTL8111D.patch