[kernel] r17003 - in dists/squeeze/linux-2.6/debian: . config/kernelarch-x86 patches/features/all patches/series

Ben Hutchings benh at alioth.debian.org
Sun Mar 6 19:20:16 UTC 2011


Author: benh
Date: Sun Mar  6 19:20:04 2011
New Revision: 17003

Log:
[x86] Enable VT6656, loading firmware from a separate file

Added:
   dists/squeeze/linux-2.6/debian/patches/features/all/vt6656-Use-request_firmware-to-load-firmware.patch
Modified:
   dists/squeeze/linux-2.6/debian/changelog
   dists/squeeze/linux-2.6/debian/config/kernelarch-x86/config
   dists/squeeze/linux-2.6/debian/patches/series/31

Modified: dists/squeeze/linux-2.6/debian/changelog
==============================================================================
--- dists/squeeze/linux-2.6/debian/changelog	Sun Mar  6 19:07:19 2011	(r17002)
+++ dists/squeeze/linux-2.6/debian/changelog	Sun Mar  6 19:20:04 2011	(r17003)
@@ -42,6 +42,8 @@
   * drm/i915: Overlay on gen2 can't address above 1G
   * drm/i915: Fix memory corruption with GM965 and >4GB RAM
   * ipv6: Silence privacy extensions initialization (Closes: #590653)
+  * [x86] Enable VT6656, loading firmware from a separate file (requires
+    firmware-linux-nonfree 0.28+squeeze1)
 
   [ dann frazier ]
   * xfs: Fix information leak using stale NFS handle (CVE-2010-2943)

Modified: dists/squeeze/linux-2.6/debian/config/kernelarch-x86/config
==============================================================================
--- dists/squeeze/linux-2.6/debian/config/kernelarch-x86/config	Sun Mar  6 19:07:19 2011	(r17002)
+++ dists/squeeze/linux-2.6/debian/config/kernelarch-x86/config	Sun Mar  6 19:20:04 2011	(r17003)
@@ -1174,6 +1174,11 @@
 CONFIG_USB_IP_HOST=m
 
 ##
+## file: drivers/staging/vt6656/Kconfig
+##
+CONFIG_VT6656=m
+
+##
 ## file: drivers/staging/wlan-ng/Kconfig
 ##
 CONFIG_PRISM2_USB=m

Added: dists/squeeze/linux-2.6/debian/patches/features/all/vt6656-Use-request_firmware-to-load-firmware.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/vt6656-Use-request_firmware-to-load-firmware.patch	Sun Mar  6 19:20:04 2011	(r17003)
@@ -0,0 +1,234 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Sun, 9 Jan 2011 04:16:48 +0000
+Subject: [PATCH] vt6656: Use request_firmware() to load firmware
+
+commit 31d5bbf3da8c3c9de5944f2c09cbc7ea5a72bdb4 upstream.
+
+The file added to linux-firmware is a copy of the current array which
+does not have a recognisable header, so no validation is done.
+
+Change the firmware version check to accept newer versions.
+
+Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
+[bwh: Restore firmware.c without the firmware blob; adjust for 2.6.32]
+---
+--- a/drivers/staging/vt6656/firmware.c
++++ b/drivers/staging/vt6656/firmware.c
+@@ -0,0 +1,175 @@
++/*
++ * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
++ * All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License along
++ * with this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ *
++ * File: baseband.c
++ *
++ * Purpose: Implement functions to access baseband
++ *
++ * Author: Yiching Chen
++ *
++ * Date: May 20, 2004
++ *
++ * Functions:
++ *
++ * Revision History:
++ *
++ */
++
++#include "firmware.h"
++#include "control.h"
++#include "rndis.h"
++
++/*---------------------  Static Definitions -------------------------*/
++
++static int          msglevel                =MSG_LEVEL_INFO;
++//static int          msglevel                =MSG_LEVEL_DEBUG;
++
++#define FIRMWARE_VERSION	0x133		/* version 1.51 */
++#define FIRMWARE_NAME		"vntwusb.fw"
++
++#define FIRMWARE_CHUNK_SIZE	0x400
++
++/*---------------------  Static Classes  ----------------------------*/
++
++/*---------------------  Static Variables  --------------------------*/
++
++/*---------------------  Static Functions  --------------------------*/
++
++/*---------------------  Export Variables  --------------------------*/
++
++/*---------------------  Export Functions  --------------------------*/
++
++
++BOOL
++FIRMWAREbDownload(
++     PSDevice pDevice
++    )
++{
++	const struct firmware *fw;
++	int NdisStatus;
++	void *pBuffer = NULL;
++	BOOL result = FALSE;
++	u16 wLength;
++	int ii;
++
++	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Download firmware\n");
++	spin_unlock_irq(&pDevice->lock);
++
++	if (!pDevice->firmware) {
++		struct device *dev = &pDevice->usb->dev;
++		int rc;
++
++		rc = request_firmware(&pDevice->firmware, FIRMWARE_NAME, dev);
++		if (rc) {
++			dev_err(dev, "firmware file %s request failed (%d)\n",
++				FIRMWARE_NAME, rc);
++			goto out;
++		}
++	}
++	fw = pDevice->firmware;
++
++	pBuffer = kmalloc(FIRMWARE_CHUNK_SIZE, GFP_KERNEL);
++	if (!pBuffer)
++		goto out;
++
++	for (ii = 0; ii < fw->size; ii += FIRMWARE_CHUNK_SIZE) {
++		wLength = min_t(int, fw->size - ii, FIRMWARE_CHUNK_SIZE);
++		memcpy(pBuffer, fw->data + ii, wLength);
++
++		NdisStatus = CONTROLnsRequestOutAsyn(pDevice,
++                                            0,
++                                            0x1200+ii,
++                                            0x0000,
++                                            wLength,
++                                            pBuffer
++                                            );
++
++		DBG_PRT(MSG_LEVEL_DEBUG,
++			KERN_INFO"Download firmware...%d %zu\n", ii, fw->size);
++		if (NdisStatus != STATUS_SUCCESS)
++			goto out;
++        }
++
++	result = TRUE;
++
++out:
++	if (pBuffer)
++		kfree(pBuffer);
++
++	spin_lock_irq(&pDevice->lock);
++	return result;
++}
++MODULE_FIRMWARE(FIRMWARE_NAME);
++
++BOOL
++FIRMWAREbBrach2Sram(
++     PSDevice pDevice
++    )
++{
++    int NdisStatus;
++
++    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Branch to Sram\n");
++
++    NdisStatus = CONTROLnsRequestOut(pDevice,
++                                    1,
++                                    0x1200,
++                                    0x0000,
++                                    0,
++                                    NULL
++                                    );
++
++    if (NdisStatus != STATUS_SUCCESS) {
++        return (FALSE);
++    } else {
++        return (TRUE);
++    }
++}
++
++
++BOOL
++FIRMWAREbCheckVersion(
++     PSDevice pDevice
++    )
++{
++	int ntStatus;
++
++    ntStatus = CONTROLnsRequestIn(pDevice,
++                                    MESSAGE_TYPE_READ,
++                                    0,
++                                    MESSAGE_REQUEST_VERSION,
++                                    2,
++                                    (PBYTE) &(pDevice->wFirmwareVersion));
++
++    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Version [%04x]\n", pDevice->wFirmwareVersion);
++    if (ntStatus != STATUS_SUCCESS) {
++        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Invalid.\n");
++        return FALSE;
++    }
++    if (pDevice->wFirmwareVersion == 0xFFFF) {
++        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"In Loader.\n");
++        return FALSE;
++    }
++    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Firmware Version [%04x]\n", pDevice->wFirmwareVersion);
++    if (pDevice->wFirmwareVersion < FIRMWARE_VERSION) {
++        // branch to loader for download new firmware
++        FIRMWAREbBrach2Sram(pDevice);
++        return FALSE;
++    }
++    return TRUE;
++}
+--- a/drivers/staging/vt6656/Kconfig
++++ b/drivers/staging/vt6656/Kconfig
+@@ -1,6 +1,7 @@ config VT6656
+ config VT6656
+ 	tristate "VIA Technologies VT6656 support"
+ 	depends on WIRELESS_EXT && USB
++	select FW_LOADER
+ 	---help---
+ 	This is a vendor-written driver for VIA VT6656.
+ 
+--- a/drivers/staging/vt6656/device.h
++++ b/drivers/staging/vt6656/device.h
+@@ -56,6 +56,7 @@
+ #include <linux/reboot.h>
+ #include <linux/usb.h>
+ #include <linux/signal.h>
++#include <linux/firmware.h>
+ #include <asm/io.h>
+ #include <asm/uaccess.h>
+ #ifdef SIOCETHTOOL
+@@ -448,6 +449,8 @@ typedef struct __device_info {
+     struct net_device*          dev;
+     struct net_device_stats     stats;
+ 
++    const struct firmware	*firmware;
++
+     OPTIONS                     sOpts;
+ 
+ 	struct tasklet_struct       CmdWorkItem;
+--- a/drivers/staging/vt6656/main_usb.c
++++ b/drivers/staging/vt6656/main_usb.c
+@@ -1315,6 +1315,9 @@ static void __devexit vt6656_disconnect(struct usb_interface *intf)
+ //2008-0714-01<Add>by MikeLiu
+ device_release_WPADEV(pDevice);
+ 
++	if (pDevice->firmware)
++		release_firmware(pDevice->firmware);
++
+ 	usb_set_intfdata(intf, NULL);
+ //2008-0922-01<Add>by MikeLiu, decrease usb counter.
+      usb_put_dev(interface_to_usbdev(intf));

Modified: dists/squeeze/linux-2.6/debian/patches/series/31
==============================================================================
--- dists/squeeze/linux-2.6/debian/patches/series/31	Sun Mar  6 19:07:19 2011	(r17002)
+++ dists/squeeze/linux-2.6/debian/patches/series/31	Sun Mar  6 19:20:04 2011	(r17003)
@@ -54,3 +54,4 @@
 + bugfix/all/drm-i915-overlay-on-gen2-can-t-address-above-1G.patch
 + bugfix/all/drm-i915-fix-memory-corruption-with-GM965-and-4GB-RAM.patch
 + bugfix/all/ipv6-Silence-privacy-extensions-initialization.patch
++ features/all/vt6656-Use-request_firmware-to-load-firmware.patch



More information about the Kernel-svn-changes mailing list