Changeset 95b47c82 in mainline for boot/genarch/ofw.c
- Timestamp:
- 2007-04-15T20:51:04Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9a7a970
- Parents:
- ddee708
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/genarch/ofw.c
rddee708 r95b47c82 39 39 phandle ofw_root; 40 40 ihandle ofw_mmu; 41 ihandle ofw_memory_prop; 41 42 phandle ofw_memory; 42 43 phandle ofw_aliases; … … 48 49 halt(); 49 50 50 if (ofw_get_property(ofw_chosen, "stdout", 51 if (ofw_get_property(ofw_chosen, "stdout", &ofw_stdout, sizeof(ofw_stdout)) <= 0) 51 52 ofw_stdout = 0; 52 53 … … 57 58 } 58 59 59 if (ofw_get_property(ofw_chosen, "mmu", 60 if (ofw_get_property(ofw_chosen, "mmu", &ofw_mmu, sizeof(ofw_mmu)) <= 0) { 60 61 puts("\r\nError: Unable to get mmu property, halted.\r\n"); 62 halt(); 63 } 64 if (ofw_get_property(ofw_chosen, "memory", &ofw_memory_prop, sizeof(ofw_memory_prop)) <= 0) { 65 puts("\r\nError: Unable to get memory property, halted.\r\n"); 61 66 halt(); 62 67 } … … 201 206 shift = 0; 202 207 203 return (void *) ((result[2] <<shift)|result[3]);204 } 205 206 void *ofw_claim (const void *virt, const int len)208 return (void *) ((result[2] << shift) | result[3]); 209 } 210 211 void *ofw_claim_virt(const void *virt, const int len) 207 212 { 208 213 ofw_arg_t retaddr; 209 int shift;210 214 211 215 if (ofw_call("call-method", 5, 2, &retaddr, "claim", ofw_mmu, 0, len, virt) != 0) { … … 215 219 216 220 return (void *) retaddr; 221 } 222 223 void *ofw_claim_phys(const void *phys, const int len) 224 { 225 ofw_arg_t retaddr[2]; 226 int shift; 227 228 if (sizeof(unative_t) == 8) { 229 shift = 32; 230 if (ofw_call("call-method", 6, 3, retaddr, "claim", 231 ofw_memory_prop, 0, len, ((uintptr_t) phys) >> shift, 232 ((uintptr_t) phys) & ((uint32_t) -1)) != 0) { 233 /* 234 * Note that this will help us to discover 235 * conflicts between OpenFirmware allocations 236 * and our use of physical memory. 237 * It is better to detect collisions here 238 * than to cope with weird errors later. 239 * 240 * So this is really not to make the loader 241 * more generic; it is here for debugging 242 * purposes. 243 */ 244 puts("Error: memory method claim() failed, halting.\n"); 245 halt(); 246 } 247 } else { 248 shift = 0; 249 /* 250 * FIXME: the number of arguments is probably different... 251 */ 252 puts("Error: 32-bit ofw_claim_phys not implemented.\n"); 253 halt(); 254 } 255 256 return (void *) ((retaddr[0] << shift) | retaddr[1]); 217 257 } 218 258 … … 231 271 232 272 return ofw_call("call-method", 7, 1, NULL, "map", ofw_mmu, mode, size, virt, 233 273 phys_hi, phys_lo); 234 274 } 235 275 … … 253 293 map->total = 0; 254 294 map->count = 0; 255 for (pos = 0; (pos < ret / sizeof(uint32_t)) && (map->count <256 295 for (pos = 0; (pos < ret / sizeof(uint32_t)) && 296 (map->count < MEMMAP_MAX_RECORDS); pos += ac + sc) { 257 297 void * start = (void *) ((uintptr_t) buf[pos + ac - 1]); 258 298 unsigned int size = buf[pos + ac + sc - 1];
Note:
See TracChangeset
for help on using the changeset viewer.