1178172Simp/*- 2206714Sjmallett * Copyright (c) 2003 Alan L. Cox <alc@cs.rice.edu> 3178172Simp * All rights reserved. 4178172Simp * 5178172Simp * Redistribution and use in source and binary forms, with or without 6178172Simp * modification, are permitted provided that the following conditions 7178172Simp * are met: 8178172Simp * 1. Redistributions of source code must retain the above copyright 9178172Simp * notice, this list of conditions and the following disclaimer. 10178172Simp * 2. Redistributions in binary form must reproduce the above copyright 11178172Simp * notice, this list of conditions and the following disclaimer in the 12178172Simp * documentation and/or other materials provided with the distribution. 13178172Simp * 14178172Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15178172Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16178172Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17178172Simp * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18178172Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19178172Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20178172Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21178172Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22178172Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23178172Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24178172Simp * SUCH DAMAGE. 25178172Simp * 26178172Simp * $FreeBSD$ 27178172Simp */ 28178172Simp 29178172Simp#ifndef _MACHINE_SF_BUF_H_ 30206714Sjmallett#define _MACHINE_SF_BUF_H_ 31178172Simp 32269577Sglebius#ifdef __mips_n64 /* In 64 bit the whole memory is directly mapped */ 33178172Simp 34269577Sglebiusstatic inline vm_offset_t 35217944Sjchandrasf_buf_kva(struct sf_buf *sf) 36217944Sjchandra{ 37217944Sjchandra vm_page_t m; 38217944Sjchandra 39217944Sjchandra m = (vm_page_t)sf; 40217944Sjchandra return (MIPS_PHYS_TO_DIRECT(VM_PAGE_TO_PHYS(m))); 41217944Sjchandra} 42217944Sjchandra 43269577Sglebiusstatic inline struct vm_page * 44217944Sjchandrasf_buf_page(struct sf_buf *sf) 45217944Sjchandra{ 46217944Sjchandra 47217944Sjchandra return ((vm_page_t)sf); 48217944Sjchandra} 49217944Sjchandra 50271217Sglebius#else /* !__mips_n64 */ 51271213Sadrian 52271213Sadrianstatic inline void 53271213Sadriansf_buf_map(struct sf_buf *sf, int flags) 54271213Sadrian{ 55271213Sadrian 56271213Sadrian pmap_qenter(sf->kva, &sf->m, 1); 57271213Sadrian} 58271213Sadrian 59271213Sadrianstatic inline int 60271213Sadriansf_buf_unmap(struct sf_buf *sf) 61271213Sadrian{ 62271217Sglebius 63271213Sadrian pmap_qremove(sf->kva, 1); 64271213Sadrian return (1); 65271213Sadrian} 66271213Sadrian 67271217Sglebius#endif /* __mips_n64 */ 68271213Sadrian 69178172Simp#endif /* !_MACHINE_SF_BUF_H_ */ 70