1*514549b5Sriastradh /* $NetBSD: uvm_device.h,v 1.15 2021/12/18 16:31:53 riastradh Exp $ */ 2f2caacc7Smrg 3f2caacc7Smrg /* 4f2caacc7Smrg * Copyright (c) 1997 Charles D. Cranor and Washington University. 5f2caacc7Smrg * All rights reserved. 6f2caacc7Smrg * 7f2caacc7Smrg * Redistribution and use in source and binary forms, with or without 8f2caacc7Smrg * modification, are permitted provided that the following conditions 9f2caacc7Smrg * are met: 10f2caacc7Smrg * 1. Redistributions of source code must retain the above copyright 11f2caacc7Smrg * notice, this list of conditions and the following disclaimer. 12f2caacc7Smrg * 2. Redistributions in binary form must reproduce the above copyright 13f2caacc7Smrg * notice, this list of conditions and the following disclaimer in the 14f2caacc7Smrg * documentation and/or other materials provided with the distribution. 15f2caacc7Smrg * 16f2caacc7Smrg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17f2caacc7Smrg * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18f2caacc7Smrg * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19f2caacc7Smrg * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20f2caacc7Smrg * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21f2caacc7Smrg * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22f2caacc7Smrg * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23f2caacc7Smrg * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24f2caacc7Smrg * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25f2caacc7Smrg * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 261f6b921cSmrg * 271f6b921cSmrg * from: Id: uvm_device.h,v 1.1.2.2 1997/10/03 17:39:44 chuck Exp 28f2caacc7Smrg */ 29f2caacc7Smrg 30021fdb64Sperry #ifndef _UVM_UVM_DEVICE_H_ 31021fdb64Sperry #define _UVM_UVM_DEVICE_H_ 32021fdb64Sperry 33*514549b5Sriastradh #include <sys/types.h> 34*514549b5Sriastradh #include <sys/queue.h> 35*514549b5Sriastradh 36*514549b5Sriastradh #include <uvm/uvm_object.h> 37*514549b5Sriastradh #include <uvm/uvm_param.h> 38*514549b5Sriastradh #include <uvm/uvm_prot.h> 39*514549b5Sriastradh 40f2caacc7Smrg /* 41f2caacc7Smrg * uvm_device.h 42f2caacc7Smrg * 43f2caacc7Smrg * device handle into the VM system. 44f2caacc7Smrg */ 45f2caacc7Smrg 469fc45356Sriastradh #include <sys/types.h> 479fc45356Sriastradh 489fc45356Sriastradh #include <sys/queue.h> 499fc45356Sriastradh 509fc45356Sriastradh #include <uvm/uvm_object.h> 519fc45356Sriastradh 52f2caacc7Smrg /* 53f2caacc7Smrg * the uvm_device structure. object is put at the top of the data structure. 54f2caacc7Smrg * this allows: 55f2caacc7Smrg * (struct uvm_device *) == (struct uvm_object *) 56f2caacc7Smrg */ 57f2caacc7Smrg 58f2caacc7Smrg struct uvm_device { 59f2caacc7Smrg struct uvm_object u_obj; /* the actual VM object */ 60f2caacc7Smrg int u_flags; /* flags [LOCKED BY UDV_LOCK!] */ 61f2caacc7Smrg dev_t u_device; /* our device */ 62f2caacc7Smrg LIST_ENTRY(uvm_device) u_list; /* list of device objects */ 63f2caacc7Smrg }; 64f2caacc7Smrg 65f2caacc7Smrg /* 66f2caacc7Smrg * u_flags values 67f2caacc7Smrg */ 68f2caacc7Smrg 69f2caacc7Smrg #define UVM_DEVICE_HOLD 0x1 /* someone has a "hold" on it */ 70f2caacc7Smrg #define UVM_DEVICE_WANTED 0x2 /* someone wants to put a "hold" on */ 71f2caacc7Smrg 72abb48c5bSthorpej #ifdef _KERNEL 73abb48c5bSthorpej 749fc45356Sriastradh #include <uvm/uvm_param.h> 759fc45356Sriastradh #include <uvm/uvm_prot.h> 769fc45356Sriastradh 77f2caacc7Smrg /* 78f2caacc7Smrg * prototypes 79f2caacc7Smrg */ 80f2caacc7Smrg 816d40f9ffSchs struct uvm_object *udv_attach(dev_t, vm_prot_t, voff_t, vsize_t); 82f2caacc7Smrg 83abb48c5bSthorpej #endif /* _KERNEL */ 84abb48c5bSthorpej 85021fdb64Sperry #endif /* _UVM_UVM_DEVICE_H_ */ 86