Merge branch 'vendor/BINUTILS220' into bu220
[dragonfly.git] / usr.sbin / mlxcontrol / mlxcontrol.h
1 /*-
2  * Copyright (c) 1999 Michael Smith
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
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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  *      $FreeBSD: src/usr.sbin/mlxcontrol/mlxcontrol.h,v 1.1.1.1.2.1 2000/04/24 19:44:47 msmith Exp $
27  *      $DragonFly: src/usr.sbin/mlxcontrol/mlxcontrol.h,v 1.3 2005/02/17 14:00:10 joerg Exp $
28  */
29
30 #include <sys/queue.h>
31
32 #define debug(fmt, args...)     printf("%s: " fmt "\n", __func__ , ##args)
33
34 struct mlxd_foreach_action 
35 {
36     void        (*func)(int unit, void *arg);
37     void        *arg;
38 };
39
40 extern void                     mlx_foreach(void (*func)(int unit, void *arg), void *arg);
41 void                            mlxd_foreach_ctrlr(int unit, void *arg);
42 extern void                     mlxd_foreach(void (*func)(int unit, void *arg), void *arg);
43 extern int                      mlxd_find_ctrlr(int unit, int *ctrlr, int *sysdrive);
44 extern void                     mlx_perform(int unit, void (*func)(int fd, void *arg), void *arg);
45 extern void                     mlx_command(int fd, void *arg);
46 extern int                      mlx_enquiry(int unit, struct mlx_enquiry2 *enq);
47 extern int                      mlx_read_configuration(int unit, struct mlx_core_cfg *cfg);
48 extern int                      mlx_scsi_inquiry(int unit, int bus, int target, char **vendor, char **device, char **revision);
49 extern int                      mlx_get_device_state(int fd, int channel, int target, struct mlx_phys_drv *drv);
50
51 extern char     *ctrlrpath(int unit);
52 extern char     *ctrlrname(int unit);
53 extern char     *drivepath(int unit);
54 extern char     *drivename(int unit);
55 extern int      ctrlrunit(char *str);
56 extern int      driveunit(char *str);
57
58 extern void     mlx_print_phys_drv(struct mlx_phys_drv *drv, int channel, int target, char *prefix, int verbose);
59
60 struct conf_phys_drv
61 {
62     TAILQ_ENTRY(conf_phys_drv)  pd_link;
63     int                         pd_bus;
64     int                         pd_target;
65     struct mlx_phys_drv         pd_drv;
66 };
67
68 struct conf_span 
69 {
70     TAILQ_ENTRY(conf_span)      s_link;
71     struct conf_phys_drv        *s_drvs[8];
72     struct mlx_sys_drv_span     s_span;
73 };
74
75 struct conf_sys_drv
76 {
77     TAILQ_ENTRY(conf_sys_drv)   sd_link;
78     struct conf_span            *sd_spans[4];
79     struct mlx_sys_drv          sd_drv;
80 };
81
82 struct conf_config
83 {
84     TAILQ_HEAD(,conf_phys_drv)  cc_phys_drvs;
85     TAILQ_HEAD(,conf_span)      cc_spans;
86     TAILQ_HEAD(,conf_sys_drv)   cc_sys_drvs;
87     struct conf_sys_drv         *cc_drives[32];
88     struct mlx_core_cfg         cc_cfg;
89 };
90