1/* 2 * Memory range attribute operations, performed 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 29struct 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 36struct 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 44#define MEMRANGE_GET _IOWR('m', 50, struct mem_range_op) 45#define MEMRANGE_SET _IOW('m', 51, struct mem_range_op) 46 47#ifdef _KERNEL 48 49struct mem_range_softc; 50struct mem_range_ops { 51 void (*init) __P((struct mem_range_softc * sc)); 52 int (*set) 53 __P((struct mem_range_softc * sc, struct mem_range_desc * mrd, 54 int *arg)); 55 void (*initAP) __P((struct mem_range_softc * sc)); 56}; 57 58struct 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 65extern struct mem_range_softc mem_range_softc; 66 67extern int mem_range_attr_get __P((struct mem_range_desc * mrd, int *arg)); 68extern int mem_range_attr_set __P((struct mem_range_desc * mrd, int *arg)); 69extern void mem_range_AP_init __P((void)); 70#endif 71 72#endif 73