Sun Dec 2 15:34:37 2012 UTC ()
fix device/softc split: initialize sc->sc_dev.


(chs)
diff -r1.97 -r1.98 src/sys/dev/pci/twe.c

cvs diff -r1.97 -r1.98 src/sys/dev/pci/twe.c (expand / switch to unified diff)

--- src/sys/dev/pci/twe.c 2012/10/27 17:18:35 1.97
+++ src/sys/dev/pci/twe.c 2012/12/02 15:34:36 1.98
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: twe.c,v 1.97 2012/10/27 17:18:35 chs Exp $ */ 1/* $NetBSD: twe.c,v 1.98 2012/12/02 15:34:36 chs Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2000, 2001, 2002, 2003, 2004 The NetBSD Foundation, Inc. 4 * Copyright (c) 2000, 2001, 2002, 2003, 2004 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran; and by Jason R. Thorpe of Wasabi Systems, Inc. 8 * by Andrew Doran; and by Jason R. Thorpe of Wasabi Systems, Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -53,27 +53,27 @@ @@ -53,27 +53,27 @@
53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 * SUCH DAMAGE. 56 * SUCH DAMAGE.
57 * 57 *
58 * from FreeBSD: twe.c,v 1.1 2000/05/24 23:35:23 msmith Exp 58 * from FreeBSD: twe.c,v 1.1 2000/05/24 23:35:23 msmith Exp
59 */ 59 */
60 60
61/* 61/*
62 * Driver for the 3ware Escalade family of RAID controllers. 62 * Driver for the 3ware Escalade family of RAID controllers.
63 */ 63 */
64 64
65#include <sys/cdefs.h> 65#include <sys/cdefs.h>
66__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.97 2012/10/27 17:18:35 chs Exp $"); 66__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.98 2012/12/02 15:34:36 chs Exp $");
67 67
68#include <sys/param.h> 68#include <sys/param.h>
69#include <sys/systm.h> 69#include <sys/systm.h>
70#include <sys/kernel.h> 70#include <sys/kernel.h>
71#include <sys/device.h> 71#include <sys/device.h>
72#include <sys/queue.h> 72#include <sys/queue.h>
73#include <sys/proc.h> 73#include <sys/proc.h>
74#include <sys/buf.h> 74#include <sys/buf.h>
75#include <sys/endian.h> 75#include <sys/endian.h>
76#include <sys/malloc.h> 76#include <sys/malloc.h>
77#include <sys/conf.h> 77#include <sys/conf.h>
78#include <sys/disk.h> 78#include <sys/disk.h>
79#include <sys/sysctl.h> 79#include <sys/sysctl.h>
@@ -310,26 +310,27 @@ twe_attach(device_t parent, device_t sel @@ -310,26 +310,27 @@ twe_attach(device_t parent, device_t sel
310 struct twe_softc *sc; 310 struct twe_softc *sc;
311 pci_chipset_tag_t pc; 311 pci_chipset_tag_t pc;
312 pci_intr_handle_t ih; 312 pci_intr_handle_t ih;
313 pcireg_t csr; 313 pcireg_t csr;
314 const char *intrstr; 314 const char *intrstr;
315 int s, size, i, rv, rseg; 315 int s, size, i, rv, rseg;
316 size_t max_segs, max_xfer; 316 size_t max_segs, max_xfer;
317 bus_dma_segment_t seg; 317 bus_dma_segment_t seg;
318 const struct sysctlnode *node; 318 const struct sysctlnode *node;
319 struct twe_cmd *tc; 319 struct twe_cmd *tc;
320 struct twe_ccb *ccb; 320 struct twe_ccb *ccb;
321 321
322 sc = device_private(self); 322 sc = device_private(self);
 323 sc->sc_dev = self;
323 pa = aux; 324 pa = aux;
324 pc = pa->pa_pc; 325 pc = pa->pa_pc;
325 sc->sc_dmat = pa->pa_dmat; 326 sc->sc_dmat = pa->pa_dmat;
326 SIMPLEQ_INIT(&sc->sc_ccb_queue); 327 SIMPLEQ_INIT(&sc->sc_ccb_queue);
327 SLIST_INIT(&sc->sc_ccb_freelist); 328 SLIST_INIT(&sc->sc_ccb_freelist);
328 329
329 aprint_naive(": RAID controller\n"); 330 aprint_naive(": RAID controller\n");
330 aprint_normal(": 3ware Escalade\n"); 331 aprint_normal(": 3ware Escalade\n");
331 332
332 333
333 if (pci_mapreg_map(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0, 334 if (pci_mapreg_map(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0,
334 &sc->sc_iot, &sc->sc_ioh, NULL, NULL)) { 335 &sc->sc_iot, &sc->sc_ioh, NULL, NULL)) {
335 aprint_error_dev(self, "can't map i/o space\n"); 336 aprint_error_dev(self, "can't map i/o space\n");