Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src/sys/dev/pci Pull up following revision(s) (requested by n...



details:   https://anonhg.NetBSD.org/src/rev/576ca9169580
branches:  netbsd-6
changeset: 773951:576ca9169580
user:      riz <riz%NetBSD.org@localhost>
date:      Thu Mar 22 22:55:18 2012 +0000

description:
Pull up following revision(s) (requested by nisimura in ticket #134):
        sys/dev/pci/if_iwi.c: revision 1.90
Unbreak the endian issue in firmware header decoding. Comfirmed good and
running by a powerpc machine.

diffstat:

 sys/dev/pci/if_iwi.c |  25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diffs (62 lines):

diff -r 0644523adb2d -r 576ca9169580 sys/dev/pci/if_iwi.c
--- a/sys/dev/pci/if_iwi.c      Thu Mar 22 22:50:48 2012 +0000
+++ b/sys/dev/pci/if_iwi.c      Thu Mar 22 22:55:18 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_iwi.c,v 1.89 2012/01/30 19:41:20 drochner Exp $  */
+/*     $NetBSD: if_iwi.c,v 1.89.2.1 2012/03/22 22:55:18 riz Exp $  */
 /*     $OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $     */
 
 /*-
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.89 2012/01/30 19:41:20 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.89.2.1 2012/03/22 22:55:18 riz Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@@ -2154,7 +2154,7 @@
 {
        struct iwi_firmware *kfw = &sc->fw;
        firmware_handle_t fwh;
-       const struct iwi_firmware_hdr *hdr;
+       struct iwi_firmware_hdr *hdr;
        off_t size;     
        char *fw;
        int error;
@@ -2192,8 +2192,12 @@
        if (error != 0)
                goto fail2;
 
-
-       hdr = (const struct iwi_firmware_hdr *)sc->sc_blob;
+       hdr = (struct iwi_firmware_hdr *)sc->sc_blob;
+       hdr->version = le32toh(hdr->version);
+       hdr->bsize = le32toh(hdr->bsize);
+       hdr->usize = le32toh(hdr->usize);
+       hdr->fsize = le32toh(hdr->fsize);
+
        if (size < sizeof(struct iwi_firmware_hdr) + hdr->bsize + hdr->usize + hdr->fsize) {
                aprint_error_dev(sc->sc_dev, "image '%s' too small\n",
                    sc->sc_fwname);
@@ -2201,14 +2205,13 @@
                goto fail2;
        }
 
-       hdr = (const struct iwi_firmware_hdr *)sc->sc_blob;
-       DPRINTF(("firmware version = %d\n", le32toh(hdr->version)));
-       if ((IWI_FW_GET_MAJOR(le32toh(hdr->version)) != IWI_FW_REQ_MAJOR) ||
-           (IWI_FW_GET_MINOR(le32toh(hdr->version)) != IWI_FW_REQ_MINOR)) {
+       DPRINTF(("firmware version = %d\n", hdr->version));
+       if ((IWI_FW_GET_MAJOR(hdr->version) != IWI_FW_REQ_MAJOR) ||
+           (IWI_FW_GET_MINOR(hdr->version) != IWI_FW_REQ_MINOR)) {
                aprint_error_dev(sc->sc_dev,
                    "version for '%s' %d.%d != %d.%d\n", sc->sc_fwname,
-                   IWI_FW_GET_MAJOR(le32toh(hdr->version)),
-                   IWI_FW_GET_MINOR(le32toh(hdr->version)),
+                   IWI_FW_GET_MAJOR(hdr->version),
+                   IWI_FW_GET_MINOR(hdr->version),
                    IWI_FW_REQ_MAJOR, IWI_FW_REQ_MINOR);
                error = EIO;
                goto fail2;



Home | Main Index | Thread Index | Old Index