1d3c7b9a0SKenneth D. Merry /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3718cf2ccSPedro F. Giffuni * 4d3c7b9a0SKenneth D. Merry * Copyright (c) 2009 Yahoo! Inc. 5d3c7b9a0SKenneth D. Merry * All rights reserved. 6d3c7b9a0SKenneth D. Merry * 7d3c7b9a0SKenneth D. Merry * Redistribution and use in source and binary forms, with or without 8d3c7b9a0SKenneth D. Merry * modification, are permitted provided that the following conditions 9d3c7b9a0SKenneth D. Merry * are met: 10d3c7b9a0SKenneth D. Merry * 1. Redistributions of source code must retain the above copyright 11d3c7b9a0SKenneth D. Merry * notice, this list of conditions and the following disclaimer. 12d3c7b9a0SKenneth D. Merry * 2. Redistributions in binary form must reproduce the above copyright 13d3c7b9a0SKenneth D. Merry * notice, this list of conditions and the following disclaimer in the 14d3c7b9a0SKenneth D. Merry * documentation and/or other materials provided with the distribution. 15d3c7b9a0SKenneth D. Merry * 16d3c7b9a0SKenneth D. Merry * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17d3c7b9a0SKenneth D. Merry * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18d3c7b9a0SKenneth D. Merry * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19d3c7b9a0SKenneth D. Merry * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20d3c7b9a0SKenneth D. Merry * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21d3c7b9a0SKenneth D. Merry * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22d3c7b9a0SKenneth D. Merry * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23d3c7b9a0SKenneth D. Merry * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24d3c7b9a0SKenneth D. Merry * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25d3c7b9a0SKenneth D. Merry * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26d3c7b9a0SKenneth D. Merry * SUCH DAMAGE. 27d3c7b9a0SKenneth D. Merry */ 28d3c7b9a0SKenneth D. Merry 29d3c7b9a0SKenneth D. Merry #ifndef _MPS_TABLE_H 30d3c7b9a0SKenneth D. Merry #define _MPS_TABLE_H 31d3c7b9a0SKenneth D. Merry 32d3c7b9a0SKenneth D. Merry struct mps_table_lookup { 33d3c7b9a0SKenneth D. Merry char *string; 34d3c7b9a0SKenneth D. Merry u_int code; 35d3c7b9a0SKenneth D. Merry }; 36d3c7b9a0SKenneth D. Merry 37d3c7b9a0SKenneth D. Merry char * mps_describe_table(struct mps_table_lookup *table, u_int code); 38d3c7b9a0SKenneth D. Merry void mps_describe_devinfo(uint32_t devinfo, char *string, int len); 39d3c7b9a0SKenneth D. Merry 40d3c7b9a0SKenneth D. Merry extern struct mps_table_lookup mps_event_names[]; 41d3c7b9a0SKenneth D. Merry extern struct mps_table_lookup mps_phystatus_names[]; 42d3c7b9a0SKenneth D. Merry extern struct mps_table_lookup mps_linkrate_names[]; 432bf620cbSScott Long extern struct mps_table_lookup mps_iocstatus_string[]; 442bf620cbSScott Long extern struct mps_table_lookup mps_scsi_status_string[]; 452bf620cbSScott Long extern struct mps_table_lookup mps_scsi_taskmgmt_string[]; 46d3c7b9a0SKenneth D. Merry 47055e2653SScott Long void mps_print_iocfacts(struct mps_softc *, MPI2_IOC_FACTS_REPLY *); 48055e2653SScott Long void mps_print_portfacts(struct mps_softc *, MPI2_PORT_FACTS_REPLY *); 49055e2653SScott Long void mps_print_evt_generic(struct mps_softc *, MPI2_EVENT_NOTIFICATION_REPLY *); 50055e2653SScott Long void mps_print_sasdev0(struct mps_softc *, MPI2_CONFIG_PAGE_SAS_DEV_0 *); 51055e2653SScott Long void mps_print_evt_sas(struct mps_softc *, MPI2_EVENT_NOTIFICATION_REPLY *); 52055e2653SScott Long void mps_print_expander1(struct mps_softc *, MPI2_CONFIG_PAGE_EXPANDER_1 *); 53055e2653SScott Long void mps_print_sasphy0(struct mps_softc *, MPI2_CONFIG_PAGE_SAS_PHY_0 *); 54d3c7b9a0SKenneth D. Merry void mps_print_sgl(struct mps_softc *, struct mps_command *, int); 55d3c7b9a0SKenneth D. Merry void mps_print_scsiio_cmd(struct mps_softc *, struct mps_command *); 56c11c484fSScott Long 57055e2653SScott Long #define MPS_DPRINT_PAGE(sc, level, func, buf) \ 58055e2653SScott Long do { \ 59055e2653SScott Long if ((sc)->mps_debug & level) \ 60055e2653SScott Long mps_print_##func((sc), buf); \ 61055e2653SScott Long } while (0) 62c11c484fSScott Long 63055e2653SScott Long #define MPS_DPRINT_EVENT(sc, func, buf) \ 64055e2653SScott Long MPS_DPRINT_PAGE(sc, MPS_EVENT, evt_##func, buf) 65c11c484fSScott Long 66d3c7b9a0SKenneth D. Merry #endif 67