]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/mlxcontrol/mlxcontrol.h
sys/{x86,amd64}: remove one of doubled ;s
[FreeBSD/FreeBSD.git] / usr.sbin / mlxcontrol / mlxcontrol.h
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 1999 Michael Smith
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  *
28  *      $FreeBSD$
29  */
30
31 #include <sys/queue.h>
32
33 #define debug(fmt, args...)     printf("%s: " fmt "\n", __func__ , ##args)
34
35 struct mlxd_foreach_action 
36 {
37     void        (*func)(int unit, void *arg);
38     void        *arg;
39 };
40
41 extern void                     mlx_foreach(void (*func)(int unit, void *arg), void *arg);
42 void                            mlxd_foreach_ctrlr(int unit, void *arg);
43 extern void                     mlxd_foreach(void (*func)(int unit, void *arg), void *arg);
44 extern int                      mlxd_find_ctrlr(int unit, int *ctrlr, int *sysdrive);
45 extern void                     mlx_perform(int unit, void (*func)(int fd, void *arg), void *arg);
46 extern void                     mlx_command(int fd, void *arg);
47 extern int                      mlx_enquiry(int unit, struct mlx_enquiry2 *enq);
48 extern int                      mlx_read_configuration(int unit, struct mlx_core_cfg *cfg);
49 extern int                      mlx_scsi_inquiry(int unit, int bus, int target, char **vendor, char **device, char **revision);
50 extern int                      mlx_get_device_state(int fd, int channel, int target, struct mlx_phys_drv *drv);
51
52 extern char     *ctrlrpath(int unit);
53 extern char     *ctrlrname(int unit);
54 extern char     *drivepath(int unit);
55 extern char     *drivename(int unit);
56 extern int      ctrlrunit(char *str);
57 extern int      driveunit(char *str);
58
59 extern void     mlx_print_phys_drv(struct mlx_phys_drv *drv, int channel, int target, char *prefix, int verbose);
60
61 struct conf_phys_drv
62 {
63     TAILQ_ENTRY(conf_phys_drv)  pd_link;
64     int                         pd_bus;
65     int                         pd_target;
66     struct mlx_phys_drv         pd_drv;
67 };
68
69 struct conf_span 
70 {
71     TAILQ_ENTRY(conf_span)      s_link;
72     struct conf_phys_drv        *s_drvs[8];
73     struct mlx_sys_drv_span     s_span;
74 };
75
76 struct conf_sys_drv
77 {
78     TAILQ_ENTRY(conf_sys_drv)   sd_link;
79     struct conf_span            *sd_spans[4];
80     struct mlx_sys_drv          sd_drv;
81 };
82
83 struct conf_config
84 {
85     TAILQ_HEAD(,conf_phys_drv)  cc_phys_drvs;
86     TAILQ_HEAD(,conf_span)      cc_spans;
87     TAILQ_HEAD(,conf_sys_drv)   cc_sys_drvs;
88     struct conf_sys_drv         *cc_drives[32];
89     struct mlx_core_cfg         cc_cfg;
90 };
91