2 * Copyright (c) 2004 Matthew Dillon <dillon@backplane.com>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * $DragonFly: src/sys/sys/xio.h,v 1.4 2004/06/06 19:16:51 dillon Exp $
30 * The XIO structure is intended to replace UIO for messaged I/O operations
31 * within the kernel. The originator of the transaction must supply an XIO
32 * structure containing a list of appropriate held vm_page's representing
33 * the buffer. The target of the transaction will generally map the
34 * pages using the SF_BUF facility, complete the operation, and reply the
40 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
42 #ifndef _SYS_MSGPORT_H_
43 #include <sys/msgport.h>
46 #define XIO_INTERNAL_PAGES btoc(MAXPHYS)
47 #define XIO_INTERNAL_SIZE (XIO_INTERNAL_PAGES * PAGE_SIZE)
52 struct vm_page **xio_pages;
53 int xio_npages; /* number of pages in xio_pages[] array */
54 int xio_offset; /* byte offset (may exceed a page) */
55 int xio_bytes; /* number of bytes to transfer */
58 struct vm_page *xio_internal_pages[XIO_INTERNAL_PAGES];
61 typedef struct xio *xio_t;
63 #define XIOF_READ 0x0001
64 #define XIOF_WRITE 0x0002
65 #define XIOF_LINMAP 0x0004
71 void xio_init(xio_t xio);
72 int xio_init_ubuf(xio_t xio, void *ubase, size_t ubytes, int vmprot);
73 int xio_init_kbuf(xio_t xio, void *kbase, size_t kbytes);
74 void xio_release(xio_t xio);
75 int xio_uio_copy(xio_t xio, struct uio *uio, int *sizep);
76 int xio_copy_xtou(xio_t xio, void *uptr, int bytes);
77 int xio_copy_xtok(xio_t xio, void *kptr, int bytes);
81 #endif /* !_SYS_XIO_H_ */