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