xref: /freebsd/sys/dev/mps/mps_table.h (revision 718cf2ccb9956613756ab15d7a0e28f2c8e91cab)
1d3c7b9a0SKenneth D. Merry /*-
2*718cf2ccSPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3*718cf2ccSPedro 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  * $FreeBSD$
29d3c7b9a0SKenneth D. Merry  */
30d3c7b9a0SKenneth D. Merry 
31d3c7b9a0SKenneth D. Merry #ifndef _MPS_TABLE_H
32d3c7b9a0SKenneth D. Merry #define _MPS_TABLE_H
33d3c7b9a0SKenneth D. Merry 
34d3c7b9a0SKenneth D. Merry struct mps_table_lookup {
35d3c7b9a0SKenneth D. Merry 	char	*string;
36d3c7b9a0SKenneth D. Merry 	u_int	code;
37d3c7b9a0SKenneth D. Merry };
38d3c7b9a0SKenneth D. Merry 
39d3c7b9a0SKenneth D. Merry char * mps_describe_table(struct mps_table_lookup *table, u_int code);
40d3c7b9a0SKenneth D. Merry void mps_describe_devinfo(uint32_t devinfo, char *string, int len);
41d3c7b9a0SKenneth D. Merry 
42d3c7b9a0SKenneth D. Merry extern struct mps_table_lookup mps_event_names[];
43d3c7b9a0SKenneth D. Merry extern struct mps_table_lookup mps_phystatus_names[];
44d3c7b9a0SKenneth D. Merry extern struct mps_table_lookup mps_linkrate_names[];
452bf620cbSScott Long extern struct mps_table_lookup mps_iocstatus_string[];
462bf620cbSScott Long extern struct mps_table_lookup mps_scsi_status_string[];
472bf620cbSScott Long extern struct mps_table_lookup mps_scsi_taskmgmt_string[];
48d3c7b9a0SKenneth D. Merry 
49055e2653SScott Long void mps_print_iocfacts(struct mps_softc *, MPI2_IOC_FACTS_REPLY *);
50055e2653SScott Long void mps_print_portfacts(struct mps_softc *, MPI2_PORT_FACTS_REPLY *);
51055e2653SScott Long void mps_print_evt_generic(struct mps_softc *, MPI2_EVENT_NOTIFICATION_REPLY *);
52055e2653SScott Long void mps_print_sasdev0(struct mps_softc *, MPI2_CONFIG_PAGE_SAS_DEV_0 *);
53055e2653SScott Long void mps_print_evt_sas(struct mps_softc *, MPI2_EVENT_NOTIFICATION_REPLY *);
54055e2653SScott Long void mps_print_expander1(struct mps_softc *, MPI2_CONFIG_PAGE_EXPANDER_1 *);
55055e2653SScott Long void mps_print_sasphy0(struct mps_softc *, MPI2_CONFIG_PAGE_SAS_PHY_0 *);
56d3c7b9a0SKenneth D. Merry void mps_print_sgl(struct mps_softc *, struct mps_command *, int);
57d3c7b9a0SKenneth D. Merry void mps_print_scsiio_cmd(struct mps_softc *, struct mps_command *);
58c11c484fSScott Long 
59055e2653SScott Long #define MPS_DPRINT_PAGE(sc, level, func, buf)		\
60055e2653SScott Long do {							\
61055e2653SScott Long 	if ((sc)->mps_debug & level)			\
62055e2653SScott Long 		mps_print_##func((sc), buf);		\
63055e2653SScott Long } while (0)
64c11c484fSScott Long 
65055e2653SScott Long #define MPS_DPRINT_EVENT(sc, func, buf)			\
66055e2653SScott Long 	MPS_DPRINT_PAGE(sc, MPS_EVENT, evt_##func, buf)
67c11c484fSScott Long 
68d3c7b9a0SKenneth D. Merry #endif
69