1 | /*
|
---|
2 | * Memory range attribute operations, peformed on /dev/mem
|
---|
3 | *
|
---|
4 | * $FreeBSD: src/sys/sys/memrange.h,v 1.4 1999/12/29 04:24:44 peter Exp $
|
---|
5 | */
|
---|
6 | /* $XFree86$ */
|
---|
7 |
|
---|
8 | #ifdef HAVE_XORG_CONFIG_H
|
---|
9 | #include <xorg-config.h>
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | #ifndef _MEMRANGE_H
|
---|
13 | #define _MEMRANGE_H
|
---|
14 |
|
---|
15 | /* Memory range attributes */
|
---|
16 | #define MDF_UNCACHEABLE (1<<0) /* region not cached */
|
---|
17 | #define MDF_WRITECOMBINE (1<<1) /* region supports "write combine"
|
---|
18 | * action */
|
---|
19 | #define MDF_WRITETHROUGH (1<<2) /* write-through cached */
|
---|
20 | #define MDF_WRITEBACK (1<<3) /* write-back cached */
|
---|
21 | #define MDF_WRITEPROTECT (1<<4) /* read-only region */
|
---|
22 | #define MDF_ATTRMASK (0x00ffffff)
|
---|
23 |
|
---|
24 | #define MDF_FIXBASE (1<<24) /* fixed base */
|
---|
25 | #define MDF_FIXLEN (1<<25) /* fixed length */
|
---|
26 | #define MDF_FIRMWARE (1<<26) /* set by firmware (XXX not useful?) */
|
---|
27 | #define MDF_ACTIVE (1<<27) /* currently active */
|
---|
28 | #define MDF_BOGUS (1<<28) /* we don't like it */
|
---|
29 | #define MDF_FIXACTIVE (1<<29) /* can't be turned off */
|
---|
30 | #define MDF_BUSY (1<<30) /* range is in use */
|
---|
31 |
|
---|
32 | struct mem_range_desc {
|
---|
33 | u_int64_t mr_base;
|
---|
34 | u_int64_t mr_len;
|
---|
35 | int mr_flags;
|
---|
36 | char mr_owner[8];
|
---|
37 | };
|
---|
38 |
|
---|
39 | struct mem_range_op {
|
---|
40 | struct mem_range_desc *mo_desc;
|
---|
41 | int mo_arg[2];
|
---|
42 | #define MEMRANGE_SET_UPDATE 0
|
---|
43 | #define MEMRANGE_SET_REMOVE 1
|
---|
44 | /* XXX want a flag that says "set and undo when I exit" */
|
---|
45 | };
|
---|
46 | #define MEMRANGE_GET _IOWR('m', 50, struct mem_range_op)
|
---|
47 | #define MEMRANGE_SET _IOW('m', 51, struct mem_range_op)
|
---|
48 |
|
---|
49 | #ifdef _KERNEL
|
---|
50 |
|
---|
51 | struct mem_range_softc;
|
---|
52 | struct mem_range_ops {
|
---|
53 | void (*init) __P((struct mem_range_softc * sc));
|
---|
54 | int (*set) __P((struct mem_range_softc * sc, struct mem_range_desc * mrd, int *arg));
|
---|
55 | void (*initAP) __P((struct mem_range_softc * sc));
|
---|
56 | };
|
---|
57 |
|
---|
58 | struct mem_range_softc {
|
---|
59 | struct mem_range_ops *mr_op;
|
---|
60 | int mr_cap;
|
---|
61 | int mr_ndesc;
|
---|
62 | struct mem_range_desc *mr_desc;
|
---|
63 | };
|
---|
64 |
|
---|
65 | extern struct mem_range_softc mem_range_softc;
|
---|
66 |
|
---|
67 | extern int mem_range_attr_get __P((struct mem_range_desc * mrd, int *arg));
|
---|
68 | extern int mem_range_attr_set __P((struct mem_range_desc * mrd, int *arg));
|
---|
69 | extern void mem_range_AP_init __P((void));
|
---|
70 | #endif
|
---|
71 |
|
---|
72 | #endif
|
---|