Home | History | Annotate | Line # | Download | only in uvm
uvm_pager.h revision 1.23.2.1
      1  1.23.2.1  thorpej /*	$NetBSD: uvm_pager.h,v 1.23.2.1 2002/01/10 20:05:45 thorpej Exp $	*/
      2       1.1      mrg 
      3       1.1      mrg /*
      4       1.1      mrg  *
      5       1.1      mrg  * Copyright (c) 1997 Charles D. Cranor and Washington University.
      6       1.1      mrg  * All rights reserved.
      7       1.1      mrg  *
      8       1.1      mrg  * Redistribution and use in source and binary forms, with or without
      9       1.1      mrg  * modification, are permitted provided that the following conditions
     10       1.1      mrg  * are met:
     11       1.1      mrg  * 1. Redistributions of source code must retain the above copyright
     12       1.1      mrg  *    notice, this list of conditions and the following disclaimer.
     13       1.1      mrg  * 2. Redistributions in binary form must reproduce the above copyright
     14       1.1      mrg  *    notice, this list of conditions and the following disclaimer in the
     15       1.1      mrg  *    documentation and/or other materials provided with the distribution.
     16       1.1      mrg  * 3. All advertising materials mentioning features or use of this software
     17       1.1      mrg  *    must display the following acknowledgement:
     18       1.1      mrg  *      This product includes software developed by Charles D. Cranor and
     19       1.1      mrg  *      Washington University.
     20       1.1      mrg  * 4. The name of the author may not be used to endorse or promote products
     21       1.1      mrg  *    derived from this software without specific prior written permission.
     22       1.1      mrg  *
     23       1.1      mrg  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     24       1.1      mrg  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     25       1.1      mrg  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     26       1.1      mrg  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     27       1.1      mrg  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     28       1.1      mrg  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     29       1.1      mrg  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     30       1.1      mrg  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     31       1.1      mrg  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     32       1.1      mrg  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     33       1.3      mrg  *
     34       1.3      mrg  * from: Id: uvm_pager.h,v 1.1.2.14 1998/01/13 19:00:50 chuck Exp
     35       1.1      mrg  */
     36       1.1      mrg 
     37      1.16      mrg /*
     38      1.16      mrg  * Copyright (c) 1990 University of Utah.
     39      1.16      mrg  * Copyright (c) 1991, 1993
     40      1.16      mrg  *	The Regents of the University of California.  All rights reserved.
     41      1.16      mrg  *
     42      1.16      mrg  * This code is derived from software contributed to Berkeley by
     43      1.16      mrg  * the Systems Programming Group of the University of Utah Computer
     44      1.16      mrg  * Science Department.
     45      1.16      mrg  *
     46      1.16      mrg  * Redistribution and use in source and binary forms, with or without
     47      1.16      mrg  * modification, are permitted provided that the following conditions
     48      1.16      mrg  * are met:
     49      1.16      mrg  * 1. Redistributions of source code must retain the above copyright
     50      1.16      mrg  *    notice, this list of conditions and the following disclaimer.
     51      1.16      mrg  * 2. Redistributions in binary form must reproduce the above copyright
     52      1.16      mrg  *    notice, this list of conditions and the following disclaimer in the
     53      1.16      mrg  *    documentation and/or other materials provided with the distribution.
     54      1.16      mrg  * 3. All advertising materials mentioning features or use of this software
     55      1.16      mrg  *    must display the following acknowledgement:
     56      1.16      mrg  *	This product includes software developed by the University of
     57      1.16      mrg  *	California, Berkeley and its contributors.
     58      1.16      mrg  * 4. Neither the name of the University nor the names of its contributors
     59      1.16      mrg  *    may be used to endorse or promote products derived from this software
     60      1.16      mrg  *    without specific prior written permission.
     61      1.16      mrg  *
     62      1.16      mrg  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     63      1.16      mrg  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     64      1.16      mrg  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     65      1.16      mrg  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     66      1.16      mrg  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     67      1.16      mrg  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     68      1.16      mrg  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     69      1.16      mrg  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     70      1.16      mrg  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     71      1.16      mrg  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     72      1.16      mrg  * SUCH DAMAGE.
     73      1.16      mrg  *
     74      1.16      mrg  *	@(#)vm_pager.h	8.5 (Berkeley) 7/7/94
     75      1.16      mrg  */
     76      1.16      mrg 
     77       1.4    perry #ifndef _UVM_UVM_PAGER_H_
     78       1.4    perry #define _UVM_UVM_PAGER_H_
     79       1.4    perry 
     80       1.1      mrg /*
     81       1.1      mrg  * uvm_pager.h
     82       1.1      mrg  */
     83       1.1      mrg 
     84       1.1      mrg /*
     85  1.23.2.1  thorpej  * forward structure declarations
     86  1.23.2.1  thorpej  */
     87  1.23.2.1  thorpej 
     88  1.23.2.1  thorpej struct uvm_faultinfo;
     89  1.23.2.1  thorpej 
     90  1.23.2.1  thorpej /*
     91       1.1      mrg  * pager ops
     92       1.1      mrg  */
     93       1.1      mrg 
     94       1.1      mrg struct uvm_pagerops {
     95  1.23.2.1  thorpej 
     96  1.23.2.1  thorpej 	/* init pager */
     97  1.23.2.1  thorpej 	void	(*pgo_init) __P((void));
     98  1.23.2.1  thorpej 
     99  1.23.2.1  thorpej 	/* add reference to obj */
    100  1.23.2.1  thorpej 	void	(*pgo_reference)(struct uvm_object *);
    101  1.23.2.1  thorpej 
    102  1.23.2.1  thorpej 	/* drop reference to obj */
    103  1.23.2.1  thorpej 	void	(*pgo_detach)(struct uvm_object *);
    104  1.23.2.1  thorpej 
    105  1.23.2.1  thorpej 	/* special non-standard fault processing */
    106  1.23.2.1  thorpej 	int	(*pgo_fault)(struct uvm_faultinfo *, vaddr_t, struct vm_page **,
    107  1.23.2.1  thorpej 			     int, int, vm_fault_t, vm_prot_t, int);
    108  1.23.2.1  thorpej 
    109  1.23.2.1  thorpej 	/* get/read pages */
    110  1.23.2.1  thorpej 	int	(*pgo_get)(struct uvm_object *, voff_t, struct vm_page **,
    111  1.23.2.1  thorpej 			   int *, int, vm_prot_t, int, int);
    112  1.23.2.1  thorpej 
    113  1.23.2.1  thorpej 	/* put/write pages */
    114  1.23.2.1  thorpej 	int	(*pgo_put)(struct uvm_object *, voff_t, voff_t, int);
    115       1.1      mrg };
    116       1.1      mrg 
    117       1.1      mrg /* pager flags [mostly for flush] */
    118       1.1      mrg 
    119       1.1      mrg #define PGO_CLEANIT	0x001	/* write dirty pages to backing store */
    120      1.20      chs #define PGO_SYNCIO	0x002	/* if PGO_CLEANIT: use sync I/O? */
    121       1.1      mrg #define PGO_DEACTIVATE	0x004	/* deactivate flushed pages */
    122       1.1      mrg #define PGO_FREE	0x008	/* free flushed pages */
    123      1.20      chs /* if PGO_FREE is not set then the pages stay where they are. */
    124       1.1      mrg 
    125       1.1      mrg #define PGO_ALLPAGES	0x010	/* flush whole object/get all pages */
    126       1.1      mrg #define PGO_LOCKED	0x040	/* fault data structures are locked [get] */
    127      1.20      chs #define PGO_OVERWRITE	0x200	/* pages will be overwritten before unlocked */
    128      1.20      chs #define PGO_WEAK	0x400	/* "weak" put, for nfs */
    129      1.20      chs #define PGO_PASTEOF	0x800	/* allow allocation of pages past EOF */
    130       1.1      mrg 
    131       1.1      mrg /* page we are not interested in getting */
    132      1.20      chs #define PGO_DONTCARE ((struct vm_page *) -1L)	/* [get only] */
    133       1.1      mrg 
    134      1.10  thorpej #ifdef _KERNEL
    135      1.10  thorpej 
    136       1.1      mrg /*
    137       1.1      mrg  * handle inline options
    138       1.1      mrg  */
    139       1.1      mrg 
    140       1.1      mrg #ifdef UVM_PAGER_INLINE
    141       1.1      mrg #define PAGER_INLINE static __inline
    142      1.22      chs #else
    143       1.1      mrg #define PAGER_INLINE /* nothing */
    144       1.1      mrg #endif /* UVM_PAGER_INLINE */
    145       1.1      mrg 
    146       1.1      mrg /*
    147       1.1      mrg  * prototypes
    148       1.1      mrg  */
    149       1.1      mrg 
    150  1.23.2.1  thorpej void	uvm_pager_init __P((void));
    151       1.7      eeh PAGER_INLINE struct vm_page *uvm_pageratop __P((vaddr_t));
    152  1.23.2.1  thorpej vaddr_t	uvm_pagermapin __P((struct vm_page **, int, int));
    153  1.23.2.1  thorpej void	uvm_pagermapout __P((vaddr_t, int));
    154      1.15  thorpej 
    155      1.15  thorpej /* Flags to uvm_pagermapin() */
    156      1.15  thorpej #define	UVMPAGER_MAPIN_WAITOK	0x01	/* it's okay to wait */
    157  1.23.2.1  thorpej #define	UVMPAGER_MAPIN_READ	0x02	/* device -> host */
    158  1.23.2.1  thorpej #define	UVMPAGER_MAPIN_WRITE	0x00	/* host -> device (pseudo flag) */
    159      1.18      chs 
    160      1.18      chs /*
    161      1.18      chs  * XXX
    162      1.18      chs  * this is needed until the device strategy interface
    163      1.18      chs  * is changed to do physically-addressed i/o.
    164      1.18      chs  */
    165      1.18      chs 
    166      1.19      chs #ifndef PAGER_MAP_SIZE
    167      1.18      chs #define PAGER_MAP_SIZE       (16 * 1024 * 1024)
    168      1.19      chs #endif
    169       1.1      mrg 
    170      1.10  thorpej #endif /* _KERNEL */
    171       1.4    perry 
    172       1.4    perry #endif /* _UVM_UVM_PAGER_H_ */
    173