Sun Sep 15 15:00:58 2013 UTC ()
Remove unused variable


(martin)
diff -r1.98 -r1.99 src/sys/dev/pci/twe.c

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

--- src/sys/dev/pci/twe.c 2012/12/02 15:34:36 1.98
+++ src/sys/dev/pci/twe.c 2013/09/15 15:00:57 1.99
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: twe.c,v 1.98 2012/12/02 15:34:36 chs Exp $ */ 1/* $NetBSD: twe.c,v 1.99 2013/09/15 15:00:57 martin 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.98 2012/12/02 15:34:36 chs Exp $"); 66__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.99 2013/09/15 15:00:57 martin 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>
@@ -653,27 +653,26 @@ twe_del_unit(struct twe_softc *sc, int u @@ -653,27 +653,26 @@ twe_del_unit(struct twe_softc *sc, int u
653 twe_recompute_openings(sc); 653 twe_recompute_openings(sc);
654 return (0); 654 return (0);
655} 655}
656 656
657/* 657/*
658 * Reset the controller. 658 * Reset the controller.
659 * MUST BE CALLED AT splbio()! 659 * MUST BE CALLED AT splbio()!
660 */ 660 */
661static int 661static int
662twe_reset(struct twe_softc *sc) 662twe_reset(struct twe_softc *sc)
663{ 663{
664 uint16_t aen; 664 uint16_t aen;
665 u_int status; 665 u_int status;
666 volatile u_int32_t junk; 
667 int got, rv; 666 int got, rv;
668 667
669 /* Issue a soft reset. */ 668 /* Issue a soft reset. */
670 twe_outl(sc, TWE_REG_CTL, TWE_CTL_ISSUE_SOFT_RESET | 669 twe_outl(sc, TWE_REG_CTL, TWE_CTL_ISSUE_SOFT_RESET |
671 TWE_CTL_CLEAR_HOST_INTR | 670 TWE_CTL_CLEAR_HOST_INTR |
672 TWE_CTL_CLEAR_ATTN_INTR | 671 TWE_CTL_CLEAR_ATTN_INTR |
673 TWE_CTL_MASK_CMD_INTR | 672 TWE_CTL_MASK_CMD_INTR |
674 TWE_CTL_MASK_RESP_INTR | 673 TWE_CTL_MASK_RESP_INTR |
675 TWE_CTL_CLEAR_ERROR_STS | 674 TWE_CTL_CLEAR_ERROR_STS |
676 TWE_CTL_DISABLE_INTRS); 675 TWE_CTL_DISABLE_INTRS);
677 676
678 /* Wait for attention... */ 677 /* Wait for attention... */
679 if (twe_status_wait(sc, TWE_STS_ATTN_INTR, 30)) { 678 if (twe_status_wait(sc, TWE_STS_ATTN_INTR, 30)) {
@@ -721,27 +720,27 @@ twe_reset(struct twe_softc *sc) @@ -721,27 +720,27 @@ twe_reset(struct twe_softc *sc)
721 device_xname(sc->sc_dev)); 720 device_xname(sc->sc_dev));
722 return (-1); 721 return (-1);
723 } 722 }
724 723
725 /* Drain the response queue. */ 724 /* Drain the response queue. */
726 for (;;) { 725 for (;;) {
727 status = twe_inl(sc, TWE_REG_STS); 726 status = twe_inl(sc, TWE_REG_STS);
728 if (twe_status_check(sc, status) != 0) { 727 if (twe_status_check(sc, status) != 0) {
729 aprint_error_dev(sc->sc_dev, "can't drain response queue\n"); 728 aprint_error_dev(sc->sc_dev, "can't drain response queue\n");
730 return (-1); 729 return (-1);
731 } 730 }
732 if ((status & TWE_STS_RESP_QUEUE_EMPTY) != 0) 731 if ((status & TWE_STS_RESP_QUEUE_EMPTY) != 0)
733 break; 732 break;
734 junk = twe_inl(sc, TWE_REG_RESP_QUEUE); 733 (void)twe_inl(sc, TWE_REG_RESP_QUEUE);
735 } 734 }
736 735
737 return (0); 736 return (0);
738} 737}
739 738
740/* 739/*
741 * Print autoconfiguration message for a sub-device. 740 * Print autoconfiguration message for a sub-device.
742 */ 741 */
743static int 742static int
744twe_print(void *aux, const char *pnp) 743twe_print(void *aux, const char *pnp)
745{ 744{
746 struct twe_attach_args *twea; 745 struct twe_attach_args *twea;
747 746
@@ -1466,36 +1465,36 @@ twe_ccb_free(struct twe_softc *sc, struc @@ -1466,36 +1465,36 @@ twe_ccb_free(struct twe_softc *sc, struc
1466 } 1465 }
1467 ccb->ccb_flags = 0; 1466 ccb->ccb_flags = 0;
1468 splx(s); 1467 splx(s);
1469} 1468}
1470 1469
1471/* 1470/*
1472 * Map the specified CCB's command block and data buffer (if any) into 1471 * Map the specified CCB's command block and data buffer (if any) into
1473 * controller visible space. Perform DMA synchronisation. 1472 * controller visible space. Perform DMA synchronisation.
1474 */ 1473 */
1475int 1474int
1476twe_ccb_map(struct twe_softc *sc, struct twe_ccb *ccb) 1475twe_ccb_map(struct twe_softc *sc, struct twe_ccb *ccb)
1477{ 1476{
1478 struct twe_cmd *tc; 1477 struct twe_cmd *tc;
1479 int flags, nsegs, i, s, rv, rc; 1478 int flags, nsegs, i, s, rv;
1480 void *data; 1479 void *data;
1481 1480
1482 /* 1481 /*
1483 * The data as a whole must be 512-byte aligned. 1482 * The data as a whole must be 512-byte aligned.
1484 */ 1483 */
1485 if (((u_long)ccb->ccb_data & (TWE_ALIGNMENT - 1)) != 0) { 1484 if (((u_long)ccb->ccb_data & (TWE_ALIGNMENT - 1)) != 0) {
1486 s = splvm(); 1485 s = splvm();
1487 /* XXX */ 1486 /* XXX */
1488 rc = uvm_km_kmem_alloc(kmem_va_arena, 1487 rv = uvm_km_kmem_alloc(kmem_va_arena,
1489 ccb->ccb_datasize, (VM_NOSLEEP | VM_INSTANTFIT), 1488 ccb->ccb_datasize, (VM_NOSLEEP | VM_INSTANTFIT),
1490 (vmem_addr_t *)&ccb->ccb_abuf); 1489 (vmem_addr_t *)&ccb->ccb_abuf);
1491 splx(s); 1490 splx(s);
1492 data = (void *)ccb->ccb_abuf; 1491 data = (void *)ccb->ccb_abuf;
1493 if ((ccb->ccb_flags & TWE_CCB_DATA_OUT) != 0) 1492 if ((ccb->ccb_flags & TWE_CCB_DATA_OUT) != 0)
1494 memcpy(data, ccb->ccb_data, ccb->ccb_datasize); 1493 memcpy(data, ccb->ccb_data, ccb->ccb_datasize);
1495 } else { 1494 } else {
1496 ccb->ccb_abuf = (vaddr_t)0; 1495 ccb->ccb_abuf = (vaddr_t)0;
1497 data = ccb->ccb_data; 1496 data = ccb->ccb_data;
1498 } 1497 }
1499 1498
1500 /* 1499 /*
1501 * Map the data buffer into bus space and build the S/G list. 1500 * Map the data buffer into bus space and build the S/G list.