Mon Jan 31 00:01:07 2011 UTC ()
clear register 0x41 as FreeBSD and OpenBSD do. Update copyright to the latest.


(christos)
diff -r1.85 -r1.86 src/sys/dev/pci/if_iwi.c

cvs diff -r1.85 -r1.86 src/sys/dev/pci/if_iwi.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_iwi.c 2010/11/15 05:57:24 1.85
+++ src/sys/dev/pci/if_iwi.c 2011/01/31 00:01:07 1.86
@@ -1,44 +1,35 @@ @@ -1,44 +1,35 @@
1/* $NetBSD: if_iwi.c,v 1.85 2010/11/15 05:57:24 uebayasi Exp $ */ 1/* $NetBSD: if_iwi.c,v 1.86 2011/01/31 00:01:07 christos Exp $ */
 2/* $OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $ */
2 3
3/*- 4/*-
4 * Copyright (c) 2004, 2005 5 * Copyright (c) 2004-2008
5 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. 6 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
6 * 7 *
7 * Redistribution and use in source and binary forms, with or without 8 * Permission to use, copy, modify, and distribute this software for any
8 * modification, are permitted provided that the following conditions 9 * purpose with or without fee is hereby granted, provided that the above
9 * are met: 10 * copyright notice and this permission notice appear in all copies.
10 * 1. Redistributions of source code must retain the above copyright 
11 * notice unmodified, this list of conditions, and the following 
12 * disclaimer. 
13 * 2. Redistributions in binary form must reproduce the above copyright 
14 * notice, this list of conditions and the following disclaimer in the 
15 * documentation and/or other materials provided with the distribution. 
16 * 11 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
27 * SUCH DAMAGE. 
28 */ 19 */
29 20
30#include <sys/cdefs.h> 21#include <sys/cdefs.h>
31__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.85 2010/11/15 05:57:24 uebayasi Exp $"); 22__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.86 2011/01/31 00:01:07 christos Exp $");
32 23
33/*- 24/*-
34 * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver 25 * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
35 * http://www.intel.com/network/connectivity/products/wireless/prowireless_mobile.htm 26 * http://www.intel.com/network/connectivity/products/wireless/prowireless_mobile.htm
36 */ 27 */
37 28
38 29
39#include <sys/param.h> 30#include <sys/param.h>
40#include <sys/sockio.h> 31#include <sys/sockio.h>
41#include <sys/sysctl.h> 32#include <sys/sysctl.h>
42#include <sys/mbuf.h> 33#include <sys/mbuf.h>
43#include <sys/kernel.h> 34#include <sys/kernel.h>
44#include <sys/socket.h> 35#include <sys/socket.h>
@@ -229,26 +220,32 @@ iwi_attach(device_t parent, device_t sel @@ -229,26 +220,32 @@ iwi_attach(device_t parent, device_t sel
229 revision = PCI_REVISION(pa->pa_class); 220 revision = PCI_REVISION(pa->pa_class);
230 aprint_normal(": %s (rev. 0x%02x)\n", devinfo, revision); 221 aprint_normal(": %s (rev. 0x%02x)\n", devinfo, revision);
231 222
232 /* clear unit numbers allocated to IBSS */ 223 /* clear unit numbers allocated to IBSS */
233 sc->sc_unr = 0; 224 sc->sc_unr = 0;
234 225
235 /* power up chip */ 226 /* power up chip */
236 if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self, 227 if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
237 NULL)) && error != EOPNOTSUPP) { 228 NULL)) && error != EOPNOTSUPP) {
238 aprint_error_dev(self, "cannot activate %d\n", error); 229 aprint_error_dev(self, "cannot activate %d\n", error);
239 return; 230 return;
240 } 231 }
241 232
 233 /* clear device specific PCI configuration register 0x41 */
 234 data = pci_conf_read(sc->sc_pct, sc->sc_pcitag, 0x40);
 235 data &= ~0x0000ff00;
 236 pci_conf_write(sc->sc_pct, sc->sc_pcitag, 0x40, data);
 237
 238
242 /* enable bus-mastering */ 239 /* enable bus-mastering */
243 data = pci_conf_read(sc->sc_pct, sc->sc_pcitag, PCI_COMMAND_STATUS_REG); 240 data = pci_conf_read(sc->sc_pct, sc->sc_pcitag, PCI_COMMAND_STATUS_REG);
244 data |= PCI_COMMAND_MASTER_ENABLE; 241 data |= PCI_COMMAND_MASTER_ENABLE;
245 pci_conf_write(sc->sc_pct, sc->sc_pcitag, PCI_COMMAND_STATUS_REG, data); 242 pci_conf_write(sc->sc_pct, sc->sc_pcitag, PCI_COMMAND_STATUS_REG, data);
246 243
247 /* map the register window */ 244 /* map the register window */
248 error = pci_mapreg_map(pa, IWI_PCI_BAR0, PCI_MAPREG_TYPE_MEM | 245 error = pci_mapreg_map(pa, IWI_PCI_BAR0, PCI_MAPREG_TYPE_MEM |
249 PCI_MAPREG_MEM_TYPE_32BIT, 0, &memt, &memh, NULL, &sc->sc_sz); 246 PCI_MAPREG_MEM_TYPE_32BIT, 0, &memt, &memh, NULL, &sc->sc_sz);
250 if (error != 0) { 247 if (error != 0) {
251 aprint_error_dev(self, "could not map memory space\n"); 248 aprint_error_dev(self, "could not map memory space\n");
252 return; 249 return;
253 } 250 }
254 251