2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 1999 Michael Smith
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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.
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
31 #include <sys/queue.h>
33 #define debug(fmt, args...) printf("%s: " fmt "\n", __func__ , ##args)
35 struct mlxd_foreach_action
37 void (*func)(int unit, void *arg);
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);
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);
59 extern void mlx_print_phys_drv(struct mlx_phys_drv *drv, int channel, int target, char *prefix, int verbose);
63 TAILQ_ENTRY(conf_phys_drv) pd_link;
66 struct mlx_phys_drv pd_drv;
71 TAILQ_ENTRY(conf_span) s_link;
72 struct conf_phys_drv *s_drvs[8];
73 struct mlx_sys_drv_span s_span;
78 TAILQ_ENTRY(conf_sys_drv) sd_link;
79 struct conf_span *sd_spans[4];
80 struct mlx_sys_drv sd_drv;
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;