Rev 1395 | Rev 1765 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1395 | Rev 1401 | ||
|---|---|---|---|
| Line 174... | Line 174... | ||
| 174 | 174 | ||
| 175 | void *ofw_translate(const void *virt) |
175 | void *ofw_translate(const void *virt) |
| 176 | { |
176 | { |
| 177 | ofw_arg_t result[3]; |
177 | ofw_arg_t result[3]; |
| 178 | 178 | ||
| 179 | if (ofw_call("call-method", 4, 4, result, "translate", ofw_mmu, virt, 1) != 0) { |
179 | if (ofw_call("call-method", 4, 4, result, "translate", ofw_mmu, (unsigned long) virt, 1) != 0) { |
| 180 | puts("Error: MMU method translate() failed, halting.\n"); |
180 | puts("Error: MMU method translate() failed, halting.\n"); |
| 181 | halt(); |
181 | halt(); |
| 182 | } |
182 | } |
| 183 | return (void *) result[2]; |
183 | return (void *) (unsigned long) result[2]; |
| 184 | } |
184 | } |
| 185 | 185 | ||
| 186 | 186 | ||
| 187 | int ofw_map(const void *phys, const void *virt, const int size, const int mode) |
187 | int ofw_map(const void *phys, const void *virt, const long size, const int mode) |
| 188 | { |
188 | { |
| 189 | return ofw_call("call-method", 6, 1, NULL, "map", ofw_mmu, mode, size, virt, phys); |
189 | return ofw_call("call-method", 6, 1, NULL, "map", ofw_mmu, mode, size, virt, phys); |
| 190 | } |
190 | } |
| 191 | 191 | ||
| 192 | 192 | ||
| Line 202... | Line 202... | ||
| 202 | 202 | ||
| 203 | int pos; |
203 | int pos; |
| 204 | map->total = 0; |
204 | map->total = 0; |
| 205 | map->count = 0; |
205 | map->count = 0; |
| 206 | for (pos = 0; (pos < ret / sizeof(unsigned int)) && (map->count < MEMMAP_MAX_RECORDS); pos += ac + sc) { |
206 | for (pos = 0; (pos < ret / sizeof(unsigned int)) && (map->count < MEMMAP_MAX_RECORDS); pos += ac + sc) { |
| 207 | void * start = (void *) buf[pos + ac - 1]; |
207 | void * start = (void *) (unsigned long) buf[pos + ac - 1]; |
| 208 | unsigned int size = buf[pos + ac + sc - 1]; |
208 | unsigned int size = buf[pos + ac + sc - 1]; |
| 209 | 209 | ||
| 210 | if (size > 0) { |
210 | if (size > 0) { |
| 211 | map->zones[map->count].start = start; |
211 | map->zones[map->count].start = start; |
| 212 | map->zones[map->count].size = size; |
212 | map->zones[map->count].size = size; |