Annotation of sys/sys/memrange.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: memrange.h,v 1.4 2002/10/14 21:01:01 matthieu Exp $ */
2: /*-
3: * Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
4: * All rights reserved.
5: *
6: * Redistribution and use in source and binary forms, with or without
7: * modification, are permitted provided that the following conditions
8: * are met:
9: * 1. Redistributions of source code must retain the above copyright
10: * notice, this list of conditions and the following disclaimer.
11: * 2. Redistributions in binary form must reproduce the above copyright
12: * notice, this list of conditions and the following disclaimer in the
13: * documentation and/or other materials provided with the distribution.
14: *
15: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25: * SUCH DAMAGE.
26: */
27: /*
28: * Memory range attribute operations, peformed on /dev/mem
29: */
30:
31: /* Memory range attributes */
32: #define MDF_UNCACHEABLE (1<<0) /* region not cached */
33: #define MDF_WRITECOMBINE (1<<1) /* region supports "write combine" action */
34: #define MDF_WRITETHROUGH (1<<2) /* write-through cached */
35: #define MDF_WRITEBACK (1<<3) /* write-back cached */
36: #define MDF_WRITEPROTECT (1<<4) /* read-only region */
37: #define MDF_UNKNOWN (1<<5) /* any state we don't understand */
38: #define MDF_ATTRMASK (0x00ffffff)
39:
40: #define MDF_FIXBASE (1<<24) /* fixed base */
41: #define MDF_FIXLEN (1<<25) /* fixed length */
42: #define MDF_FIRMWARE (1<<26) /* set by firmware (XXX not useful?) */
43: #define MDF_ACTIVE (1<<27) /* currently active */
44: #define MDF_BOGUS (1<<28) /* we don't like it */
45: #define MDF_FIXACTIVE (1<<29) /* can't be turned off */
46: #define MDF_BUSY (1<<30) /* range is in use */
47: #define MDF_FORCE (1<<31) /* force risky changes */
48:
49: struct mem_range_desc
50: {
51: u_int64_t mr_base;
52: u_int64_t mr_len;
53: int mr_flags;
54: char mr_owner[8];
55: };
56:
57: struct mem_range_op
58: {
59: struct mem_range_desc *mo_desc;
60: int mo_arg[2];
61: #define MEMRANGE_SET_UPDATE 0
62: #define MEMRANGE_SET_REMOVE 1
63: /* XXX want a flag that says "set and undo when I exit" */
64: };
65:
66: #define MEMRANGE_GET _IOWR('m', 50, struct mem_range_op)
67: #define MEMRANGE_SET _IOW('m', 51, struct mem_range_op)
68:
69: #ifdef _KERNEL
70:
71: struct mem_range_softc;
72: struct mem_range_ops
73: {
74: void (*init)(struct mem_range_softc *sc);
75: int (*set)(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg);
76: void (*initAP)(struct mem_range_softc *sc);
77: };
78:
79: struct mem_range_softc
80: {
81: struct mem_range_ops *mr_op;
82: int mr_cap;
83: int mr_ndesc;
84: struct mem_range_desc *mr_desc;
85: };
86:
87: extern struct mem_range_softc mem_range_softc;
88:
89: __BEGIN_DECLS
90: extern int mem_range_attr_get(struct mem_range_desc *mrd, int *arg);
91: extern int mem_range_attr_set(struct mem_range_desc *mrd, int *arg);
92: extern void mem_range_AP_init(void);
93: __END_DECLS
94: #endif
95:
CVSweb