28 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
29 |
* |
* |
30 |
* |
* |
31 |
* $Id: memory.h,v 1.51 2006/07/08 12:30:03 debug Exp $ |
* $Id: memory.h,v 1.52 2006/09/01 15:42:59 debug Exp $ |
32 |
* |
* |
33 |
* Memory controller related functions. |
* Memory related functions. |
34 |
*/ |
*/ |
35 |
|
|
36 |
#include <sys/types.h> |
#include <sys/types.h> |
40 |
|
|
41 |
|
|
42 |
#define DEFAULT_RAM_IN_MB 32 |
#define DEFAULT_RAM_IN_MB 32 |
|
#define MAX_DEVICES 26 |
|
43 |
|
|
44 |
struct cpu; |
struct cpu; |
|
struct translation_page_entry; |
|
45 |
|
|
46 |
|
|
47 |
|
/* |
48 |
|
* Memory mapped device |
49 |
|
*/ |
50 |
|
struct memory_device { |
51 |
|
uint64_t baseaddr; |
52 |
|
uint64_t endaddr; /* NOTE: after the last byte! */ |
53 |
|
uint64_t length; |
54 |
|
int flags; |
55 |
|
|
56 |
|
const char *name; |
57 |
|
|
58 |
|
int (*f)(struct cpu *,struct memory *, |
59 |
|
uint64_t,unsigned char *,size_t,int,void *); |
60 |
|
void *extra; |
61 |
|
|
62 |
|
unsigned char *dyntrans_data; |
63 |
|
|
64 |
|
uint64_t dyntrans_write_low; |
65 |
|
uint64_t dyntrans_write_high; |
66 |
|
}; |
67 |
|
|
68 |
|
|
69 |
|
/* |
70 |
|
* Memory |
71 |
|
* ------ |
72 |
|
* |
73 |
|
* This struct defines a memory object. Most machines only use one memory |
74 |
|
* object (the main memory), but if necessary, multiple memories can be |
75 |
|
* used. |
76 |
|
*/ |
77 |
struct memory { |
struct memory { |
78 |
uint64_t physical_max; |
uint64_t physical_max; |
79 |
void *pagetable; |
void *pagetable; |
80 |
|
|
81 |
|
int dev_dyntrans_alignment; |
82 |
|
|
83 |
int n_mmapped_devices; |
int n_mmapped_devices; |
84 |
int last_accessed_device; |
int last_accessed_device; |
85 |
/* The following two might speed up things a little bit. */ |
/* The following two might speed up things a little bit. */ |
87 |
uint64_t mmap_dev_minaddr; |
uint64_t mmap_dev_minaddr; |
88 |
uint64_t mmap_dev_maxaddr; |
uint64_t mmap_dev_maxaddr; |
89 |
|
|
90 |
const char *dev_name[MAX_DEVICES]; |
struct memory_device *devices; |
|
uint64_t dev_baseaddr[MAX_DEVICES]; |
|
|
uint64_t dev_endaddr[MAX_DEVICES]; /* after the end! */ |
|
|
uint64_t dev_length[MAX_DEVICES]; |
|
|
int dev_flags[MAX_DEVICES]; |
|
|
void *dev_extra[MAX_DEVICES]; |
|
|
int (*dev_f[MAX_DEVICES])(struct cpu *,struct memory *, |
|
|
uint64_t,unsigned char *,size_t,int,void *); |
|
|
unsigned char *dev_dyntrans_data[MAX_DEVICES]; |
|
|
|
|
|
uint64_t dev_dyntrans_write_low[MAX_DEVICES]; |
|
|
uint64_t dev_dyntrans_write_high[MAX_DEVICES]; |
|
|
|
|
|
int dev_dyntrans_alignment; |
|
91 |
}; |
}; |
92 |
|
|
93 |
#define BITS_PER_PAGETABLE 20 |
#define BITS_PER_PAGETABLE 20 |