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