Home | History | Annotate | Line # | Download | only in dev
md.h revision 1.7
      1  1.7      uch /*	$NetBSD: md.h,v 1.7 2001/07/02 17:17:25 uch Exp $	*/
      2  1.2      gwr 
      3  1.2      gwr /*
      4  1.2      gwr  * Copyright (c) 1995 Gordon W. Ross
      5  1.2      gwr  * All rights reserved.
      6  1.2      gwr  *
      7  1.2      gwr  * Redistribution and use in source and binary forms, with or without
      8  1.2      gwr  * modification, are permitted provided that the following conditions
      9  1.2      gwr  * are met:
     10  1.2      gwr  * 1. Redistributions of source code must retain the above copyright
     11  1.2      gwr  *    notice, this list of conditions and the following disclaimer.
     12  1.2      gwr  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.2      gwr  *    notice, this list of conditions and the following disclaimer in the
     14  1.2      gwr  *    documentation and/or other materials provided with the distribution.
     15  1.2      gwr  * 3. The name of the author may not be used to endorse or promote products
     16  1.2      gwr  *    derived from this software without specific prior written permission.
     17  1.2      gwr  * 4. All advertising materials mentioning features or use of this software
     18  1.2      gwr  *    must display the following acknowledgement:
     19  1.2      gwr  *      This product includes software developed by Gordon W. Ross
     20  1.2      gwr  *
     21  1.2      gwr  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  1.2      gwr  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  1.2      gwr  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  1.2      gwr  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  1.2      gwr  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  1.2      gwr  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  1.2      gwr  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  1.2      gwr  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  1.2      gwr  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  1.2      gwr  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  1.2      gwr  */
     32  1.1      gwr 
     33  1.1      gwr /*
     34  1.5       pk  * Memory-disk ioctl functions:
     35  1.1      gwr  */
     36  1.1      gwr 
     37  1.1      gwr #include <sys/ioccom.h>
     38  1.1      gwr 
     39  1.5       pk struct md_conf {
     40  1.5       pk 	caddr_t md_addr;
     41  1.5       pk 	size_t  md_size;
     42  1.5       pk 	int     md_type;
     43  1.1      gwr };
     44  1.1      gwr 
     45  1.5       pk #define MD_GETCONF	_IOR('r', 0, struct md_conf)	/* get unit config */
     46  1.5       pk #define MD_SETCONF	_IOW('r', 1, struct md_conf)	/* set unit config */
     47  1.1      gwr 
     48  1.1      gwr /*
     49  1.1      gwr  * There are three configurations supported for each unit,
     50  1.5       pk  * reflected in the value of the md_type field:
     51  1.1      gwr  */
     52  1.5       pk #define MD_UNCONFIGURED 0
     53  1.1      gwr /*
     54  1.1      gwr  *     Not yet configured.  Open returns ENXIO.
     55  1.1      gwr  */
     56  1.5       pk #define MD_KMEM_FIXED	1
     57  1.1      gwr /*
     58  1.1      gwr  *     Disk image resident in kernel (patched in or loaded).
     59  1.5       pk  *     Requires that the function: md_set_kmem() is called to
     60  1.1      gwr  *     attach the (initialized) kernel memory to be used by the
     61  1.2      gwr  *     device.  It can be initialized by an "open hook" if this
     62  1.5       pk  *     driver is compiled with the MD_OPEN_HOOK option.
     63  1.2      gwr  *     No attempt will ever be made to free this memory.
     64  1.1      gwr  */
     65  1.5       pk #define MD_KMEM_ALLOCATED 2
     66  1.1      gwr /*
     67  1.1      gwr  *     Small, wired-down chunk of kernel memory obtained from
     68  1.1      gwr  *     kmem_alloc().  The allocation is performed by an ioctl
     69  1.6  tsutsui  *     call on the raw partition.
     70  1.1      gwr  */
     71  1.5       pk #define MD_UMEM_SERVER 3
     72  1.1      gwr /*
     73  1.1      gwr  *     Indirect access to user-space of a user-level server.
     74  1.1      gwr  *     (Like the MFS hack, but better! 8^)  Device operates
     75  1.6  tsutsui  *     only while the server has the raw partition open and
     76  1.1      gwr  *     continues to service I/O requests.  The process that
     77  1.2      gwr  *     does this setconf will become the I/O server.  This
     78  1.2      gwr  *     configuration type can be disabled using:
     79  1.5       pk  *         options  MEMORY_DISK_SERVER=0
     80  1.1      gwr  */
     81  1.1      gwr 
     82  1.1      gwr #ifdef	_KERNEL
     83  1.1      gwr /*
     84  1.5       pk  * If the option MEMORY_DISK_HOOKS is on, then these functions are
     85  1.1      gwr  * called by the ramdisk driver to allow machine-dependent to
     86  1.3      leo  * match/configure and/or load each ramdisk unit.
     87  1.1      gwr  */
     88  1.7      uch extern void md_attach_hook(int, struct md_conf *);
     89  1.7      uch extern void md_open_hook(int, struct md_conf *);
     90  1.7      uch #ifdef MEMORY_DISK_DYNAMIC
     91  1.7      uch extern void md_root_setconf(char *, size_t);
     92  1.1      gwr #endif
     93  1.7      uch #endif /* _KERNEL */
     94