Rev 3232 | Rev 3908 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3232 | Rev 3236 | ||
---|---|---|---|
Line 42... | Line 42... | ||
42 | #include <arch/drivers/msim.h> |
42 | #include <arch/drivers/msim.h> |
43 | #include <arch/drivers/serial.h> |
43 | #include <arch/drivers/serial.h> |
44 | #include <print.h> |
44 | #include <print.h> |
45 | 45 | ||
46 | #define ZERO_PAGE_MASK TLB_PAGE_MASK_256K |
46 | #define ZERO_PAGE_MASK TLB_PAGE_MASK_256K |
47 | #define ZERO_FRAMES 16384 |
47 | #define ZERO_FRAMES 2048 |
48 | #define ZERO_PAGE_WIDTH 18 /* 256K */ |
48 | #define ZERO_PAGE_WIDTH 18 /* 256K */ |
49 | #define ZERO_PAGE_SIZE (1 << ZERO_PAGE_WIDTH) |
49 | #define ZERO_PAGE_SIZE (1 << ZERO_PAGE_WIDTH) |
50 | #define ZERO_PAGE_ASID ASID_INVALID |
50 | #define ZERO_PAGE_ASID ASID_INVALID |
51 | #define ZERO_PAGE_TLBI 0 |
51 | #define ZERO_PAGE_TLBI 0 |
52 | #define ZERO_PAGE_ADDR 0 |
52 | #define ZERO_PAGE_ADDR 0 |
53 | #define ZERO_PAGE_OFFSET (ZERO_PAGE_SIZE / sizeof(uint32_t) - 1) |
53 | #define ZERO_PAGE_OFFSET (ZERO_PAGE_SIZE / sizeof(uint32_t) - 1) |
54 | #define ZERO_PAGE_VALUE (((volatile uint32_t *) ZERO_PAGE_ADDR)[ZERO_PAGE_OFFSET]) |
54 | #define ZERO_PAGE_VALUE (((volatile uint32_t *) ZERO_PAGE_ADDR)[ZERO_PAGE_OFFSET]) |
55 | 55 | ||
- | 56 | #define ZERO_PAGE_VALUE_KSEG1(frame) (((volatile uint32_t *) (0xa0000000 + (frame << ZERO_PAGE_WIDTH)))[ZERO_PAGE_OFFSET]) |
|
- | 57 | ||
56 | #define MAX_REGIONS 32 |
58 | #define MAX_REGIONS 32 |
57 | 59 | ||
58 | typedef struct { |
60 | typedef struct { |
59 | pfn_t start; |
61 | pfn_t start; |
60 | pfn_t count; |
62 | pfn_t count; |
Line 71... | Line 73... | ||
71 | * mapped devices and cannot be used. |
73 | * mapped devices and cannot be used. |
72 | * |
74 | * |
73 | */ |
75 | */ |
74 | static bool frame_available(pfn_t frame) |
76 | static bool frame_available(pfn_t frame) |
75 | { |
77 | { |
- | 78 | #if MACHINE == msim |
|
76 | /* MSIM device (dprinter) */ |
79 | /* MSIM device (dprinter) */ |
77 | if (frame == (KA2PA(MSIM_VIDEORAM) >> ZERO_PAGE_WIDTH)) |
80 | if (frame == (KA2PA(MSIM_VIDEORAM) >> ZERO_PAGE_WIDTH)) |
78 | return false; |
81 | return false; |
79 | 82 | ||
80 | /* MSIM device (dkeyboard) */ |
83 | /* MSIM device (dkeyboard) */ |
81 | if (frame == (KA2PA(MSIM_KBD_ADDRESS) >> ZERO_PAGE_WIDTH)) |
84 | if (frame == (KA2PA(MSIM_KBD_ADDRESS) >> ZERO_PAGE_WIDTH)) |
82 | return false; |
85 | return false; |
- | 86 | #endif |
|
83 | 87 | ||
- | 88 | #if MACHINE == simics |
|
84 | /* Simics device (serial line) */ |
89 | /* Simics device (serial line) */ |
85 | if (frame == (KA2PA(SERIAL_ADDRESS) >> ZERO_PAGE_WIDTH)) |
90 | if (frame == (KA2PA(SERIAL_ADDRESS) >> ZERO_PAGE_WIDTH)) |
86 | return false; |
91 | return false; |
- | 92 | #endif |
|
- | 93 | ||
- | 94 | #if (MACHINE == lgxemul) || (MACHINE == bgxemul) |
|
- | 95 | /* gxemul devices */ |
|
- | 96 | if (overlaps(frame << ZERO_PAGE_WIDTH, ZERO_PAGE_SIZE, |
|
- | 97 | 0x10000000, MB2SIZE(256))) |
|
- | 98 | return false; |
|
- | 99 | #endif |
|
87 | 100 | ||
88 | return true; |
101 | return true; |
89 | } |
102 | } |
90 | 103 | ||
91 | 104 | ||
Line 203... | Line 216... | ||
203 | avail = false; |
216 | avail = false; |
204 | else { |
217 | else { |
205 | ZERO_PAGE_VALUE = 0xdeadbeef; |
218 | ZERO_PAGE_VALUE = 0xdeadbeef; |
206 | if (ZERO_PAGE_VALUE != 0xdeadbeef) |
219 | if (ZERO_PAGE_VALUE != 0xdeadbeef) |
207 | avail = false; |
220 | avail = false; |
- | 221 | #if (MACHINE == lgxemul) || (MACHINE == bgxemul) |
|
- | 222 | else { |
|
- | 223 | ZERO_PAGE_VALUE_KSEG1(frame) = 0xaabbccdd; |
|
- | 224 | if (ZERO_PAGE_VALUE_KSEG1(frame) != 0xaabbccdd) |
|
- | 225 | avail = false; |
|
- | 226 | } |
|
- | 227 | #endif |
|
208 | } |
228 | } |
209 | } |
229 | } |
210 | } |
230 | } |
211 | 231 | ||
212 | if (!avail) { |
232 | if (!avail) { |