sf_buf.h (e73976812c3f3aa97bdfce4a4f5e515e29a16f91) sf_buf.h (e45db9b837dc530b86149374e2baeaa775061107)
1/*-
1/*-
2 * Copyright (c) 2003, 2005 Alan L. Cox <alc@cs.rice.edu>
2 * Copyright (c) 2003 Alan L. Cox <alc@cs.rice.edu>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
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

--- 13 unchanged lines hidden (view full) ---

24 * SUCH DAMAGE.
25 *
26 * $FreeBSD$
27 */
28
29#ifndef _MACHINE_SF_BUF_H_
30#define _MACHINE_SF_BUF_H_
31
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
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

--- 13 unchanged lines hidden (view full) ---

24 * SUCH DAMAGE.
25 *
26 * $FreeBSD$
27 */
28
29#ifndef _MACHINE_SF_BUF_H_
30#define _MACHINE_SF_BUF_H_
31
32#include <sys/queue.h>
33
32#include <vm/vm.h>
33#include <vm/vm_param.h>
34#include <vm/vm_page.h>
35
34#include <vm/vm.h>
35#include <vm/vm_param.h>
36#include <vm/vm_page.h>
37
36/*
37 * On this machine, the only purpose for which sf_buf is used is to implement
38 * an opaque pointer required by the machine-independent parts of the kernel.
39 * That pointer references the vm_page that is "mapped" by the sf_buf. The
40 * actual mapping is provided by the direct virtual-to-physical mapping.
41 */
42struct sf_buf;
38struct sf_buf {
39 SLIST_ENTRY(sf_buf) free_list; /* list of free buffer slots */
40 vm_page_t m; /* currently mapped page */
41};
43
44static __inline vm_offset_t
45sf_buf_kva(struct sf_buf *sf)
46{
47
42
43static __inline vm_offset_t
44sf_buf_kva(struct sf_buf *sf)
45{
46
48 return (PHYS_TO_DMAP(VM_PAGE_TO_PHYS((vm_page_t)sf)));
47 return (PHYS_TO_DMAP(sf->m->phys_addr));
49}
50
51static __inline vm_page_t
52sf_buf_page(struct sf_buf *sf)
53{
54
48}
49
50static __inline vm_page_t
51sf_buf_page(struct sf_buf *sf)
52{
53
55 return ((vm_page_t)sf);
54 return (sf->m);
56}
57
58#endif /* !_MACHINE_SF_BUF_H_ */
55}
56
57#endif /* !_MACHINE_SF_BUF_H_ */