Merge branch 'vendor/BINUTILS221'
[dragonfly.git] / sys / dev / raid / mfi / mfi_linux.c
1 /*-
2  * Copyright (c) 2006 IronPort Systems
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/sys/dev/mfi/mfi_linux.c,v 1.3 2009/05/20 17:29:21 imp Exp $
27  */
28
29 #include <sys/param.h>
30 #include <sys/systm.h>
31 #include <sys/conf.h>
32 #include <sys/kernel.h>
33 #include <sys/module.h>
34 #include <sys/file.h>
35 #include <sys/mapped_ioctl.h>
36 #include <sys/proc.h>
37
38 #if defined(__x86_64__) /* Assume amd64 wants 32 bit Linux */
39 #include <machine/../linux32/linux.h>
40 #include <machine/../linux32/linux32_proto.h>
41 #else
42 #include <emulation/linux/i386/linux.h>
43 #include <emulation/linux/i386/linux_proto.h>
44 #endif
45 #include <emulation/linux/linux_ioctl.h>
46 #include <emulation/linux/linux_util.h>
47
48 #include <dev/raid/mfi/mfireg.h>
49 #include <dev/raid/mfi/mfi_ioctl.h>
50
51 static struct ioctl_map_range mfi_linux_ioctl_cmds[] = {
52         MAPPED_IOCTL_MAP(MFI_LINUX_CMD, MFI_CMD),
53         MAPPED_IOCTL_MAP(MFI_LINUX_CMD_2, MFI_CMD),
54         MAPPED_IOCTL_MAP(MFI_LINUX_SET_AEN, MFI_SET_AEN),
55         MAPPED_IOCTL_MAP(MFI_LINUX_SET_AEN_2, MFI_SET_AEN),
56         MAPPED_IOCTL_MAPF(0 ,0, NULL)
57 };
58
59 static struct ioctl_map_handler mfi_linux_ioctl_handler = {
60         &linux_ioctl_map,
61         "mfi_linux",
62         mfi_linux_ioctl_cmds
63 };
64
65 SYSINIT  (mfi_register,   SI_BOOT2_KLD, SI_ORDER_MIDDLE,
66           mapped_ioctl_register_handler, &mfi_linux_ioctl_handler);
67 SYSUNINIT(mfi_unregister, SI_BOOT2_KLD, SI_ORDER_MIDDLE,
68           mapped_ioctl_unregister_handler, &mfi_linux_ioctl_handler);
69
70 static int
71 mfi_linux_modevent(module_t mod, int cmd, void *data)
72 {
73         return (0);
74 }
75
76 DEV_MODULE(mfi_linux, mfi_linux_modevent, NULL);
77 MODULE_DEPEND(mfi, linux, 1, 1, 1);