NetBSD-Users archive

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

Re: iwn 5100AGN for netbsd-5 success



I finally got my iwn 5100 device working on netbsd-5.

Here is my solution for iwn 5100 AGN devices on netbsd-5
Tested on netbsd release 5.0.2, should work for any netbsd-5 release

After extracting the netbsd-5 kernel sources, change the following
files in /usr/src/sys/dev/pci:

1. Replace the netbsd-5 version of if_iwn.c (revision 1.22.4.3) with
   revision 1.33 of the same file

2. Replace the netbsd-5 version of if_iwnreg.h (revision 1.4) with
   revision 1.6 of the same file

3. Replace the netbsd-5 version of if_iwnvar.h (revision 1.4) with
   revision 1.6 of the same file

4. Add the firmware (iwlwifi-5000-1.ucode) for the 5100 AGN devices to
the /libdata/firmware/if_iwn directory (download it from Intel's website)

5. Apply the following patch in the /usr/src/sys/dev/pci directory and
   then build and install the new kernel:
   (This patches if_iwn.c revision 1.33 with two small changes for netbsd-5
   compatibility and adds necessary revisions to pcidevs, pcidevs.h,
   pcidevs_data.h, and pcireg.h).

--- if_iwn.c    2009-09-10 20:28:20.000000000 -0500
+++ if_iwn.c    2010-12-17 11:31:52.000000000 -0600
@@ -1,6 +1,10 @@
 /*    $NetBSD: if_iwn.c,v 1.33 2009/09/11 01:28:20 christos Exp $    */
 /*    $OpenBSD: if_iwn.c,v 1.49 2009/03/29 21:53:52 sthen Exp $    */
-
+/*-
+ *    This file is modified for use with netbsd-5 release kernels
+ *    The changes in revision 1.25 of iwn.c have been removed
+ *    The iwn_ioctl routine was modified to remove case SIOCSIFADDR:
+ */
 /*-
  * Copyright (c) 2007, 2008
  *    Damien Bergamini <damien.bergamini%free.fr@localhost>
@@ -3194,11 +3198,7 @@
     s = splnet();

     switch (cmd) {
-    case SIOCSIFADDR:
-        /* FALLTHROUGH */
     case SIOCSIFFLAGS:
-        if ((error = ifioctl_common(ifp, cmd, data)) != 0)
-            break;
         if (ifp->if_flags & IFF_UP) {
             /*
              * resync the radio state just in case we missed
--- pcidevs.h    2009-03-20 08:02:17.000000000 -0500
+++ pcidevs.h    2010-12-10 07:59:27.000000000 -0600
@@ -1,12 +1,16 @@
-/* $NetBSD: pcidevs.h,v 1.963.4.1 2009/03/20 13:02:17 msaitoh Exp $ */
+/*    $NetBSD$    */

 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *    NetBSD: pcidevs,v 1.962 2008/10/15 18:30:29 bouyer Exp
+ *    NetBSD: pcidevs,v 1.962.4.1 2009/03/20 13:01:35 msaitoh Exp
  */

+/*-
+ *    This file is modified for use with netbsd-5 release kernels
+ *    The new 5100AGN iwn devices have been added
+ */
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
  * All rights reserved.
@@ -2595,6 +2599,12 @@
#define PCI_PRODUCT_INTEL_PRO_WL_3945ABG_2 0x4227 /* PRO/Wireless LAN 3945ABG Mini-PCI Adapter */ #define PCI_PRODUCT_INTEL_PRO_WL_4965AGN_1 0x4229 /* PRO/Wireless LAN 4965AGN Mini-PCI Adapter */ #define PCI_PRODUCT_INTEL_PRO_WL_4965AGN_2 0x4230 /* PRO/Wireless LAN 4965AGN Mini-PCI Adapter */ +#define PCI_PRODUCT_INTEL_PRO_WL_5100AGN_1 0x4232 /* PRO/Wireless LAN 5100AGN Mini-PCI Adapter */ +#define PCI_PRODUCT_INTEL_PRO_WL_5300AGN_1 0x4235 /* PRO/Wireless LAN 5300AGN Mini-PCI Adapter */ +#define PCI_PRODUCT_INTEL_PRO_WL_5300AGN_2 0x4236 /* PRO/Wireless LAN 5300AGN Mini-PCI Adapter */ +#define PCI_PRODUCT_INTEL_PRO_WL_5100AGN_2 0x4237 /* PRO/Wireless LAN 5100AGN Mini-PCI Adapter */ +#define PCI_PRODUCT_INTEL_PRO_WL_5350AGN_1 0x423a /* PRO/Wireless LAN 5350AGN Mini-PCI Adapter */ +#define PCI_PRODUCT_INTEL_PRO_WL_5350AGN_2 0x423b /* PRO/Wireless LAN 5350AGN Mini-PCI Adapter */
 #define    PCI_PRODUCT_INTEL_80312_ATU    0x530d        /* 80310 ATU */
#define PCI_PRODUCT_INTEL_82371SB_ISA 0x7000 /* 82371SB (PIIX3) PCI-ISA Bridge */ #define PCI_PRODUCT_INTEL_82371SB_IDE 0x7010 /* 82371SB (PIIX3) IDE Interface */
--- pcidevs    2009-03-20 08:01:35.000000000 -0500
+++ pcidevs    2010-12-10 07:59:27.000000000 -0600
@@ -1,5 +1,9 @@
 $NetBSD: pcidevs,v 1.962.4.1 2009/03/20 13:01:35 msaitoh Exp $

+/*-
+ *    This file is modified for use with netbsd-5 release kernels
+ *    The new 5100AGN iwn devices have been added
+ */
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
  * All rights reserved.
@@ -2588,6 +2592,12 @@
product INTEL PRO_WL_3945ABG_2 0x4227 PRO/Wireless LAN 3945ABG Mini-PCI Adapter product INTEL PRO_WL_4965AGN_1 0x4229 PRO/Wireless LAN 4965AGN Mini-PCI Adapter product INTEL PRO_WL_4965AGN_2 0x4230 PRO/Wireless LAN 4965AGN Mini-PCI Adapter +product INTEL PRO_WL_5100AGN_1 0x4232 PRO/Wireless LAN 5100AGN Mini-PCI Adapter +product INTEL PRO_WL_5300AGN_1 0x4235 PRO/Wireless LAN 5300AGN Mini-PCI Adapter +product INTEL PRO_WL_5300AGN_2 0x4236 PRO/Wireless LAN 5300AGN Mini-PCI Adapter +product INTEL PRO_WL_5100AGN_2 0x4237 PRO/Wireless LAN 5100AGN Mini-PCI Adapter +product INTEL PRO_WL_5350AGN_1 0x423a PRO/Wireless LAN 5350AGN Mini-PCI Adapter +product INTEL PRO_WL_5350AGN_2 0x423b PRO/Wireless LAN 5350AGN Mini-PCI Adapter
 product INTEL 80312_ATU        0x530d    80310 ATU
 product INTEL 82371SB_ISA    0x7000    82371SB (PIIX3) PCI-ISA Bridge
 product INTEL 82371SB_IDE    0x7010    82371SB (PIIX3) IDE Interface
--- pcidevs_data.h    2009-03-20 08:02:17.000000000 -0500
+++ pcidevs_data.h    2010-12-10 07:59:27.000000000 -0600
@@ -1,12 +1,16 @@
-/* $NetBSD: pcidevs_data.h,v 1.962.4.1 2009/03/20 13:02:17 msaitoh Exp $ */
+/*    $NetBSD$    */

 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *    NetBSD: pcidevs,v 1.962 2008/10/15 18:30:29 bouyer Exp
+ *    NetBSD: pcidevs,v 1.962.4.1 2009/03/20 13:01:35 msaitoh Exp
  */

+/*-
+ *    This file is modified for use with netbsd-5 release kernels
+ *    The new 5100AGN iwn devices have been added
+ */
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
  * All rights reserved.
@@ -9208,6 +9212,30 @@
         "PRO/Wireless LAN 4965AGN Mini-PCI Adapter",
     },
     {
+        PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_WL_5100AGN_1,
+        "PRO/Wireless LAN 5100AGN Mini-PCI Adapter",
+    },
+    {
+        PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_WL_5300AGN_1,
+        "PRO/Wireless LAN 5300AGN Mini-PCI Adapter",
+    },
+    {
+        PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_WL_5300AGN_2,
+        "PRO/Wireless LAN 5300AGN Mini-PCI Adapter",
+    },
+    {
+        PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_WL_5100AGN_2,
+        "PRO/Wireless LAN 5100AGN Mini-PCI Adapter",
+    },
+    {
+        PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_WL_5350AGN_1,
+        "PRO/Wireless LAN 5350AGN Mini-PCI Adapter",
+    },
+    {
+        PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_WL_5350AGN_2,
+        "PRO/Wireless LAN 5350AGN Mini-PCI Adapter",
+    },
+    {
         PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_80312_ATU,
         "80310 ATU",
     },
@@ -14512,4 +14540,4 @@
         "Video Controller",
     },
 };
-const int pci_nproducts = 3027;
+const int pci_nproducts = 3033;
--- pcireg.h    2007-12-25 12:33:42.000000000 -0600
+++ pcireg.h    2010-12-10 07:59:27.000000000 -0600
@@ -1,5 +1,9 @@
-/*    $NetBSD: pcireg.h,v 1.57 2007/12/25 18:33:42 perry Exp $    */
-
+/*    $NetBSD: pcireg.h,v 1.61 2009/09/11 01:28:20 christos Exp $    */
+/*-
+ *    This file is modified for use with netbsd-5 release kernels
+ *    The changes in revisions 1.58, 1.59, and 1.60 of pcireg.h
+ *    have been removed
+ */
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
  *     Christopher G. Demetriou.  All rights reserved.
@@ -536,6 +540,42 @@
 #define        PCI_PCIX_STATUS_MAXRS_128K    0x1c000000
 #define PCI_PCIX_STATUS_SCERR            0x20000000

+/*
+ * PCI Express; access via capability pointer.
+ */
+#define PCI_PCIE_XCAP        0x00
+#define PCI_PCIE_XCAP_SI    0x01000000
+#define PCI_PCIE_DCAP        0x04
+#define PCI_PCIE_DCSR        0x08
+#define PCI_PCIE_DCSR_ENA_NO_SNOOP    0x00000800
+#define PCI_PCIE_LCAP        0x0c
+#define PCI_PCIE_LCSR        0x10
+#define PCI_PCIE_LCSR_ASPM_L0S    0x00000001
+#define PCI_PCIE_LCSR_ASPM_L1    0x00000002
+#define PCI_PCIE_SLCAP        0x14
+#define PCI_PCIE_SLCAP_ABP    0x00000001
+#define PCI_PCIE_SLCAP_PCP    0x00000002
+#define PCI_PCIE_SLCAP_MSP    0x00000004
+#define PCI_PCIE_SLCAP_AIP    0x00000008
+#define PCI_PCIE_SLCAP_PIP    0x00000010
+#define PCI_PCIE_SLCAP_HPS    0x00000020
+#define PCI_PCIE_SLCAP_HPC    0x00000040
+#define PCI_PCIE_SLCSR        0x18
+#define PCI_PCIE_SLCSR_ABE    0x00000001
+#define PCI_PCIE_SLCSR_PFE    0x00000002
+#define PCI_PCIE_SLCSR_MSE    0x00000004
+#define PCI_PCIE_SLCSR_PDE    0x00000008
+#define PCI_PCIE_SLCSR_CCE    0x00000010
+#define PCI_PCIE_SLCSR_HPE    0x00000020
+#define PCI_PCIE_SLCSR_ABP    0x00010000
+#define PCI_PCIE_SLCSR_PFD    0x00020000
+#define PCI_PCIE_SLCSR_MSC    0x00040000
+#define PCI_PCIE_SLCSR_PDC    0x00080000
+#define PCI_PCIE_SLCSR_CC    0x00100000
+#define PCI_PCIE_SLCSR_MS    0x00200000
+#define PCI_PCIE_SLCSR_PDS    0x00400000
+#define PCI_PCIE_SLCSR_LACS    0x01000000
+#define PCI_PCIE_RCSR        0x1c

 /*
  * Interrupt Configuration Register; contains interrupt pin and line.


On 12/10/2010 9:25 PM, Chuck Zmudzinski wrote:
Well I need to do more work on this...

I got a chance to test netbsd-5 my iwn patch on a real wireless network and it was not functional on netbsd-5. I could get a dhcp lease, but no functional connection. When I tried to ping the router, I got the following message on the console:

arpresolve: can't allocate llinfo on iwn0 for 192.168.6.1

I used a netbsd-current kernel using the same version of if_iwn.c as in my patch to netbsd-5 (netbsd-current kernel from late September 2009) on the same wireless network and it is functional with full internet connectivity on iwn0.


-----Original Message-----
From: Chuck Zmudzinski <brchuckz%netscape.net@localhost>
To: netbsd-users%netbsd.org@localhost
Sent: Fri, Dec 10, 2010 11:55 am
Subject: iwn 5100AGN for netbsd-5 success


I saw in the mailing list archives a few weeks back that iwn(4) for 5100/5300 AGN devices was working in netbsd-current but hasn't been ported to netbsd-5 yet. I decided to try and get it working in netbsd-5 with minimal changes to the netbsd-5 kernel sources and have had some success.

Seven files were patched in src/sys/dev/pci: if_iwn.c, if_iwnreg.h if_iwnvar.h, pcidevs, pcidevs.h pcidevs_data.h, and pcireg.h.

The details:

1. Used the first of version of src/sys/dev/if_iwn.c that works with the 5100/5300 iwn devices from the current branch (revision 1.33), but removed the two lines associated with revision 1.25 of src/sys/dev/if_iwn.c. The iwn(4) driver failed in netbsd-5 with that revision included - that revision was part of a major commit to the netbsd-current kernel networking code.

2. Used the first version of src/sys/dev/if_iwnreg.h that works with the 5100/5300 iwn devices from the current branch (revision 1.6).

3. Used the first version of src/sys/dev/if_iwnvar.h that works with the 5100/5300 iwn devices from the current branch (revision 1.6).)

4. Edited the src/sys/dev/pcidevs file to add the new iwn devices (these changes are derived from additions to pcidevs between revision 1.967 and 1.968 of src/sys/dev/pcidevs, but I changed "Pro/Wireless" to "PRO/Wireless" for consistency with the other devices):

product INTEL PRO_WL_5100AGN_1 0x4232 PRO/Wireless LAN 5100AGN Mini-PCI Adapter product INTEL PRO_WL_5300AGN_1 0x4235 PRO/Wireless LAN 5300AGN Mini-PCI Adapter product INTEL PRO_WL_5300AGN_2 0x4236 PRO/Wireless LAN 5300AGN Mini-PCI Adapter product INTEL PRO_WL_5100AGN_2 0x4237 PRO/Wireless LAN 5100AGN Mini-PCI Adapter product INTEL PRO_WL_5350AGN_1 0x423a PRO/Wireless LAN 5350AGN Mini-PCI Adapter product INTEL PRO_WL_5350AGN_2 0x423b PRO/Wireless LAN 5350AGN Mini-PCI Adapter

5. Regenerated src/sys/dev/pcidevs.h and src/sys/dev/pcidevs_data.h using 'make -f Makefile.pcidevs'

6. Edited the src/sys/dev/pcireg.h file to add the changes that were included in the changes to pcireg.h when the support was added for the new iwn(4) devices in netbsd-current. It is essentially revision 1.57 (the netbsd-5 version) of pcireg.h patched with the changes between revision 1.60 and 1.61 of pcireg.h.

7. Added the updated firmware for the 5100 AGN to my filesystem.

The 5100 iwn(4) device in my Toshiba laptop successfully runs 'dhclient iwn0' in my patched netbsd-5 kernel (I am using the 5.0.2 release) where it listened for dhcp offers, but I haven't tested it with an actual wireless network in range yet to see if it makes a connection - I assume it will work with a network in range; if it doesn't when I try it I'll post a followup message.

The actual patchfile against the netbsd-5 kernel is too big to post here (about 300K) because the difference in if_iwn.c between the netbsd-5 version (revision 1.22.4.3 I think) and revision 1.33 is rather large.







Home | Main Index | Thread Index | Old Index