Deleted Added
full compact
mfi.c (158737) mfi.c (159574)
1/*-
2 * Copyright (c) 2006 IronPort Systems
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2006 IronPort Systems
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/mfi/mfi.c 158737 2006-05-18 23:30:48Z ambrisko $");
28__FBSDID("$FreeBSD: head/sys/dev/mfi/mfi.c 159574 2006-06-13 14:27:52Z ambrisko $");
29
30#include "opt_mfi.h"
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/malloc.h>
35#include <sys/kernel.h>
36#include <sys/poll.h>

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

54
55static int mfi_alloc_commands(struct mfi_softc *);
56static void mfi_release_command(struct mfi_command *cm);
57static int mfi_comms_init(struct mfi_softc *);
58static int mfi_polled_command(struct mfi_softc *, struct mfi_command *);
59static int mfi_get_controller_info(struct mfi_softc *);
60static int mfi_get_log_state(struct mfi_softc *,
61 struct mfi_evt_log_state *);
29
30#include "opt_mfi.h"
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/malloc.h>
35#include <sys/kernel.h>
36#include <sys/poll.h>

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

54
55static int mfi_alloc_commands(struct mfi_softc *);
56static void mfi_release_command(struct mfi_command *cm);
57static int mfi_comms_init(struct mfi_softc *);
58static int mfi_polled_command(struct mfi_softc *, struct mfi_command *);
59static int mfi_get_controller_info(struct mfi_softc *);
60static int mfi_get_log_state(struct mfi_softc *,
61 struct mfi_evt_log_state *);
62#ifdef NOTYET
62static int mfi_get_entry(struct mfi_softc *, int);
63static int mfi_get_entry(struct mfi_softc *, int);
64#endif
63static void mfi_data_cb(void *, bus_dma_segment_t *, int, int);
64static void mfi_startup(void *arg);
65static void mfi_intr(void *arg);
66static void mfi_enable_intr(struct mfi_softc *sc);
67static void mfi_ldprobe_inq(struct mfi_softc *sc);
68static void mfi_ldprobe_inq_complete(struct mfi_command *);
69static int mfi_ldprobe_capacity(struct mfi_softc *sc, int id);
70static void mfi_ldprobe_capacity_complete(struct mfi_command *);

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

603 if (error)
604 return (error);
605 /*
606 * Don't run them yet since we can't parse them.
607 * We can indirectly get the contents from
608 * the AEN mechanism via setting it lower then
609 * current. The firmware will iterate through them.
610 */
65static void mfi_data_cb(void *, bus_dma_segment_t *, int, int);
66static void mfi_startup(void *arg);
67static void mfi_intr(void *arg);
68static void mfi_enable_intr(struct mfi_softc *sc);
69static void mfi_ldprobe_inq(struct mfi_softc *sc);
70static void mfi_ldprobe_inq_complete(struct mfi_command *);
71static int mfi_ldprobe_capacity(struct mfi_softc *sc, int id);
72static void mfi_ldprobe_capacity_complete(struct mfi_command *);

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

605 if (error)
606 return (error);
607 /*
608 * Don't run them yet since we can't parse them.
609 * We can indirectly get the contents from
610 * the AEN mechanism via setting it lower then
611 * current. The firmware will iterate through them.
612 */
611#if 0
613#ifdef NOTYET
612 for (seq = log_state.shutdown_seq_num;
613 seq <= log_state.newest_seq_num; seq++) {
614 mfi_get_entry(sc, seq);
615 }
616#endif
617
618 seq = log_state.shutdown_seq_num + 1;
619 } else

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

925 if (--sc->mfi_probe_count <= 0)
926 wakeup(mfi_startup);
927 return;
928 }
929 mfi_release_command(cm);
930 mfi_ldprobe_capacity(sc, hdr->target_id);
931}
932
614 for (seq = log_state.shutdown_seq_num;
615 seq <= log_state.newest_seq_num; seq++) {
616 mfi_get_entry(sc, seq);
617 }
618#endif
619
620 seq = log_state.shutdown_seq_num + 1;
621 } else

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

927 if (--sc->mfi_probe_count <= 0)
928 wakeup(mfi_startup);
929 return;
930 }
931 mfi_release_command(cm);
932 mfi_ldprobe_capacity(sc, hdr->target_id);
933}
934
933#ifndef MFI_DECODE_LOG
935#ifdef NOTYET
934static void
935mfi_decode_log(struct mfi_softc *sc, struct mfi_log_detail *detail)
936{
937 switch (detail->arg_type) {
938 default:
939 device_printf(sc->mfi_dev, "%d - Log entry type %d\n",
940 detail->seq,
941 detail->arg_type
942 );
943 break;
944 }
945}
936static void
937mfi_decode_log(struct mfi_softc *sc, struct mfi_log_detail *detail)
938{
939 switch (detail->arg_type) {
940 default:
941 device_printf(sc->mfi_dev, "%d - Log entry type %d\n",
942 detail->seq,
943 detail->arg_type
944 );
945 break;
946 }
947}
946#else
947#include <dev/mfi/mfilog.h>
948#include <dev/mfi/mfi_log.c>
949#endif
950
951static void
952mfi_decode_evt(struct mfi_softc *sc, struct mfi_evt_detail *detail)
953{
954 switch (detail->arg_type) {
955 case MR_EVT_ARGS_NONE:
948#endif
949
950static void
951mfi_decode_evt(struct mfi_softc *sc, struct mfi_evt_detail *detail)
952{
953 switch (detail->arg_type) {
954 case MR_EVT_ARGS_NONE:
956 /* Try to get info from log entry */
957 mfi_get_entry(sc, detail->seq);
955 device_printf(sc->mfi_dev, "%d - %s\n",
956 detail->seq,
957 detail->description
958 );
958 break;
959 case MR_EVT_ARGS_CDB_SENSE:
960 device_printf(sc->mfi_dev, "%d - PD %02d(e%d/s%d) CDB %*D"
959 break;
960 case MR_EVT_ARGS_CDB_SENSE:
961 device_printf(sc->mfi_dev, "%d - PD %02d(e%d/s%d) CDB %*D"
961 "Sense %*D\n: %s",
962 "Sense %*D\n: %s\n",
962 detail->seq,
963 detail->args.cdb_sense.pd.device_id,
964 detail->args.cdb_sense.pd.enclosure_index,
965 detail->args.cdb_sense.pd.slot_number,
966 detail->args.cdb_sense.cdb_len,
967 detail->args.cdb_sense.cdb,
968 ":",
969 detail->args.cdb_sense.sense_len,

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

1279 /* set it up again so the driver can catch more events */
1280 if (!aborted) {
1281 mtx_unlock(&sc->mfi_io_lock);
1282 mfi_aen_setup(sc, seq);
1283 mtx_lock(&sc->mfi_io_lock);
1284 }
1285}
1286
963 detail->seq,
964 detail->args.cdb_sense.pd.device_id,
965 detail->args.cdb_sense.pd.enclosure_index,
966 detail->args.cdb_sense.pd.slot_number,
967 detail->args.cdb_sense.cdb_len,
968 detail->args.cdb_sense.cdb,
969 ":",
970 detail->args.cdb_sense.sense_len,

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

1280 /* set it up again so the driver can catch more events */
1281 if (!aborted) {
1282 mtx_unlock(&sc->mfi_io_lock);
1283 mfi_aen_setup(sc, seq);
1284 mtx_lock(&sc->mfi_io_lock);
1285 }
1286}
1287
1288#ifdef NOTYET
1287static int
1288mfi_get_entry(struct mfi_softc *sc, int seq)
1289{
1290 struct mfi_command *cm;
1291 struct mfi_dcmd_frame *dcmd;
1292 struct mfi_log_detail *ed;
1293 int error;
1294

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

1344 mfi_decode_log(sc, ed);
1345
1346 mtx_lock(&sc->mfi_io_lock);
1347 free(cm->cm_data, M_MFIBUF);
1348 mfi_release_command(cm);
1349 mtx_unlock(&sc->mfi_io_lock);
1350 return (0);
1351}
1289static int
1290mfi_get_entry(struct mfi_softc *sc, int seq)
1291{
1292 struct mfi_command *cm;
1293 struct mfi_dcmd_frame *dcmd;
1294 struct mfi_log_detail *ed;
1295 int error;
1296

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

1346 mfi_decode_log(sc, ed);
1347
1348 mtx_lock(&sc->mfi_io_lock);
1349 free(cm->cm_data, M_MFIBUF);
1350 mfi_release_command(cm);
1351 mtx_unlock(&sc->mfi_io_lock);
1352 return (0);
1353}
1354#endif
1352
1353static int
1354mfi_ldprobe_capacity(struct mfi_softc *sc, int id)
1355{
1356 struct mfi_command *cm;
1357 struct mfi_pass_frame *pass;
1358 struct scsi_read_capacity_data_long *cap;
1359

--- 720 unchanged lines hidden ---
1355
1356static int
1357mfi_ldprobe_capacity(struct mfi_softc *sc, int id)
1358{
1359 struct mfi_command *cm;
1360 struct mfi_pass_frame *pass;
1361 struct scsi_read_capacity_data_long *cap;
1362

--- 720 unchanged lines hidden ---