Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / md.h
blob6599bc516626595429fc9289c6e4b93aa4f1cabe
1 /* $NetBSD$ */
3 /*
4 * Copyright (c) 1995 Gordon W. Ross
5 * All rights reserved.
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.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #ifndef _SYS_DEV_MD_H_
29 #define _SYS_DEV_MD_H_
32 * Memory-disk ioctl functions:
35 #include <sys/ioccom.h>
37 struct md_conf {
38 void *md_addr;
39 size_t md_size;
40 int md_type;
43 #define MD_GETCONF _IOR('r', 0, struct md_conf) /* get unit config */
44 #define MD_SETCONF _IOW('r', 1, struct md_conf) /* set unit config */
47 * There are three configurations supported for each unit,
48 * reflected in the value of the md_type field:
50 #define MD_UNCONFIGURED 0
52 * Not yet configured. Open returns ENXIO.
54 #define MD_KMEM_FIXED 1
56 * Disk image resident in kernel (patched in or loaded).
57 * Requires that the function: md_set_kmem() is called to
58 * attach the (initialized) kernel memory to be used by the
59 * device. It can be initialized by an "open hook" if this
60 * driver is compiled with the MD_OPEN_HOOK option.
61 * No attempt will ever be made to free this memory.
63 #define MD_KMEM_ALLOCATED 2
65 * Small, wired-down chunk of kernel memory obtained from
66 * kmem_alloc(). The allocation is performed by an ioctl
67 * call on the raw partition.
69 #define MD_UMEM_SERVER 3
71 * Indirect access to user-space of a user-level server.
72 * (Like the MFS hack, but better! 8^) Device operates
73 * only while the server has the raw partition open and
74 * continues to service I/O requests. The process that
75 * does this setconf will become the I/O server. This
76 * configuration type can be disabled using:
77 * options MEMORY_DISK_SERVER=0
80 #ifdef _KERNEL
82 * If the option MEMORY_DISK_HOOKS is on, then these functions are
83 * called by the ramdisk driver to allow machine-dependent to
84 * match/configure and/or load each ramdisk unit.
86 extern void md_attach_hook(int, struct md_conf *);
87 extern void md_open_hook(int, struct md_conf *);
88 extern void md_root_setconf(char *, size_t);
90 extern int md_is_root;
91 #endif /* _KERNEL */
93 #endif /* _SYS_DEV_MD_H_ */