1122780Salc/*-
2122780Salc * Copyright (c) 2003 Alan L. Cox <alc@cs.rice.edu>
3122780Salc * All rights reserved.
4122780Salc *
5122780Salc * Redistribution and use in source and binary forms, with or without
6122780Salc * modification, are permitted provided that the following conditions
7122780Salc * are met:
8122780Salc * 1. Redistributions of source code must retain the above copyright
9122780Salc *    notice, this list of conditions and the following disclaimer.
10122780Salc * 2. Redistributions in binary form must reproduce the above copyright
11122780Salc *    notice, this list of conditions and the following disclaimer in the
12122780Salc *    documentation and/or other materials provided with the distribution.
13122780Salc *
14122780Salc * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15122780Salc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16122780Salc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17122780Salc * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18122780Salc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19122780Salc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20122780Salc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21122780Salc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22122780Salc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23122780Salc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24122780Salc * SUCH DAMAGE.
25122780Salc *
26122780Salc * $FreeBSD$
27122780Salc */
28122780Salc
29122780Salc#ifndef _MACHINE_SF_BUF_H_
30122780Salc#define _MACHINE_SF_BUF_H_
31122780Salc
32122780Salc#include <vm/vm.h>
33122780Salc#include <vm/vm_param.h>
34122780Salc#include <vm/vm_page.h>
35122780Salc
36128393Salc/*
37128393Salc * On this machine, the only purpose for which sf_buf is used is to implement
38128393Salc * an opaque pointer required by the machine-independent parts of the kernel.
39128393Salc * That pointer references the vm_page that is "mapped" by the sf_buf.  The
40128393Salc * actual mapping is provided by the direct virtual-to-physical mapping.
41128393Salc */
42128393Salcstruct sf_buf;
43122780Salc
44255289Sglebiusstatic inline struct sf_buf *
45255289Sglebiussf_buf_alloc(struct vm_page *m, int pri)
46255289Sglebius{
47255289Sglebius
48255289Sglebius	return ((struct sf_buf *)m);
49255289Sglebius}
50255289Sglebius
51255289Sglebiusstatic inline void
52255289Sglebiussf_buf_free(struct sf_buf *sf)
53255289Sglebius{
54255289Sglebius}
55255289Sglebius
56223873Smarcelstatic __inline vm_page_t
57223873Smarcelsf_buf_page(struct sf_buf *sf)
58122780Salc{
59223873Smarcel
60223873Smarcel	return ((vm_page_t)sf);
61122780Salc}
62122780Salc
63223873Smarcelstatic __inline vm_offset_t
64223873Smarcelsf_buf_kva(struct sf_buf *sf)
65122780Salc{
66223873Smarcel	vm_page_t m;
67122780Salc
68223873Smarcel	m = sf_buf_page(sf);
69223873Smarcel	return (pmap_page_to_va(m));
70122780Salc}
71122780Salc
72122780Salc#endif /* !_MACHINE_SF_BUF_H_ */
73