From 5def204f5176d729be2f4aeeef42a9096969856f Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 17 Aug 2009 01:29:35 +0000 Subject: [PATCH] ib_ipath: remove firmware for QLogic IBA7220 and use request_firmware() to load it svn path=/dists/trunk/linux-2.6/; revision=14127 --- debian/changelog | 2 + ...-infiniband-hw-ipath-iba7220-disable.patch | 63 +++++ debian/patches/debian/dfsg/files-1 | 2 + ...w-ipath-iba7220-use-request_firmware.patch | 230 ++++++++++++++++++ debian/patches/series/base | 2 + debian/patches/series/orig-0 | 1 + 6 files changed, 300 insertions(+) create mode 100644 debian/patches/debian/dfsg/drivers-infiniband-hw-ipath-iba7220-disable.patch create mode 100644 debian/patches/features/all/drivers-infiniband-hw-ipath-iba7220-use-request_firmware.patch diff --git a/debian/changelog b/debian/changelog index 746f19fe0..1ac056aa7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -48,6 +48,8 @@ linux-2.6 (2.6.31~rc6-1~experimental.1) UNRELEASED; urgency=low * snd-cs46xx: reenable using external firmware (closes: #464197, but note that Debian cannot currently distribute the firmware), thanks to Kalle Olavi Niemitalo + * ib_ipath: remove firmware for QLogic IBA7220 and use + request_firmware() to load it [ Martin Michlmayr ] * [armel/orion5x, armel/kirkwood] Set GPIO_SYSFS=y since these diff --git a/debian/patches/debian/dfsg/drivers-infiniband-hw-ipath-iba7220-disable.patch b/debian/patches/debian/dfsg/drivers-infiniband-hw-ipath-iba7220-disable.patch new file mode 100644 index 000000000..41cf9509f --- /dev/null +++ b/debian/patches/debian/dfsg/drivers-infiniband-hw-ipath-iba7220-disable.patch @@ -0,0 +1,63 @@ +From 3b33fb5615618bb666f2dea6713b4e888e2eae7a Mon Sep 17 00:00:00 2001 +From: Ben Hutchings +Date: Mon, 17 Aug 2009 01:18:50 +0100 +Subject: [PATCH 1/3] ib_ipath: Disable support for IBA7220 + +IBA7220 requires non-free firmware which is about to be removed. +--- + drivers/infiniband/hw/ipath/Makefile | 8 ++++---- + drivers/infiniband/hw/ipath/ipath_driver.c | 4 ++++ + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/drivers/infiniband/hw/ipath/Makefile b/drivers/infiniband/hw/ipath/Makefile +index bf94500..42d8d4c 100644 +--- a/drivers/infiniband/hw/ipath/Makefile ++++ b/drivers/infiniband/hw/ipath/Makefile +@@ -29,10 +29,10 @@ ib_ipath-y := \ + ipath_user_pages.o \ + ipath_user_sdma.o \ + ipath_verbs_mcast.o \ +- ipath_verbs.o \ +- ipath_iba7220.o \ +- ipath_sd7220.o \ +- ipath_sd7220_img.o ++ ipath_verbs.o ++ ++# IBA7220 depends on firmware to be removed ++ib_ipath-$(CONFIG_BROKEN) += ipath_iba7220.o ipath_sd7220.o + + ib_ipath-$(CONFIG_HT_IRQ) += ipath_iba6110.o + ib_ipath-$(CONFIG_PCI_MSI) += ipath_iba6120.o +diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c +index 04e88b6..20407a0 100644 +--- a/drivers/infiniband/hw/ipath/ipath_driver.c ++++ b/drivers/infiniband/hw/ipath/ipath_driver.c +@@ -140,7 +140,9 @@ static int __devinit ipath_init_one(struct pci_dev *, + static const struct pci_device_id ipath_pci_tbl[] = { + { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_HT) }, + { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_PE800) }, ++#ifdef CONFIG_BROKEN + { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_INFINIPATH_7220) }, ++#endif + { 0, } + }; + +@@ -535,6 +537,7 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, + "CONFIG_PCI_MSI is not enabled\n", ent->device); + return -ENODEV; + #endif ++#ifdef CONFIG_BROKEN + case PCI_DEVICE_ID_INFINIPATH_7220: + #ifndef CONFIG_PCI_MSI + ipath_dbg("CONFIG_PCI_MSI is not enabled, " +@@ -542,6 +545,7 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, + #endif + ipath_init_iba7220_funcs(dd); + break; ++#endif + default: + ipath_dev_err(dd, "Found unknown QLogic deviceid 0x%x, " + "failing\n", ent->device); +-- +1.6.3.3 + diff --git a/debian/patches/debian/dfsg/files-1 b/debian/patches/debian/dfsg/files-1 index c6867fdd3..4462b2db9 100644 --- a/debian/patches/debian/dfsg/files-1 +++ b/debian/patches/debian/dfsg/files-1 @@ -38,6 +38,8 @@ unifdef drivers/gpu/drm/r128/r128_cce.c -UREMOVE_DFSG rm drivers/gpu/drm/radeon/*_microcode.h +rm drivers/infiniband/hw/ipath/ipath_sd7220_img.c + rm drivers/net/appletalk/cops.c rm drivers/net/appletalk/cops.h rm drivers/net/appletalk/cops_ffdrv.h diff --git a/debian/patches/features/all/drivers-infiniband-hw-ipath-iba7220-use-request_firmware.patch b/debian/patches/features/all/drivers-infiniband-hw-ipath-iba7220-use-request_firmware.patch new file mode 100644 index 000000000..2a7bc1349 --- /dev/null +++ b/debian/patches/features/all/drivers-infiniband-hw-ipath-iba7220-use-request_firmware.patch @@ -0,0 +1,230 @@ +From 1e9da7da73886eaf63449e56ebf16cf7daa4a9e5 Mon Sep 17 00:00:00 2001 +From: Ben Hutchings +Date: Mon, 17 Aug 2009 02:17:09 +0100 +Subject: [PATCH 3/3] ib_ipath: use request_firmware() to load SD7220 firmware + +--- + drivers/infiniband/hw/ipath/Makefile | 7 ++-- + drivers/infiniband/hw/ipath/ipath_7220.h | 7 ---- + drivers/infiniband/hw/ipath/ipath_driver.c | 4 -- + drivers/infiniband/hw/ipath/ipath_sd7220.c | 49 ++++++++++++++++++++++----- + 4 files changed, 43 insertions(+), 24 deletions(-) + +diff --git a/drivers/infiniband/hw/ipath/Makefile b/drivers/infiniband/hw/ipath/Makefile +index 42d8d4c..fc892cf 100644 +--- a/drivers/infiniband/hw/ipath/Makefile ++++ b/drivers/infiniband/hw/ipath/Makefile +@@ -29,10 +29,9 @@ ib_ipath-y := \ + ipath_user_pages.o \ + ipath_user_sdma.o \ + ipath_verbs_mcast.o \ +- ipath_verbs.o +- +-# IBA7220 depends on firmware to be removed +-ib_ipath-$(CONFIG_BROKEN) += ipath_iba7220.o ipath_sd7220.o ++ ipath_verbs.o \ ++ ipath_iba7220.o \ ++ ipath_sd7220.o + + ib_ipath-$(CONFIG_HT_IRQ) += ipath_iba6110.o + ib_ipath-$(CONFIG_PCI_MSI) += ipath_iba6120.o +diff --git a/drivers/infiniband/hw/ipath/ipath_7220.h b/drivers/infiniband/hw/ipath/ipath_7220.h +index 74fa5cc..29a73e0 100644 +--- a/drivers/infiniband/hw/ipath/ipath_7220.h ++++ b/drivers/infiniband/hw/ipath/ipath_7220.h +@@ -40,10 +40,6 @@ + */ + int ipath_sd7220_presets(struct ipath_devdata *dd); + int ipath_sd7220_init(struct ipath_devdata *dd, int was_reset); +-int ipath_sd7220_prog_ld(struct ipath_devdata *dd, int sdnum, u8 *img, +- int len, int offset); +-int ipath_sd7220_prog_vfy(struct ipath_devdata *dd, int sdnum, const u8 *img, +- int len, int offset); + /* + * Below used for sdnum parameter, selecting one of the two sections + * used for PCIe, or the single SerDes used for IB, which is the +@@ -51,7 +47,4 @@ int ipath_sd7220_prog_vfy(struct ipath_devdata *dd, int sdnum, const u8 *img, + */ + #define IB_7220_SERDES 2 + +-int ipath_sd7220_ib_load(struct ipath_devdata *dd); +-int ipath_sd7220_ib_vfy(struct ipath_devdata *dd); +- + #endif /* _IPATH_7220_H */ +diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c +index 20407a0..04e88b6 100644 +--- a/drivers/infiniband/hw/ipath/ipath_driver.c ++++ b/drivers/infiniband/hw/ipath/ipath_driver.c +@@ -140,9 +140,7 @@ static int __devinit ipath_init_one(struct pci_dev *, + static const struct pci_device_id ipath_pci_tbl[] = { + { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_HT) }, + { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_PE800) }, +-#ifdef CONFIG_BROKEN + { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_INFINIPATH_7220) }, +-#endif + { 0, } + }; + +@@ -537,7 +535,6 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, + "CONFIG_PCI_MSI is not enabled\n", ent->device); + return -ENODEV; + #endif +-#ifdef CONFIG_BROKEN + case PCI_DEVICE_ID_INFINIPATH_7220: + #ifndef CONFIG_PCI_MSI + ipath_dbg("CONFIG_PCI_MSI is not enabled, " +@@ -545,7 +542,6 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, + #endif + ipath_init_iba7220_funcs(dd); + break; +-#endif + default: + ipath_dev_err(dd, "Found unknown QLogic deviceid 0x%x, " + "failing\n", ent->device); +diff --git a/drivers/infiniband/hw/ipath/ipath_sd7220.c b/drivers/infiniband/hw/ipath/ipath_sd7220.c +index aa47eb5..df3735d 100644 +--- a/drivers/infiniband/hw/ipath/ipath_sd7220.c ++++ b/drivers/infiniband/hw/ipath/ipath_sd7220.c +@@ -37,11 +37,15 @@ + + #include + #include ++#include + + #include "ipath_kernel.h" + #include "ipath_registers.h" + #include "ipath_7220.h" + ++#define SD7220_FW_NAME "qlogic/sd7220.fw" ++MODULE_FIRMWARE(SD7220_FW_NAME); ++ + /* + * The IBSerDesMappTable is a memory that holds values to be stored in + * various SerDes registers by IBC. It is not part of the normal kregs +@@ -88,6 +92,11 @@ static int ipath_internal_presets(struct ipath_devdata *dd); + static int ipath_sd_trimself(struct ipath_devdata *dd, int val); + static int epb_access(struct ipath_devdata *dd, int sdnum, int claim); + ++static int ++ipath_sd7220_ib_load(struct ipath_devdata *dd, const struct firmware *fw); ++static int ++ipath_sd7220_ib_vfy(struct ipath_devdata *dd, const struct firmware *fw); ++ + void ipath_set_relock_poll(struct ipath_devdata *dd, int ibup); + + /* +@@ -98,9 +107,10 @@ void ipath_set_relock_poll(struct ipath_devdata *dd, int ibup); + * ipath_sd7220_init() is no longer valid. Instead, we check for the + * actual uC code having been loaded. + */ +-static int ipath_ibsd_ucode_loaded(struct ipath_devdata *dd) ++static int ++ipath_ibsd_ucode_loaded(struct ipath_devdata *dd, const struct firmware *fw) + { +- if (!dd->serdes_first_init_done && (ipath_sd7220_ib_vfy(dd) > 0)) ++ if (!dd->serdes_first_init_done && (ipath_sd7220_ib_vfy(dd, fw) > 0)) + dd->serdes_first_init_done = 1; + return dd->serdes_first_init_done; + } +@@ -363,6 +373,7 @@ static void ipath_sd_trimdone_monitor(struct ipath_devdata *dd, + */ + int ipath_sd7220_init(struct ipath_devdata *dd, int was_reset) + { ++ const struct firmware *fw; + int ret = 1; /* default to failure */ + int first_reset; + int val_stat; +@@ -373,8 +384,14 @@ int ipath_sd7220_init(struct ipath_devdata *dd, int was_reset) + ipath_sd_trimdone_monitor(dd, "Driver-reload"); + } + ++ ret = request_firmware(&fw, SD7220_FW_NAME, &dd->pcidev->dev); ++ if (ret) { ++ ipath_dev_err(dd, "Failed to load IB SERDES image\n"); ++ goto done; ++ } ++ + /* Substitute our deduced value for was_reset */ +- ret = ipath_ibsd_ucode_loaded(dd); ++ ret = ipath_ibsd_ucode_loaded(dd, fw); + if (ret < 0) { + ret = 1; + goto done; +@@ -431,7 +448,7 @@ int ipath_sd7220_init(struct ipath_devdata *dd, int was_reset) + int vfy; + int trim_done; + ipath_dbg("SerDes uC was reset, reloading PRAM\n"); +- ret = ipath_sd7220_ib_load(dd); ++ ret = ipath_sd7220_ib_load(dd, fw); + if (ret < 0) { + ipath_dev_err(dd, "Failed to load IB SERDES image\n"); + ret = 1; +@@ -439,7 +456,7 @@ int ipath_sd7220_init(struct ipath_devdata *dd, int was_reset) + } + + /* Loaded image, try to verify */ +- vfy = ipath_sd7220_ib_vfy(dd); ++ vfy = ipath_sd7220_ib_vfy(dd, fw); + if (vfy != ret) { + ipath_dev_err(dd, "SERDES PRAM VFY failed\n"); + ret = 1; +@@ -500,6 +517,8 @@ int ipath_sd7220_init(struct ipath_devdata *dd, int was_reset) + done: + /* start relock timer regardless, but start at 1 second */ + ipath_set_relock_poll(dd, -1); ++ ++ release_firmware(fw); + return ret; + } + +@@ -836,8 +855,8 @@ static int ipath_sd7220_ram_xfer(struct ipath_devdata *dd, int sdnum, u32 loc, + + #define PROG_CHUNK 64 + +-int ipath_sd7220_prog_ld(struct ipath_devdata *dd, int sdnum, +- u8 *img, int len, int offset) ++static int ipath_sd7220_prog_ld(struct ipath_devdata *dd, int sdnum, ++ const u8 *img, int len, int offset) + { + int cnt, sofar, req; + +@@ -847,7 +866,7 @@ int ipath_sd7220_prog_ld(struct ipath_devdata *dd, int sdnum, + if (req > PROG_CHUNK) + req = PROG_CHUNK; + cnt = ipath_sd7220_ram_xfer(dd, sdnum, offset + sofar, +- img + sofar, req, 0); ++ (u8 *)img + sofar, req, 0); + if (cnt < req) { + sofar = -1; + break; +@@ -860,7 +879,7 @@ int ipath_sd7220_prog_ld(struct ipath_devdata *dd, int sdnum, + #define VFY_CHUNK 64 + #define SD_PRAM_ERROR_LIMIT 42 + +-int ipath_sd7220_prog_vfy(struct ipath_devdata *dd, int sdnum, ++static int ipath_sd7220_prog_vfy(struct ipath_devdata *dd, int sdnum, + const u8 *img, int len, int offset) + { + int cnt, sofar, req, idx, errors; +@@ -888,6 +907,18 @@ int ipath_sd7220_prog_vfy(struct ipath_devdata *dd, int sdnum, + return errors ? -errors : sofar; + } + ++static int ++ipath_sd7220_ib_load(struct ipath_devdata *dd, const struct firmware *fw) ++{ ++ return ipath_sd7220_prog_ld(dd, IB_7220_SERDES, fw->data, fw->size, 0); ++} ++ ++static int ++ipath_sd7220_ib_vfy(struct ipath_devdata *dd, const struct firmware *fw) ++{ ++ return ipath_sd7220_prog_vfy(dd, IB_7220_SERDES, fw->data, fw->size, 0); ++} ++ + /* IRQ not set up at this point in init, so we poll. */ + #define IB_SERDES_TRIM_DONE (1ULL << 11) + #define TRIM_TMO (30) +-- +1.6.3.3 + diff --git a/debian/patches/series/base b/debian/patches/series/base index 97fdea8f3..916247719 100644 --- a/debian/patches/series/base +++ b/debian/patches/series/base @@ -9,6 +9,8 @@ + features/all/drivers-gpu-drm-mga-request_firmware.patch + features/all/drivers-gpu-drm-r128-request_firmware.patch + features/all/drivers-gpu-drm-radeon-request_firmware.patch +# Enable this for next rc +#+ features/all/drivers-infiniband-hw-ipath-iba7220-use-request_firmware.patch + features/all/drivers-net-cxgb3-request_firmware.patch # rt2860sta and rt2870sta need ITU-T CRC on bit-reversed data + features/all/lib-crcitut-bit-reversed.patch diff --git a/debian/patches/series/orig-0 b/debian/patches/series/orig-0 index 2d64f0c8c..3356c280e 100644 --- a/debian/patches/series/orig-0 +++ b/debian/patches/series/orig-0 @@ -2,6 +2,7 @@ + debian/dfsg/drivers-gpu-drm-mga-disable.patch + debian/dfsg/drivers-gpu-drm-r128-disable.patch + debian/dfsg/drivers-gpu-drm-radeon-disable.patch ++ debian/dfsg/drivers-infiniband-hw-ipath-iba7220-disable.patch + debian/dfsg/drivers-net-appletalk-cops.patch + debian/dfsg/drivers-net-cxgb3-disable.patch + debian/dfsg/drivers-staging-me4000-disable.patch