16fc729afSOlivier Houchard /*-
2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause
3af3dc4a7SPedro F. Giffuni *
46fc729afSOlivier Houchard * Copyright (c) 2003 Alan L. Cox <alc@cs.rice.edu>
56fc729afSOlivier Houchard * All rights reserved.
66fc729afSOlivier Houchard *
76fc729afSOlivier Houchard * Redistribution and use in source and binary forms, with or without
86fc729afSOlivier Houchard * modification, are permitted provided that the following conditions
96fc729afSOlivier Houchard * are met:
106fc729afSOlivier Houchard * 1. Redistributions of source code must retain the above copyright
116fc729afSOlivier Houchard * notice, this list of conditions and the following disclaimer.
126fc729afSOlivier Houchard * 2. Redistributions in binary form must reproduce the above copyright
136fc729afSOlivier Houchard * notice, this list of conditions and the following disclaimer in the
146fc729afSOlivier Houchard * documentation and/or other materials provided with the distribution.
156fc729afSOlivier Houchard *
166fc729afSOlivier Houchard * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
176fc729afSOlivier Houchard * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
186fc729afSOlivier Houchard * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
196fc729afSOlivier Houchard * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
206fc729afSOlivier Houchard * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
216fc729afSOlivier Houchard * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
226fc729afSOlivier Houchard * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
236fc729afSOlivier Houchard * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
246fc729afSOlivier Houchard * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
256fc729afSOlivier Houchard * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
266fc729afSOlivier Houchard * SUCH DAMAGE.
276fc729afSOlivier Houchard */
286fc729afSOlivier Houchard
296fc729afSOlivier Houchard #ifndef _MACHINE_SF_BUF_H_
306fc729afSOlivier Houchard #define _MACHINE_SF_BUF_H_
316fc729afSOlivier Houchard
32c8d2ffd6SGleb Smirnoff static inline void
sf_buf_map(struct sf_buf * sf,int flags)33c8d2ffd6SGleb Smirnoff sf_buf_map(struct sf_buf *sf, int flags)
346fc729afSOlivier Houchard {
356fc729afSOlivier Houchard
3684233ddbSIan Lepore pmap_qenter(sf->kva, &(sf->m), 1);
376fc729afSOlivier Houchard }
386fc729afSOlivier Houchard
39c8d2ffd6SGleb Smirnoff static inline int
sf_buf_unmap(struct sf_buf * sf)40c8d2ffd6SGleb Smirnoff sf_buf_unmap(struct sf_buf *sf)
416fc729afSOlivier Houchard {
426fc729afSOlivier Houchard
43b09e6b5cSSvatopluk Kraus pmap_qremove(sf->kva, 1);
44c8d2ffd6SGleb Smirnoff return (1);
456fc729afSOlivier Houchard }
466fc729afSOlivier Houchard #endif /* !_MACHINE_SF_BUF_H_ */
47