Deleted Added
full compact
twe.c (73104) twe.c (76340)
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2000 BSDi
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2000 BSDi
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/dev/twe/twe.c 73104 2001-02-26 20:13:19Z msmith $
27 * $FreeBSD: head/sys/dev/twe/twe.c 76340 2001-05-07 21:46:44Z msmith $
28 */
29
30/*
31 * Driver for the 3ware Escalade family of IDE RAID controllers.
32 */
33
34#include <dev/twe/twe_compat.h>
35#include <dev/twe/twereg.h>

--- 1596 unchanged lines hidden (view full) ---

1632 * Print a diagnostic if the status of the command warrants it, and return
1633 * either zero (command was ok) or nonzero (command failed).
1634 */
1635static int
1636twe_report_request(struct twe_request *tr)
1637{
1638 struct twe_softc *sc = tr->tr_sc;
1639 TWE_Command *cmd = &tr->tr_command;
28 */
29
30/*
31 * Driver for the 3ware Escalade family of IDE RAID controllers.
32 */
33
34#include <dev/twe/twe_compat.h>
35#include <dev/twe/twereg.h>

--- 1596 unchanged lines hidden (view full) ---

1632 * Print a diagnostic if the status of the command warrants it, and return
1633 * either zero (command was ok) or nonzero (command failed).
1634 */
1635static int
1636twe_report_request(struct twe_request *tr)
1637{
1638 struct twe_softc *sc = tr->tr_sc;
1639 TWE_Command *cmd = &tr->tr_command;
1640 int result;
1640 int result = 0;
1641
1641
1642 switch (cmd->generic.flags) {
1643 case TWE_FLAGS_SUCCESS:
1644 result = 0;
1645 break;
1646 case TWE_FLAGS_INFORMATIONAL:
1647 case TWE_FLAGS_WARNING:
1648 twe_printf(sc, "command completed - %s\n",
1649 twe_describe_code(twe_table_status, cmd->generic.status));
1650 result = 0;
1651 break;
1652
1653 case TWE_FLAGS_FATAL:
1654 default:
1655 twe_printf(sc, "command failed - %s\n",
1656 twe_describe_code(twe_table_status, cmd->generic.status));
1642 /*
1643 * Check the command status value and handle accordingly.
1644 */
1645 if (cmd->generic.status == TWE_STATUS_RESET) {
1646 /*
1647 * The status code 0xff requests a controller reset.
1648 */
1649 twe_printf(sc, "command returned with controller rest request\n");
1650 twe_reset(sc);
1657 result = 1;
1651 result = 1;
1658
1652 } else if (cmd->generic.status > TWE_STATUS_FATAL) {
1659 /*
1653 /*
1660 * The status code 0xff requests a controller reset
1654 * Fatal errors that don't require controller reset.
1661 */
1655 */
1662 if (cmd->generic.status == 0xff)
1663 twe_reset(sc);
1664 break;
1656 twe_printf(sc, "command returned fatal status - %s (flags = 0x%x)\n",
1657 twe_describe_code(twe_table_status, cmd->generic.status),
1658 cmd->generic.flags);
1659 result = 1;
1660 } else if (cmd->generic.status > TWE_STATUS_WARNING) {
1661 /*
1662 * Warning level status.
1663 */
1664 twe_printf(sc, "command returned warning status - %s (flags = 0x%x)\n",
1665 twe_describe_code(twe_table_status, cmd->generic.status),
1666 cmd->generic.flags);
1667 } else if (cmd->generic.status > 0x40) {
1668 /*
1669 * Info level status.
1670 */
1671 twe_printf(sc, "command returned info status: %s (flags = 0x%x)\n",
1672 twe_describe_code(twe_table_status, cmd->generic.status),
1673 cmd->generic.flags);
1665 }
1674 }
1675
1666 return(result);
1667}
1668
1669/********************************************************************************
1670 * Print some controller state to aid in debugging error/panic conditions
1671 */
1672void
1673twe_print_controller(struct twe_softc *sc)

--- 73 unchanged lines hidden ---
1676 return(result);
1677}
1678
1679/********************************************************************************
1680 * Print some controller state to aid in debugging error/panic conditions
1681 */
1682void
1683twe_print_controller(struct twe_softc *sc)

--- 73 unchanged lines hidden ---