Rev 1772 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1772 | Rev 1782 | ||
|---|---|---|---|
| Line 27... | Line 27... | ||
| 27 | */ |
27 | */ |
| 28 | 28 | ||
| 29 | #include "ofw.h" |
29 | #include "ofw.h" |
| 30 | #include <printf.h> |
30 | #include <printf.h> |
| 31 | #include <asm.h> |
31 | #include <asm.h> |
| - | 32 | #include <types.h> |
|
| 32 | 33 | ||
| 33 | #define MAX_OFW_ARGS 10 |
34 | #define MAX_OFW_ARGS 10 |
| 34 | 35 | ||
| 35 | /** OpenFirmware command structure |
36 | /** OpenFirmware command structure |
| 36 | * |
37 | * |
| Line 165... | Line 166... | ||
| 165 | } |
166 | } |
| 166 | 167 | ||
| 167 | 168 | ||
| 168 | void *ofw_translate(const void *virt) |
169 | void *ofw_translate(const void *virt) |
| 169 | { |
170 | { |
| 170 | ofw_arg_t result[3]; |
171 | ofw_arg_t result[4]; |
| - | 172 | int shift; |
|
| 171 | 173 | ||
| 172 | if (ofw_call("call-method", 4, 4, result, "translate", ofw_mmu, virt, 1) != 0) { |
174 | if (ofw_call("call-method", 3, 5, result, "translate", ofw_mmu, virt) != 0) { |
| 173 | puts("Error: MMU method translate() failed, halting.\n"); |
175 | puts("Error: MMU method translate() failed, halting.\n"); |
| 174 | halt(); |
176 | halt(); |
| 175 | } |
177 | } |
| - | 178 | ||
| 176 | return (void *) result[2]; |
179 | if (sizeof(unative_t) == 8) |
| - | 180 | shift = 32; |
|
| - | 181 | else |
|
| - | 182 | shift = 0; |
|
| - | 183 | ||
| - | 184 | return (void *) (((result[2]&0xffffffff)<<shift)|((result[3])&0xffffffff)); |
|
| 177 | } |
185 | } |
| 178 | 186 | ||
| 179 | 187 | ||
| 180 | int ofw_map(const void *phys, const void *virt, const int size, const int mode) |
188 | int ofw_map(const void *phys, const void *virt, const int size, const int mode) |
| 181 | { |
189 | { |
| - | 190 | uintptr_t phys_hi, phys_lo; |
|
| - | 191 | ||
| - | 192 | if (sizeof(unative_t) == 8) { |
|
| - | 193 | int shift = 32; |
|
| - | 194 | phys_hi = (uintptr_t) phys >> shift; |
|
| - | 195 | phys_lo = (uintptr_t) phys & 0xffffffff; |
|
| - | 196 | } else { |
|
| - | 197 | phys_hi = 0; |
|
| - | 198 | phys_lo = (uintptr_t) phys; |
|
| - | 199 | } |
|
| - | 200 | ||
| 182 | return ofw_call("call-method", 6, 1, NULL, "map", ofw_mmu, mode, size, virt, phys); |
201 | return ofw_call("call-method", 7, 1, NULL, "map", ofw_mmu, mode, size, virt, |
| - | 202 | phys_hi, phys_lo); |
|
| 183 | } |
203 | } |
| 184 | 204 | ||
| 185 | 205 | ||
| 186 | int ofw_memmap(memmap_t *map) |
206 | int ofw_memmap(memmap_t *map) |
| 187 | { |
207 | { |
| Line 236... | Line 256... | ||
| 236 | if (ofw_get_property(device, "linebytes", &screen->scanline, sizeof(screen->scanline)) <= 0) |
256 | if (ofw_get_property(device, "linebytes", &screen->scanline, sizeof(screen->scanline)) <= 0) |
| 237 | return false; |
257 | return false; |
| 238 | 258 | ||
| 239 | return true; |
259 | return true; |
| 240 | } |
260 | } |
| 241 | - | ||