Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: Remove RELOC() macro

Now we relocate prom_init.c on 64bit we can finally remove the
nasty RELOC() macro.

Finally a patch that I can claim has a net positive effect on
the kernel. It doesn't happen very often.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Anton Blanchard and committed by
Benjamin Herrenschmidt
5827d416 5ac47f7a

+267 -291
+267 -291
arch/powerpc/kernel/prom_init.c
··· 79 79 * On ppc64, 64 bit values are truncated to 32 bits (and 80 80 * fortunately don't get interpreted as two arguments). 81 81 */ 82 - #define RELOC(x) (x) 83 82 #define ADDR(x) (u32)(unsigned long)(x) 84 83 85 84 #ifdef CONFIG_PPC64 ··· 93 94 94 95 #define PROM_BUG() do { \ 95 96 prom_printf("kernel BUG at %s line 0x%x!\n", \ 96 - RELOC(__FILE__), __LINE__); \ 97 + __FILE__, __LINE__); \ 97 98 __asm__ __volatile__(".long " BUG_ILLEGAL_INSTR); \ 98 99 } while (0) 99 100 ··· 231 232 for (i = 0; i < nret; i++) 232 233 args.args[nargs+i] = 0; 233 234 234 - if (enter_prom(&args, RELOC(prom_entry)) < 0) 235 + if (enter_prom(&args, prom_entry) < 0) 235 236 return PROM_ERROR; 236 237 237 238 return (nret > 0) ? args.args[nargs] : 0; ··· 256 257 for (i = 0; i < nret; i++) 257 258 args.args[nargs+i] = 0; 258 259 259 - if (enter_prom(&args, RELOC(prom_entry)) < 0) 260 + if (enter_prom(&args, prom_entry) < 0) 260 261 return PROM_ERROR; 261 262 262 263 if (rets != NULL) ··· 270 271 static void __init prom_print(const char *msg) 271 272 { 272 273 const char *p, *q; 273 - struct prom_t *_prom = &RELOC(prom); 274 274 275 - if (_prom->stdout == 0) 275 + if (prom.stdout == 0) 276 276 return; 277 277 278 278 for (p = msg; *p != 0; p = q) { 279 279 for (q = p; *q != 0 && *q != '\n'; ++q) 280 280 ; 281 281 if (q > p) 282 - call_prom("write", 3, 1, _prom->stdout, p, q - p); 282 + call_prom("write", 3, 1, prom.stdout, p, q - p); 283 283 if (*q == 0) 284 284 break; 285 285 ++q; 286 - call_prom("write", 3, 1, _prom->stdout, ADDR("\r\n"), 2); 286 + call_prom("write", 3, 1, prom.stdout, ADDR("\r\n"), 2); 287 287 } 288 288 } 289 289 ··· 291 293 { 292 294 int i, nibbles = sizeof(val)*2; 293 295 char buf[sizeof(val)*2+1]; 294 - struct prom_t *_prom = &RELOC(prom); 295 296 296 297 for (i = nibbles-1; i >= 0; i--) { 297 298 buf[i] = (val & 0xf) + '0'; ··· 299 302 val >>= 4; 300 303 } 301 304 buf[nibbles] = '\0'; 302 - call_prom("write", 3, 1, _prom->stdout, buf, nibbles); 305 + call_prom("write", 3, 1, prom.stdout, buf, nibbles); 303 306 } 304 307 305 308 /* max number of decimal digits in an unsigned long */ ··· 308 311 { 309 312 int i, size; 310 313 char buf[UL_DIGITS+1]; 311 - struct prom_t *_prom = &RELOC(prom); 312 314 313 315 for (i = UL_DIGITS-1; i >= 0; i--) { 314 316 buf[i] = (val % 10) + '0'; ··· 317 321 } 318 322 /* shift stuff down */ 319 323 size = UL_DIGITS - i; 320 - call_prom("write", 3, 1, _prom->stdout, buf+i, size); 324 + call_prom("write", 3, 1, prom.stdout, buf+i, size); 321 325 } 322 326 323 327 static void __init prom_printf(const char *format, ...) ··· 326 330 va_list args; 327 331 unsigned long v; 328 332 long vs; 329 - struct prom_t *_prom = &RELOC(prom); 330 333 331 334 va_start(args, format); 332 335 for (p = format; *p != 0; p = q) { 333 336 for (q = p; *q != 0 && *q != '\n' && *q != '%'; ++q) 334 337 ; 335 338 if (q > p) 336 - call_prom("write", 3, 1, _prom->stdout, p, q - p); 339 + call_prom("write", 3, 1, prom.stdout, p, q - p); 337 340 if (*q == 0) 338 341 break; 339 342 if (*q == '\n') { 340 343 ++q; 341 - call_prom("write", 3, 1, _prom->stdout, 344 + call_prom("write", 3, 1, prom.stdout, 342 345 ADDR("\r\n"), 2); 343 346 continue; 344 347 } ··· 359 364 ++q; 360 365 vs = va_arg(args, int); 361 366 if (vs < 0) { 362 - prom_print(RELOC("-")); 367 + prom_print("-"); 363 368 vs = -vs; 364 369 } 365 370 prom_print_dec(vs); ··· 380 385 ++q; 381 386 vs = va_arg(args, long); 382 387 if (vs < 0) { 383 - prom_print(RELOC("-")); 388 + prom_print("-"); 384 389 vs = -vs; 385 390 } 386 391 prom_print_dec(vs); ··· 394 399 static unsigned int __init prom_claim(unsigned long virt, unsigned long size, 395 400 unsigned long align) 396 401 { 397 - struct prom_t *_prom = &RELOC(prom); 398 402 399 403 if (align == 0 && (OF_WORKAROUNDS & OF_WA_CLAIM)) { 400 404 /* ··· 404 410 prom_arg_t result; 405 411 406 412 ret = call_prom_ret("call-method", 5, 2, &result, 407 - ADDR("claim"), _prom->memory, 413 + ADDR("claim"), prom.memory, 408 414 align, size, virt); 409 415 if (ret != 0 || result == -1) 410 416 return -1; 411 417 ret = call_prom_ret("call-method", 5, 2, &result, 412 - ADDR("claim"), _prom->mmumap, 418 + ADDR("claim"), prom.mmumap, 413 419 align, size, virt); 414 420 if (ret != 0) { 415 421 call_prom("call-method", 4, 1, ADDR("release"), 416 - _prom->memory, size, virt); 422 + prom.memory, size, virt); 417 423 return -1; 418 424 } 419 425 /* the 0x12 is M (coherence) + PP == read/write */ 420 426 call_prom("call-method", 6, 1, 421 - ADDR("map"), _prom->mmumap, 0x12, size, virt, virt); 427 + ADDR("map"), prom.mmumap, 0x12, size, virt, virt); 422 428 return virt; 423 429 } 424 430 return call_prom("claim", 3, 1, (prom_arg_t)virt, (prom_arg_t)size, ··· 430 436 prom_print(reason); 431 437 /* Do not call exit because it clears the screen on pmac 432 438 * it also causes some sort of double-fault on early pmacs */ 433 - if (RELOC(of_platform) == PLATFORM_POWERMAC) 439 + if (of_platform == PLATFORM_POWERMAC) 434 440 asm("trap\n"); 435 441 436 442 /* ToDo: should put up an SRC here on pSeries */ ··· 512 518 add_string(&p, tohex((u32)(unsigned long) value)); 513 519 add_string(&p, tohex(valuelen)); 514 520 add_string(&p, tohex(ADDR(pname))); 515 - add_string(&p, tohex(strlen(RELOC(pname)))); 521 + add_string(&p, tohex(strlen(pname))); 516 522 add_string(&p, "property"); 517 523 *p = 0; 518 524 return call_prom("interpret", 1, 1, (u32)(unsigned long) cmd); 519 525 } 520 526 521 - /* We can't use the standard versions because of RELOC headaches. */ 527 + /* We can't use the standard versions because of relocation headaches. */ 522 528 #define isxdigit(c) (('0' <= (c) && (c) <= '9') \ 523 529 || ('a' <= (c) && (c) <= 'f') \ 524 530 || ('A' <= (c) && (c) <= 'F')) ··· 585 591 */ 586 592 static void __init early_cmdline_parse(void) 587 593 { 588 - struct prom_t *_prom = &RELOC(prom); 589 594 const char *opt; 590 595 591 596 char *p; 592 597 int l = 0; 593 598 594 - RELOC(prom_cmd_line[0]) = 0; 595 - p = RELOC(prom_cmd_line); 596 - if ((long)_prom->chosen > 0) 597 - l = prom_getprop(_prom->chosen, "bootargs", p, COMMAND_LINE_SIZE-1); 599 + prom_cmd_line[0] = 0; 600 + p = prom_cmd_line; 601 + if ((long)prom.chosen > 0) 602 + l = prom_getprop(prom.chosen, "bootargs", p, COMMAND_LINE_SIZE-1); 598 603 #ifdef CONFIG_CMDLINE 599 604 if (l <= 0 || p[0] == '\0') /* dbl check */ 600 - strlcpy(RELOC(prom_cmd_line), 601 - RELOC(CONFIG_CMDLINE), sizeof(prom_cmd_line)); 605 + strlcpy(prom_cmd_line, 606 + CONFIG_CMDLINE, sizeof(prom_cmd_line)); 602 607 #endif /* CONFIG_CMDLINE */ 603 - prom_printf("command line: %s\n", RELOC(prom_cmd_line)); 608 + prom_printf("command line: %s\n", prom_cmd_line); 604 609 605 610 #ifdef CONFIG_PPC64 606 - opt = strstr(RELOC(prom_cmd_line), RELOC("iommu=")); 611 + opt = strstr(prom_cmd_line, "iommu="); 607 612 if (opt) { 608 613 prom_printf("iommu opt is: %s\n", opt); 609 614 opt += 6; 610 615 while (*opt && *opt == ' ') 611 616 opt++; 612 - if (!strncmp(opt, RELOC("off"), 3)) 613 - RELOC(prom_iommu_off) = 1; 614 - else if (!strncmp(opt, RELOC("force"), 5)) 615 - RELOC(prom_iommu_force_on) = 1; 617 + if (!strncmp(opt, "off", 3)) 618 + prom_iommu_off = 1; 619 + else if (!strncmp(opt, "force", 5)) 620 + prom_iommu_force_on = 1; 616 621 } 617 622 #endif 618 - opt = strstr(RELOC(prom_cmd_line), RELOC("mem=")); 623 + opt = strstr(prom_cmd_line, "mem="); 619 624 if (opt) { 620 625 opt += 4; 621 - RELOC(prom_memory_limit) = prom_memparse(opt, (const char **)&opt); 626 + prom_memory_limit = prom_memparse(opt, (const char **)&opt); 622 627 #ifdef CONFIG_PPC64 623 628 /* Align to 16 MB == size of ppc64 large page */ 624 - RELOC(prom_memory_limit) = ALIGN(RELOC(prom_memory_limit), 0x1000000); 629 + prom_memory_limit = ALIGN(prom_memory_limit, 0x1000000); 625 630 #endif 626 631 } 627 632 } ··· 873 880 type[0] = 0; 874 881 prom_getprop(node, "device_type", type, sizeof(type)); 875 882 876 - if (strcmp(type, RELOC("cpu"))) 883 + if (strcmp(type, "cpu")) 877 884 continue; 878 885 /* 879 886 * There is an entry for each smt thread, each entry being ··· 991 998 */ 992 999 static unsigned long __init alloc_up(unsigned long size, unsigned long align) 993 1000 { 994 - unsigned long base = RELOC(alloc_bottom); 1001 + unsigned long base = alloc_bottom; 995 1002 unsigned long addr = 0; 996 1003 997 1004 if (align) 998 1005 base = _ALIGN_UP(base, align); 999 1006 prom_debug("alloc_up(%x, %x)\n", size, align); 1000 - if (RELOC(ram_top) == 0) 1007 + if (ram_top == 0) 1001 1008 prom_panic("alloc_up() called with mem not initialized\n"); 1002 1009 1003 1010 if (align) 1004 - base = _ALIGN_UP(RELOC(alloc_bottom), align); 1011 + base = _ALIGN_UP(alloc_bottom, align); 1005 1012 else 1006 - base = RELOC(alloc_bottom); 1013 + base = alloc_bottom; 1007 1014 1008 - for(; (base + size) <= RELOC(alloc_top); 1015 + for(; (base + size) <= alloc_top; 1009 1016 base = _ALIGN_UP(base + 0x100000, align)) { 1010 1017 prom_debug(" trying: 0x%x\n\r", base); 1011 1018 addr = (unsigned long)prom_claim(base, size, 0); ··· 1017 1024 } 1018 1025 if (addr == 0) 1019 1026 return 0; 1020 - RELOC(alloc_bottom) = addr + size; 1027 + alloc_bottom = addr + size; 1021 1028 1022 1029 prom_debug(" -> %x\n", addr); 1023 - prom_debug(" alloc_bottom : %x\n", RELOC(alloc_bottom)); 1024 - prom_debug(" alloc_top : %x\n", RELOC(alloc_top)); 1025 - prom_debug(" alloc_top_hi : %x\n", RELOC(alloc_top_high)); 1026 - prom_debug(" rmo_top : %x\n", RELOC(rmo_top)); 1027 - prom_debug(" ram_top : %x\n", RELOC(ram_top)); 1030 + prom_debug(" alloc_bottom : %x\n", alloc_bottom); 1031 + prom_debug(" alloc_top : %x\n", alloc_top); 1032 + prom_debug(" alloc_top_hi : %x\n", alloc_top_high); 1033 + prom_debug(" rmo_top : %x\n", rmo_top); 1034 + prom_debug(" ram_top : %x\n", ram_top); 1028 1035 1029 1036 return addr; 1030 1037 } ··· 1040 1047 unsigned long base, addr = 0; 1041 1048 1042 1049 prom_debug("alloc_down(%x, %x, %s)\n", size, align, 1043 - highmem ? RELOC("(high)") : RELOC("(low)")); 1044 - if (RELOC(ram_top) == 0) 1050 + highmem ? "(high)" : "(low)"); 1051 + if (ram_top == 0) 1045 1052 prom_panic("alloc_down() called with mem not initialized\n"); 1046 1053 1047 1054 if (highmem) { 1048 1055 /* Carve out storage for the TCE table. */ 1049 - addr = _ALIGN_DOWN(RELOC(alloc_top_high) - size, align); 1050 - if (addr <= RELOC(alloc_bottom)) 1056 + addr = _ALIGN_DOWN(alloc_top_high - size, align); 1057 + if (addr <= alloc_bottom) 1051 1058 return 0; 1052 1059 /* Will we bump into the RMO ? If yes, check out that we 1053 1060 * didn't overlap existing allocations there, if we did, 1054 1061 * we are dead, we must be the first in town ! 1055 1062 */ 1056 - if (addr < RELOC(rmo_top)) { 1063 + if (addr < rmo_top) { 1057 1064 /* Good, we are first */ 1058 - if (RELOC(alloc_top) == RELOC(rmo_top)) 1059 - RELOC(alloc_top) = RELOC(rmo_top) = addr; 1065 + if (alloc_top == rmo_top) 1066 + alloc_top = rmo_top = addr; 1060 1067 else 1061 1068 return 0; 1062 1069 } 1063 - RELOC(alloc_top_high) = addr; 1070 + alloc_top_high = addr; 1064 1071 goto bail; 1065 1072 } 1066 1073 1067 - base = _ALIGN_DOWN(RELOC(alloc_top) - size, align); 1068 - for (; base > RELOC(alloc_bottom); 1074 + base = _ALIGN_DOWN(alloc_top - size, align); 1075 + for (; base > alloc_bottom; 1069 1076 base = _ALIGN_DOWN(base - 0x100000, align)) { 1070 1077 prom_debug(" trying: 0x%x\n\r", base); 1071 1078 addr = (unsigned long)prom_claim(base, size, 0); ··· 1075 1082 } 1076 1083 if (addr == 0) 1077 1084 return 0; 1078 - RELOC(alloc_top) = addr; 1085 + alloc_top = addr; 1079 1086 1080 1087 bail: 1081 1088 prom_debug(" -> %x\n", addr); 1082 - prom_debug(" alloc_bottom : %x\n", RELOC(alloc_bottom)); 1083 - prom_debug(" alloc_top : %x\n", RELOC(alloc_top)); 1084 - prom_debug(" alloc_top_hi : %x\n", RELOC(alloc_top_high)); 1085 - prom_debug(" rmo_top : %x\n", RELOC(rmo_top)); 1086 - prom_debug(" ram_top : %x\n", RELOC(ram_top)); 1089 + prom_debug(" alloc_bottom : %x\n", alloc_bottom); 1090 + prom_debug(" alloc_top : %x\n", alloc_top); 1091 + prom_debug(" alloc_top_hi : %x\n", alloc_top_high); 1092 + prom_debug(" rmo_top : %x\n", rmo_top); 1093 + prom_debug(" ram_top : %x\n", ram_top); 1087 1094 1088 1095 return addr; 1089 1096 } ··· 1123 1130 static void __init reserve_mem(u64 base, u64 size) 1124 1131 { 1125 1132 u64 top = base + size; 1126 - unsigned long cnt = RELOC(mem_reserve_cnt); 1133 + unsigned long cnt = mem_reserve_cnt; 1127 1134 1128 1135 if (size == 0) 1129 1136 return; ··· 1138 1145 1139 1146 if (cnt >= (MEM_RESERVE_MAP_SIZE - 1)) 1140 1147 prom_panic("Memory reserve map exhausted !\n"); 1141 - RELOC(mem_reserve_map)[cnt].base = base; 1142 - RELOC(mem_reserve_map)[cnt].size = size; 1143 - RELOC(mem_reserve_cnt) = cnt + 1; 1148 + mem_reserve_map[cnt].base = base; 1149 + mem_reserve_map[cnt].size = size; 1150 + mem_reserve_cnt = cnt + 1; 1144 1151 } 1145 1152 1146 1153 /* ··· 1153 1160 char *path, type[64]; 1154 1161 unsigned int plen; 1155 1162 cell_t *p, *endp; 1156 - struct prom_t *_prom = &RELOC(prom); 1157 1163 u32 rac, rsc; 1158 1164 1159 1165 /* ··· 1161 1169 * 2) top of memory 1162 1170 */ 1163 1171 rac = 2; 1164 - prom_getprop(_prom->root, "#address-cells", &rac, sizeof(rac)); 1172 + prom_getprop(prom.root, "#address-cells", &rac, sizeof(rac)); 1165 1173 rsc = 1; 1166 - prom_getprop(_prom->root, "#size-cells", &rsc, sizeof(rsc)); 1174 + prom_getprop(prom.root, "#size-cells", &rsc, sizeof(rsc)); 1167 1175 prom_debug("root_addr_cells: %x\n", (unsigned long) rac); 1168 1176 prom_debug("root_size_cells: %x\n", (unsigned long) rsc); 1169 1177 1170 1178 prom_debug("scanning memory:\n"); 1171 - path = RELOC(prom_scratch); 1179 + path = prom_scratch; 1172 1180 1173 1181 for (node = 0; prom_next_node(&node); ) { 1174 1182 type[0] = 0; ··· 1181 1189 */ 1182 1190 prom_getprop(node, "name", type, sizeof(type)); 1183 1191 } 1184 - if (strcmp(type, RELOC("memory"))) 1192 + if (strcmp(type, "memory")) 1185 1193 continue; 1186 1194 1187 - plen = prom_getprop(node, "reg", RELOC(regbuf), sizeof(regbuf)); 1195 + plen = prom_getprop(node, "reg", regbuf, sizeof(regbuf)); 1188 1196 if (plen > sizeof(regbuf)) { 1189 1197 prom_printf("memory node too large for buffer !\n"); 1190 1198 plen = sizeof(regbuf); 1191 1199 } 1192 - p = RELOC(regbuf); 1200 + p = regbuf; 1193 1201 endp = p + (plen / sizeof(cell_t)); 1194 1202 1195 1203 #ifdef DEBUG_PROM ··· 1207 1215 if (size == 0) 1208 1216 continue; 1209 1217 prom_debug(" %x %x\n", base, size); 1210 - if (base == 0 && (RELOC(of_platform) & PLATFORM_LPAR)) 1211 - RELOC(rmo_top) = size; 1212 - if ((base + size) > RELOC(ram_top)) 1213 - RELOC(ram_top) = base + size; 1218 + if (base == 0 && (of_platform & PLATFORM_LPAR)) 1219 + rmo_top = size; 1220 + if ((base + size) > ram_top) 1221 + ram_top = base + size; 1214 1222 } 1215 1223 } 1216 1224 1217 - RELOC(alloc_bottom) = PAGE_ALIGN((unsigned long)&RELOC(_end) + 0x4000); 1225 + alloc_bottom = PAGE_ALIGN((unsigned long)&_end + 0x4000); 1218 1226 1219 1227 /* 1220 1228 * If prom_memory_limit is set we reduce the upper limits *except* for ··· 1222 1230 * TCE's up there. 1223 1231 */ 1224 1232 1225 - RELOC(alloc_top_high) = RELOC(ram_top); 1233 + alloc_top_high = ram_top; 1226 1234 1227 - if (RELOC(prom_memory_limit)) { 1228 - if (RELOC(prom_memory_limit) <= RELOC(alloc_bottom)) { 1235 + if (prom_memory_limit) { 1236 + if (prom_memory_limit <= alloc_bottom) { 1229 1237 prom_printf("Ignoring mem=%x <= alloc_bottom.\n", 1230 - RELOC(prom_memory_limit)); 1231 - RELOC(prom_memory_limit) = 0; 1232 - } else if (RELOC(prom_memory_limit) >= RELOC(ram_top)) { 1238 + prom_memory_limit); 1239 + prom_memory_limit = 0; 1240 + } else if (prom_memory_limit >= ram_top) { 1233 1241 prom_printf("Ignoring mem=%x >= ram_top.\n", 1234 - RELOC(prom_memory_limit)); 1235 - RELOC(prom_memory_limit) = 0; 1242 + prom_memory_limit); 1243 + prom_memory_limit = 0; 1236 1244 } else { 1237 - RELOC(ram_top) = RELOC(prom_memory_limit); 1238 - RELOC(rmo_top) = min(RELOC(rmo_top), RELOC(prom_memory_limit)); 1245 + ram_top = prom_memory_limit; 1246 + rmo_top = min(rmo_top, prom_memory_limit); 1239 1247 } 1240 1248 } 1241 1249 ··· 1247 1255 * Since 768MB is plenty of room, and we need to cap to something 1248 1256 * reasonable on 32-bit, cap at 768MB on all machines. 1249 1257 */ 1250 - if (!RELOC(rmo_top)) 1251 - RELOC(rmo_top) = RELOC(ram_top); 1252 - RELOC(rmo_top) = min(0x30000000ul, RELOC(rmo_top)); 1253 - RELOC(alloc_top) = RELOC(rmo_top); 1254 - RELOC(alloc_top_high) = RELOC(ram_top); 1258 + if (!rmo_top) 1259 + rmo_top = ram_top; 1260 + rmo_top = min(0x30000000ul, rmo_top); 1261 + alloc_top = rmo_top; 1262 + alloc_top_high = ram_top; 1255 1263 1256 1264 /* 1257 1265 * Check if we have an initrd after the kernel but still inside 1258 1266 * the RMO. If we do move our bottom point to after it. 1259 1267 */ 1260 - if (RELOC(prom_initrd_start) && 1261 - RELOC(prom_initrd_start) < RELOC(rmo_top) && 1262 - RELOC(prom_initrd_end) > RELOC(alloc_bottom)) 1263 - RELOC(alloc_bottom) = PAGE_ALIGN(RELOC(prom_initrd_end)); 1268 + if (prom_initrd_start && 1269 + prom_initrd_start < rmo_top && 1270 + prom_initrd_end > alloc_bottom) 1271 + alloc_bottom = PAGE_ALIGN(prom_initrd_end); 1264 1272 1265 1273 prom_printf("memory layout at init:\n"); 1266 - prom_printf(" memory_limit : %x (16 MB aligned)\n", RELOC(prom_memory_limit)); 1267 - prom_printf(" alloc_bottom : %x\n", RELOC(alloc_bottom)); 1268 - prom_printf(" alloc_top : %x\n", RELOC(alloc_top)); 1269 - prom_printf(" alloc_top_hi : %x\n", RELOC(alloc_top_high)); 1270 - prom_printf(" rmo_top : %x\n", RELOC(rmo_top)); 1271 - prom_printf(" ram_top : %x\n", RELOC(ram_top)); 1274 + prom_printf(" memory_limit : %x (16 MB aligned)\n", prom_memory_limit); 1275 + prom_printf(" alloc_bottom : %x\n", alloc_bottom); 1276 + prom_printf(" alloc_top : %x\n", alloc_top); 1277 + prom_printf(" alloc_top_hi : %x\n", alloc_top_high); 1278 + prom_printf(" rmo_top : %x\n", rmo_top); 1279 + prom_printf(" ram_top : %x\n", ram_top); 1272 1280 } 1273 1281 1274 1282 static void __init prom_close_stdin(void) 1275 1283 { 1276 - struct prom_t *_prom = &RELOC(prom); 1277 1284 ihandle val; 1278 1285 1279 - if (prom_getprop(_prom->chosen, "stdin", &val, sizeof(val)) > 0) 1286 + if (prom_getprop(prom.chosen, "stdin", &val, sizeof(val)) > 0) 1280 1287 call_prom("close", 1, 0, val); 1281 1288 } 1282 1289 ··· 1316 1325 } 1317 1326 1318 1327 prom_printf("Querying for OPAL presence... "); 1319 - rc = opal_query_takeover(&RELOC(prom_opal_size), 1320 - &RELOC(prom_opal_align)); 1328 + rc = opal_query_takeover(&prom_opal_size, 1329 + &prom_opal_align); 1321 1330 prom_debug("(rc = %ld) ", rc); 1322 1331 if (rc != 0) { 1323 1332 prom_printf("not there.\n"); 1324 1333 return; 1325 1334 } 1326 - RELOC(of_platform) = PLATFORM_OPAL; 1335 + of_platform = PLATFORM_OPAL; 1327 1336 prom_printf(" there !\n"); 1328 - prom_debug(" opal_size = 0x%lx\n", RELOC(prom_opal_size)); 1329 - prom_debug(" opal_align = 0x%lx\n", RELOC(prom_opal_align)); 1330 - if (RELOC(prom_opal_align) < 0x10000) 1331 - RELOC(prom_opal_align) = 0x10000; 1337 + prom_debug(" opal_size = 0x%lx\n", prom_opal_size); 1338 + prom_debug(" opal_align = 0x%lx\n", prom_opal_align); 1339 + if (prom_opal_align < 0x10000) 1340 + prom_opal_align = 0x10000; 1332 1341 } 1333 1342 1334 1343 static int prom_rtas_call(int token, int nargs, int nret, int *outputs, ...) ··· 1349 1358 for (i = 0; i < nret; ++i) 1350 1359 rtas_args.rets[i] = 0; 1351 1360 1352 - opal_enter_rtas(&rtas_args, RELOC(prom_rtas_data), 1353 - RELOC(prom_rtas_entry)); 1361 + opal_enter_rtas(&rtas_args, prom_rtas_data, 1362 + prom_rtas_entry); 1354 1363 1355 1364 if (nret > 1 && outputs != NULL) 1356 1365 for (i = 0; i < nret-1; ++i) ··· 1365 1374 phandle node; 1366 1375 char type[64]; 1367 1376 u32 servers[8]; 1368 - struct prom_t *_prom = &RELOC(prom); 1369 - void *entry = (unsigned long *)&RELOC(opal_secondary_entry); 1370 - struct opal_secondary_data *data = &RELOC(opal_secondary_data); 1377 + void *entry = (unsigned long *)&opal_secondary_entry; 1378 + struct opal_secondary_data *data = &opal_secondary_data; 1371 1379 1372 1380 prom_debug("prom_opal_hold_cpus: start...\n"); 1373 1381 prom_debug(" - entry = 0x%x\n", entry); ··· 1379 1389 for (node = 0; prom_next_node(&node); ) { 1380 1390 type[0] = 0; 1381 1391 prom_getprop(node, "device_type", type, sizeof(type)); 1382 - if (strcmp(type, RELOC("cpu")) != 0) 1392 + if (strcmp(type, "cpu") != 0) 1383 1393 continue; 1384 1394 1385 1395 /* Skip non-configured cpus. */ 1386 1396 if (prom_getprop(node, "status", type, sizeof(type)) > 0) 1387 - if (strcmp(type, RELOC("okay")) != 0) 1397 + if (strcmp(type, "okay") != 0) 1388 1398 continue; 1389 1399 1390 1400 cnt = prom_getprop(node, "ibm,ppc-interrupt-server#s", servers, ··· 1395 1405 for (i = 0; i < cnt; i++) { 1396 1406 cpu = servers[i]; 1397 1407 prom_debug("CPU %d ... ", cpu); 1398 - if (cpu == _prom->cpu) { 1408 + if (cpu == prom.cpu) { 1399 1409 prom_debug("booted !\n"); 1400 1410 continue; 1401 1411 } ··· 1406 1416 * spinloop. 1407 1417 */ 1408 1418 data->ack = -1; 1409 - rc = prom_rtas_call(RELOC(prom_rtas_start_cpu), 3, 1, 1419 + rc = prom_rtas_call(prom_rtas_start_cpu, 3, 1, 1410 1420 NULL, cpu, entry, data); 1411 1421 prom_debug("rtas rc=%d ...", rc); 1412 1422 ··· 1426 1436 1427 1437 static void __init prom_opal_takeover(void) 1428 1438 { 1429 - struct opal_secondary_data *data = &RELOC(opal_secondary_data); 1439 + struct opal_secondary_data *data = &opal_secondary_data; 1430 1440 struct opal_takeover_args *args = &data->args; 1431 - u64 align = RELOC(prom_opal_align); 1441 + u64 align = prom_opal_align; 1432 1442 u64 top_addr, opal_addr; 1433 1443 1434 - args->k_image = (u64)RELOC(_stext); 1444 + args->k_image = (u64)_stext; 1435 1445 args->k_size = _end - _stext; 1436 1446 args->k_entry = 0; 1437 1447 args->k_entry2 = 0x60; 1438 1448 1439 1449 top_addr = _ALIGN_UP(args->k_size, align); 1440 1450 1441 - if (RELOC(prom_initrd_start) != 0) { 1442 - args->rd_image = RELOC(prom_initrd_start); 1443 - args->rd_size = RELOC(prom_initrd_end) - args->rd_image; 1451 + if (prom_initrd_start != 0) { 1452 + args->rd_image = prom_initrd_start; 1453 + args->rd_size = prom_initrd_end - args->rd_image; 1444 1454 args->rd_loc = top_addr; 1445 1455 top_addr = _ALIGN_UP(args->rd_loc + args->rd_size, align); 1446 1456 } ··· 1452 1462 * has plenty of memory, and we ask for the HAL for now to 1453 1463 * be just below the 1G point, or above the initrd 1454 1464 */ 1455 - opal_addr = _ALIGN_DOWN(0x40000000 - RELOC(prom_opal_size), align); 1465 + opal_addr = _ALIGN_DOWN(0x40000000 - prom_opal_size, align); 1456 1466 if (opal_addr < top_addr) 1457 1467 opal_addr = top_addr; 1458 1468 args->hal_addr = opal_addr; 1459 1469 1460 1470 /* Copy the command line to the kernel image */ 1461 - strlcpy(RELOC(boot_command_line), RELOC(prom_cmd_line), 1471 + strlcpy(boot_command_line, prom_cmd_line, 1462 1472 COMMAND_LINE_SIZE); 1463 1473 1464 1474 prom_debug(" k_image = 0x%lx\n", args->k_image); ··· 1540 1550 &entry, sizeof(entry)); 1541 1551 1542 1552 #ifdef CONFIG_PPC_EARLY_DEBUG_OPAL 1543 - RELOC(prom_opal_base) = base; 1544 - RELOC(prom_opal_entry) = entry; 1553 + prom_opal_base = base; 1554 + prom_opal_entry = entry; 1545 1555 #endif 1546 1556 prom_debug("prom_instantiate_opal: end...\n"); 1547 1557 } ··· 1599 1609 1600 1610 #ifdef CONFIG_PPC_POWERNV 1601 1611 /* PowerVN takeover hack */ 1602 - RELOC(prom_rtas_data) = base; 1603 - RELOC(prom_rtas_entry) = entry; 1604 - prom_getprop(rtas_node, "start-cpu", &RELOC(prom_rtas_start_cpu), 4); 1612 + prom_rtas_data = base; 1613 + prom_rtas_entry = entry; 1614 + prom_getprop(rtas_node, "start-cpu", &prom_rtas_start_cpu, 4); 1605 1615 #endif 1606 1616 prom_debug("rtas base = 0x%x\n", base); 1607 1617 prom_debug("rtas entry = 0x%x\n", entry); ··· 1676 1686 phandle node; 1677 1687 ihandle phb_node; 1678 1688 char compatible[64], type[64], model[64]; 1679 - char *path = RELOC(prom_scratch); 1689 + char *path = prom_scratch; 1680 1690 u64 base, align; 1681 1691 u32 minalign, minsize; 1682 1692 u64 tce_entry, *tce_entryp; 1683 1693 u64 local_alloc_top, local_alloc_bottom; 1684 1694 u64 i; 1685 1695 1686 - if (RELOC(prom_iommu_off)) 1696 + if (prom_iommu_off) 1687 1697 return; 1688 1698 1689 1699 prom_debug("starting prom_initialize_tce_table\n"); 1690 1700 1691 1701 /* Cache current top of allocs so we reserve a single block */ 1692 - local_alloc_top = RELOC(alloc_top_high); 1702 + local_alloc_top = alloc_top_high; 1693 1703 local_alloc_bottom = local_alloc_top; 1694 1704 1695 1705 /* Search all nodes looking for PHBs. */ ··· 1702 1712 prom_getprop(node, "device_type", type, sizeof(type)); 1703 1713 prom_getprop(node, "model", model, sizeof(model)); 1704 1714 1705 - if ((type[0] == 0) || (strstr(type, RELOC("pci")) == NULL)) 1715 + if ((type[0] == 0) || (strstr(type, "pci") == NULL)) 1706 1716 continue; 1707 1717 1708 1718 /* Keep the old logic intact to avoid regression. */ 1709 1719 if (compatible[0] != 0) { 1710 - if ((strstr(compatible, RELOC("python")) == NULL) && 1711 - (strstr(compatible, RELOC("Speedwagon")) == NULL) && 1712 - (strstr(compatible, RELOC("Winnipeg")) == NULL)) 1720 + if ((strstr(compatible, "python") == NULL) && 1721 + (strstr(compatible, "Speedwagon") == NULL) && 1722 + (strstr(compatible, "Winnipeg") == NULL)) 1713 1723 continue; 1714 1724 } else if (model[0] != 0) { 1715 - if ((strstr(model, RELOC("ython")) == NULL) && 1716 - (strstr(model, RELOC("peedwagon")) == NULL) && 1717 - (strstr(model, RELOC("innipeg")) == NULL)) 1725 + if ((strstr(model, "ython") == NULL) && 1726 + (strstr(model, "peedwagon") == NULL) && 1727 + (strstr(model, "innipeg") == NULL)) 1718 1728 continue; 1719 1729 } 1720 1730 ··· 1793 1803 1794 1804 /* These are only really needed if there is a memory limit in 1795 1805 * effect, but we don't know so export them always. */ 1796 - RELOC(prom_tce_alloc_start) = local_alloc_bottom; 1797 - RELOC(prom_tce_alloc_end) = local_alloc_top; 1806 + prom_tce_alloc_start = local_alloc_bottom; 1807 + prom_tce_alloc_end = local_alloc_top; 1798 1808 1799 1809 /* Flag the first invalid entry */ 1800 1810 prom_debug("ending prom_initialize_tce_table\n"); ··· 1831 1841 unsigned int reg; 1832 1842 phandle node; 1833 1843 char type[64]; 1834 - struct prom_t *_prom = &RELOC(prom); 1835 1844 unsigned long *spinloop 1836 1845 = (void *) LOW_ADDR(__secondary_hold_spinloop); 1837 1846 unsigned long *acknowledge ··· 1856 1867 for (node = 0; prom_next_node(&node); ) { 1857 1868 type[0] = 0; 1858 1869 prom_getprop(node, "device_type", type, sizeof(type)); 1859 - if (strcmp(type, RELOC("cpu")) != 0) 1870 + if (strcmp(type, "cpu") != 0) 1860 1871 continue; 1861 1872 1862 1873 /* Skip non-configured cpus. */ 1863 1874 if (prom_getprop(node, "status", type, sizeof(type)) > 0) 1864 - if (strcmp(type, RELOC("okay")) != 0) 1875 + if (strcmp(type, "okay") != 0) 1865 1876 continue; 1866 1877 1867 1878 reg = -1; ··· 1875 1886 */ 1876 1887 *acknowledge = (unsigned long)-1; 1877 1888 1878 - if (reg != _prom->cpu) { 1889 + if (reg != prom.cpu) { 1879 1890 /* Primary Thread of non-boot cpu or any thread */ 1880 1891 prom_printf("starting cpu hw idx %lu... ", reg); 1881 1892 call_prom("start-cpu", 3, 0, node, ··· 1902 1913 1903 1914 static void __init prom_init_client_services(unsigned long pp) 1904 1915 { 1905 - struct prom_t *_prom = &RELOC(prom); 1906 - 1907 1916 /* Get a handle to the prom entry point before anything else */ 1908 - RELOC(prom_entry) = pp; 1917 + prom_entry = pp; 1909 1918 1910 1919 /* get a handle for the stdout device */ 1911 - _prom->chosen = call_prom("finddevice", 1, 1, ADDR("/chosen")); 1912 - if (!PHANDLE_VALID(_prom->chosen)) 1920 + prom.chosen = call_prom("finddevice", 1, 1, ADDR("/chosen")); 1921 + if (!PHANDLE_VALID(prom.chosen)) 1913 1922 prom_panic("cannot find chosen"); /* msg won't be printed :( */ 1914 1923 1915 1924 /* get device tree root */ 1916 - _prom->root = call_prom("finddevice", 1, 1, ADDR("/")); 1917 - if (!PHANDLE_VALID(_prom->root)) 1925 + prom.root = call_prom("finddevice", 1, 1, ADDR("/")); 1926 + if (!PHANDLE_VALID(prom.root)) 1918 1927 prom_panic("cannot find device tree root"); /* msg won't be printed :( */ 1919 1928 1920 - _prom->mmumap = 0; 1929 + prom.mmumap = 0; 1921 1930 } 1922 1931 1923 1932 #ifdef CONFIG_PPC32 ··· 1926 1939 */ 1927 1940 static void __init prom_find_mmu(void) 1928 1941 { 1929 - struct prom_t *_prom = &RELOC(prom); 1930 1942 phandle oprom; 1931 1943 char version[64]; 1932 1944 ··· 1943 1957 call_prom("interpret", 1, 1, "dev /memory 0 to allow-reclaim"); 1944 1958 } else 1945 1959 return; 1946 - _prom->memory = call_prom("open", 1, 1, ADDR("/memory")); 1947 - prom_getprop(_prom->chosen, "mmu", &_prom->mmumap, 1948 - sizeof(_prom->mmumap)); 1949 - if (!IHANDLE_VALID(_prom->memory) || !IHANDLE_VALID(_prom->mmumap)) 1960 + prom.memory = call_prom("open", 1, 1, ADDR("/memory")); 1961 + prom_getprop(prom.chosen, "mmu", &prom.mmumap, 1962 + sizeof(prom.mmumap)); 1963 + if (!IHANDLE_VALID(prom.memory) || !IHANDLE_VALID(prom.mmumap)) 1950 1964 of_workarounds &= ~OF_WA_CLAIM; /* hmmm */ 1951 1965 } 1952 1966 #else ··· 1955 1969 1956 1970 static void __init prom_init_stdout(void) 1957 1971 { 1958 - struct prom_t *_prom = &RELOC(prom); 1959 - char *path = RELOC(of_stdout_device); 1972 + char *path = of_stdout_device; 1960 1973 char type[16]; 1961 1974 u32 val; 1962 1975 1963 - if (prom_getprop(_prom->chosen, "stdout", &val, sizeof(val)) <= 0) 1976 + if (prom_getprop(prom.chosen, "stdout", &val, sizeof(val)) <= 0) 1964 1977 prom_panic("cannot find stdout"); 1965 1978 1966 - _prom->stdout = val; 1979 + prom.stdout = val; 1967 1980 1968 1981 /* Get the full OF pathname of the stdout device */ 1969 1982 memset(path, 0, 256); 1970 - call_prom("instance-to-path", 3, 1, _prom->stdout, path, 255); 1971 - val = call_prom("instance-to-package", 1, 1, _prom->stdout); 1972 - prom_setprop(_prom->chosen, "/chosen", "linux,stdout-package", 1983 + call_prom("instance-to-path", 3, 1, prom.stdout, path, 255); 1984 + val = call_prom("instance-to-package", 1, 1, prom.stdout); 1985 + prom_setprop(prom.chosen, "/chosen", "linux,stdout-package", 1973 1986 &val, sizeof(val)); 1974 - prom_printf("OF stdout device is: %s\n", RELOC(of_stdout_device)); 1975 - prom_setprop(_prom->chosen, "/chosen", "linux,stdout-path", 1987 + prom_printf("OF stdout device is: %s\n", of_stdout_device); 1988 + prom_setprop(prom.chosen, "/chosen", "linux,stdout-path", 1976 1989 path, strlen(path) + 1); 1977 1990 1978 1991 /* If it's a display, note it */ 1979 1992 memset(type, 0, sizeof(type)); 1980 1993 prom_getprop(val, "device_type", type, sizeof(type)); 1981 - if (strcmp(type, RELOC("display")) == 0) 1994 + if (strcmp(type, "display") == 0) 1982 1995 prom_setprop(val, path, "linux,boot-display", NULL, 0); 1983 1996 } 1984 1997 1985 1998 static int __init prom_find_machine_type(void) 1986 1999 { 1987 - struct prom_t *_prom = &RELOC(prom); 1988 2000 char compat[256]; 1989 2001 int len, i = 0; 1990 2002 #ifdef CONFIG_PPC64 ··· 1991 2007 #endif 1992 2008 1993 2009 /* Look for a PowerMac or a Cell */ 1994 - len = prom_getprop(_prom->root, "compatible", 2010 + len = prom_getprop(prom.root, "compatible", 1995 2011 compat, sizeof(compat)-1); 1996 2012 if (len > 0) { 1997 2013 compat[len] = 0; ··· 2000 2016 int sl = strlen(p); 2001 2017 if (sl == 0) 2002 2018 break; 2003 - if (strstr(p, RELOC("Power Macintosh")) || 2004 - strstr(p, RELOC("MacRISC"))) 2019 + if (strstr(p, "Power Macintosh") || 2020 + strstr(p, "MacRISC")) 2005 2021 return PLATFORM_POWERMAC; 2006 2022 #ifdef CONFIG_PPC64 2007 2023 /* We must make sure we don't detect the IBM Cell 2008 2024 * blades as pSeries due to some firmware issues, 2009 2025 * so we do it here. 2010 2026 */ 2011 - if (strstr(p, RELOC("IBM,CBEA")) || 2012 - strstr(p, RELOC("IBM,CPBW-1.0"))) 2027 + if (strstr(p, "IBM,CBEA") || 2028 + strstr(p, "IBM,CPBW-1.0")) 2013 2029 return PLATFORM_GENERIC; 2014 2030 #endif /* CONFIG_PPC64 */ 2015 2031 i += sl + 1; ··· 2026 2042 * non-IBM designs ! 2027 2043 * - it has /rtas 2028 2044 */ 2029 - len = prom_getprop(_prom->root, "device_type", 2045 + len = prom_getprop(prom.root, "device_type", 2030 2046 compat, sizeof(compat)-1); 2031 2047 if (len <= 0) 2032 2048 return PLATFORM_GENERIC; 2033 - if (strcmp(compat, RELOC("chrp"))) 2049 + if (strcmp(compat, "chrp")) 2034 2050 return PLATFORM_GENERIC; 2035 2051 2036 2052 /* Default to pSeries. We need to know if we are running LPAR */ ··· 2092 2108 for (node = 0; prom_next_node(&node); ) { 2093 2109 memset(type, 0, sizeof(type)); 2094 2110 prom_getprop(node, "device_type", type, sizeof(type)); 2095 - if (strcmp(type, RELOC("display")) != 0) 2111 + if (strcmp(type, "display") != 0) 2096 2112 continue; 2097 2113 2098 2114 /* It seems OF doesn't null-terminate the path :-( */ 2099 - path = RELOC(prom_scratch); 2115 + path = prom_scratch; 2100 2116 memset(path, 0, PROM_SCRATCH_SIZE); 2101 2117 2102 2118 /* ··· 2120 2136 2121 2137 /* Setup a usable color table when the appropriate 2122 2138 * method is available. Should update this to set-colors */ 2123 - clut = RELOC(default_colors); 2139 + clut = default_colors; 2124 2140 for (i = 0; i < 16; i++, clut += 3) 2125 2141 if (prom_set_color(ih, i, clut[0], clut[1], 2126 2142 clut[2]) != 0) 2127 2143 break; 2128 2144 2129 2145 #ifdef CONFIG_LOGO_LINUX_CLUT224 2130 - clut = PTRRELOC(RELOC(logo_linux_clut224.clut)); 2131 - for (i = 0; i < RELOC(logo_linux_clut224.clutsize); i++, clut += 3) 2146 + clut = PTRRELOC(logo_linux_clut224.clut); 2147 + for (i = 0; i < logo_linux_clut224.clutsize; i++, clut += 3) 2132 2148 if (prom_set_color(ih, i + 32, clut[0], clut[1], 2133 2149 clut[2]) != 0) 2134 2150 break; ··· 2148 2164 unsigned long room, chunk; 2149 2165 2150 2166 prom_debug("Chunk exhausted, claiming more at %x...\n", 2151 - RELOC(alloc_bottom)); 2152 - room = RELOC(alloc_top) - RELOC(alloc_bottom); 2167 + alloc_bottom); 2168 + room = alloc_top - alloc_bottom; 2153 2169 if (room > DEVTREE_CHUNK_SIZE) 2154 2170 room = DEVTREE_CHUNK_SIZE; 2155 2171 if (room < PAGE_SIZE) ··· 2175 2191 { 2176 2192 char *s, *os; 2177 2193 2178 - s = os = (char *)RELOC(dt_string_start); 2194 + s = os = (char *)dt_string_start; 2179 2195 s += 4; 2180 - while (s < (char *)RELOC(dt_string_end)) { 2196 + while (s < (char *)dt_string_end) { 2181 2197 if (strcmp(s, str) == 0) 2182 2198 return s - os; 2183 2199 s += strlen(s) + 1; ··· 2199 2215 unsigned long soff; 2200 2216 phandle child; 2201 2217 2202 - sstart = (char *)RELOC(dt_string_start); 2218 + sstart = (char *)dt_string_start; 2203 2219 2204 2220 /* get and store all property names */ 2205 - prev_name = RELOC(""); 2221 + prev_name = ""; 2206 2222 for (;;) { 2207 2223 /* 64 is max len of name including nul. */ 2208 2224 namep = make_room(mem_start, mem_end, MAX_PROPERTY_NAME, 1); ··· 2213 2229 } 2214 2230 2215 2231 /* skip "name" */ 2216 - if (strcmp(namep, RELOC("name")) == 0) { 2232 + if (strcmp(namep, "name") == 0) { 2217 2233 *mem_start = (unsigned long)namep; 2218 - prev_name = RELOC("name"); 2234 + prev_name = "name"; 2219 2235 continue; 2220 2236 } 2221 2237 /* get/create string entry */ ··· 2226 2242 } else { 2227 2243 /* Trim off some if we can */ 2228 2244 *mem_start = (unsigned long)namep + strlen(namep) + 1; 2229 - RELOC(dt_string_end) = *mem_start; 2245 + dt_string_end = *mem_start; 2230 2246 } 2231 2247 prev_name = namep; 2232 2248 } ··· 2281 2297 } 2282 2298 2283 2299 /* get it again for debugging */ 2284 - path = RELOC(prom_scratch); 2300 + path = prom_scratch; 2285 2301 memset(path, 0, PROM_SCRATCH_SIZE); 2286 2302 call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-1); 2287 2303 2288 2304 /* get and store all properties */ 2289 - prev_name = RELOC(""); 2290 - sstart = (char *)RELOC(dt_string_start); 2305 + prev_name = ""; 2306 + sstart = (char *)dt_string_start; 2291 2307 for (;;) { 2292 2308 if (call_prom("nextprop", 3, 1, node, prev_name, 2293 - RELOC(pname)) != 1) 2309 + pname) != 1) 2294 2310 break; 2295 2311 2296 2312 /* skip "name" */ 2297 - if (strcmp(RELOC(pname), RELOC("name")) == 0) { 2298 - prev_name = RELOC("name"); 2313 + if (strcmp(pname, "name") == 0) { 2314 + prev_name = "name"; 2299 2315 continue; 2300 2316 } 2301 2317 2302 2318 /* find string offset */ 2303 - soff = dt_find_string(RELOC(pname)); 2319 + soff = dt_find_string(pname); 2304 2320 if (soff == 0) { 2305 2321 prom_printf("WARNING: Can't find string index for" 2306 - " <%s>, node %s\n", RELOC(pname), path); 2322 + " <%s>, node %s\n", pname, path); 2307 2323 break; 2308 2324 } 2309 2325 prev_name = sstart + soff; 2310 2326 2311 2327 /* get length */ 2312 - l = call_prom("getproplen", 2, 1, node, RELOC(pname)); 2328 + l = call_prom("getproplen", 2, 1, node, pname); 2313 2329 2314 2330 /* sanity checks */ 2315 2331 if (l == PROM_ERROR) ··· 2322 2338 2323 2339 /* push property content */ 2324 2340 valp = make_room(mem_start, mem_end, l, 4); 2325 - call_prom("getprop", 4, 1, node, RELOC(pname), valp, l); 2341 + call_prom("getprop", 4, 1, node, pname, valp, l); 2326 2342 *mem_start = _ALIGN(*mem_start, 4); 2327 2343 2328 - if (!strcmp(RELOC(pname), RELOC("phandle"))) 2344 + if (!strcmp(pname, "phandle")) 2329 2345 has_phandle = 1; 2330 2346 } 2331 2347 ··· 2333 2349 * existed (can happen with OPAL) 2334 2350 */ 2335 2351 if (!has_phandle) { 2336 - soff = dt_find_string(RELOC("linux,phandle")); 2352 + soff = dt_find_string("linux,phandle"); 2337 2353 if (soff == 0) 2338 2354 prom_printf("WARNING: Can't find string index for" 2339 2355 " <linux-phandle> node %s\n", path); ··· 2361 2377 phandle root; 2362 2378 unsigned long mem_start, mem_end, room; 2363 2379 struct boot_param_header *hdr; 2364 - struct prom_t *_prom = &RELOC(prom); 2365 2380 char *namep; 2366 2381 u64 *rsvmap; 2367 2382 ··· 2368 2385 * Check how much room we have between alloc top & bottom (+/- a 2369 2386 * few pages), crop to 1MB, as this is our "chunk" size 2370 2387 */ 2371 - room = RELOC(alloc_top) - RELOC(alloc_bottom) - 0x4000; 2388 + room = alloc_top - alloc_bottom - 0x4000; 2372 2389 if (room > DEVTREE_CHUNK_SIZE) 2373 2390 room = DEVTREE_CHUNK_SIZE; 2374 - prom_debug("starting device tree allocs at %x\n", RELOC(alloc_bottom)); 2391 + prom_debug("starting device tree allocs at %x\n", alloc_bottom); 2375 2392 2376 2393 /* Now try to claim that */ 2377 2394 mem_start = (unsigned long)alloc_up(room, PAGE_SIZE); ··· 2388 2405 mem_start = _ALIGN(mem_start, 4); 2389 2406 hdr = make_room(&mem_start, &mem_end, 2390 2407 sizeof(struct boot_param_header), 4); 2391 - RELOC(dt_header_start) = (unsigned long)hdr; 2408 + dt_header_start = (unsigned long)hdr; 2392 2409 rsvmap = make_room(&mem_start, &mem_end, sizeof(mem_reserve_map), 8); 2393 2410 2394 2411 /* Start of strings */ 2395 2412 mem_start = PAGE_ALIGN(mem_start); 2396 - RELOC(dt_string_start) = mem_start; 2413 + dt_string_start = mem_start; 2397 2414 mem_start += 4; /* hole */ 2398 2415 2399 2416 /* Add "linux,phandle" in there, we'll need it */ 2400 2417 namep = make_room(&mem_start, &mem_end, 16, 1); 2401 - strcpy(namep, RELOC("linux,phandle")); 2418 + strcpy(namep, "linux,phandle"); 2402 2419 mem_start = (unsigned long)namep + strlen(namep) + 1; 2403 2420 2404 2421 /* Build string array */ 2405 2422 prom_printf("Building dt strings...\n"); 2406 2423 scan_dt_build_strings(root, &mem_start, &mem_end); 2407 - RELOC(dt_string_end) = mem_start; 2424 + dt_string_end = mem_start; 2408 2425 2409 2426 /* Build structure */ 2410 2427 mem_start = PAGE_ALIGN(mem_start); 2411 - RELOC(dt_struct_start) = mem_start; 2428 + dt_struct_start = mem_start; 2412 2429 prom_printf("Building dt structure...\n"); 2413 2430 scan_dt_build_struct(root, &mem_start, &mem_end); 2414 2431 dt_push_token(OF_DT_END, &mem_start, &mem_end); 2415 - RELOC(dt_struct_end) = PAGE_ALIGN(mem_start); 2432 + dt_struct_end = PAGE_ALIGN(mem_start); 2416 2433 2417 2434 /* Finish header */ 2418 - hdr->boot_cpuid_phys = _prom->cpu; 2435 + hdr->boot_cpuid_phys = prom.cpu; 2419 2436 hdr->magic = OF_DT_HEADER; 2420 - hdr->totalsize = RELOC(dt_struct_end) - RELOC(dt_header_start); 2421 - hdr->off_dt_struct = RELOC(dt_struct_start) - RELOC(dt_header_start); 2422 - hdr->off_dt_strings = RELOC(dt_string_start) - RELOC(dt_header_start); 2423 - hdr->dt_strings_size = RELOC(dt_string_end) - RELOC(dt_string_start); 2424 - hdr->off_mem_rsvmap = ((unsigned long)rsvmap) - RELOC(dt_header_start); 2437 + hdr->totalsize = dt_struct_end - dt_header_start; 2438 + hdr->off_dt_struct = dt_struct_start - dt_header_start; 2439 + hdr->off_dt_strings = dt_string_start - dt_header_start; 2440 + hdr->dt_strings_size = dt_string_end - dt_string_start; 2441 + hdr->off_mem_rsvmap = ((unsigned long)rsvmap) - dt_header_start; 2425 2442 hdr->version = OF_DT_VERSION; 2426 2443 /* Version 16 is not backward compatible */ 2427 2444 hdr->last_comp_version = 0x10; 2428 2445 2429 2446 /* Copy the reserve map in */ 2430 - memcpy(rsvmap, RELOC(mem_reserve_map), sizeof(mem_reserve_map)); 2447 + memcpy(rsvmap, mem_reserve_map, sizeof(mem_reserve_map)); 2431 2448 2432 2449 #ifdef DEBUG_PROM 2433 2450 { 2434 2451 int i; 2435 2452 prom_printf("reserved memory map:\n"); 2436 - for (i = 0; i < RELOC(mem_reserve_cnt); i++) 2453 + for (i = 0; i < mem_reserve_cnt; i++) 2437 2454 prom_printf(" %x - %x\n", 2438 - RELOC(mem_reserve_map)[i].base, 2439 - RELOC(mem_reserve_map)[i].size); 2455 + mem_reserve_map[i].base, 2456 + mem_reserve_map[i].size); 2440 2457 } 2441 2458 #endif 2442 2459 /* Bump mem_reserve_cnt to cause further reservations to fail 2443 2460 * since it's too late. 2444 2461 */ 2445 - RELOC(mem_reserve_cnt) = MEM_RESERVE_MAP_SIZE; 2462 + mem_reserve_cnt = MEM_RESERVE_MAP_SIZE; 2446 2463 2447 2464 prom_printf("Device tree strings 0x%x -> 0x%x\n", 2448 - RELOC(dt_string_start), RELOC(dt_string_end)); 2465 + dt_string_start, dt_string_end); 2449 2466 prom_printf("Device tree struct 0x%x -> 0x%x\n", 2450 - RELOC(dt_struct_start), RELOC(dt_struct_end)); 2467 + dt_struct_start, dt_struct_end); 2451 2468 2452 2469 } 2453 2470 ··· 2502 2519 phandle mc; 2503 2520 u32 mc_reg[4]; 2504 2521 char *name = "/hostbridge@f8000000"; 2505 - struct prom_t *_prom = &RELOC(prom); 2506 2522 u32 ac, sc; 2507 2523 2508 2524 mc = call_prom("finddevice", 1, 1, ADDR(name)); ··· 2511 2529 if (prom_getproplen(mc, "reg") != 8) 2512 2530 return; 2513 2531 2514 - prom_getprop(_prom->root, "#address-cells", &ac, sizeof(ac)); 2515 - prom_getprop(_prom->root, "#size-cells", &sc, sizeof(sc)); 2532 + prom_getprop(prom.root, "#address-cells", &ac, sizeof(ac)); 2533 + prom_getprop(prom.root, "#size-cells", &sc, sizeof(sc)); 2516 2534 if ((ac != 2) || (sc != 2)) 2517 2535 return; 2518 2536 ··· 2781 2799 2782 2800 static void __init prom_find_boot_cpu(void) 2783 2801 { 2784 - struct prom_t *_prom = &RELOC(prom); 2785 2802 u32 getprop_rval; 2786 2803 ihandle prom_cpu; 2787 2804 phandle cpu_pkg; 2788 2805 2789 - _prom->cpu = 0; 2790 - if (prom_getprop(_prom->chosen, "cpu", &prom_cpu, sizeof(prom_cpu)) <= 0) 2806 + prom.cpu = 0; 2807 + if (prom_getprop(prom.chosen, "cpu", &prom_cpu, sizeof(prom_cpu)) <= 0) 2791 2808 return; 2792 2809 2793 2810 cpu_pkg = call_prom("instance-to-package", 1, 1, prom_cpu); 2794 2811 2795 2812 prom_getprop(cpu_pkg, "reg", &getprop_rval, sizeof(getprop_rval)); 2796 - _prom->cpu = getprop_rval; 2813 + prom.cpu = getprop_rval; 2797 2814 2798 - prom_debug("Booting CPU hw index = %lu\n", _prom->cpu); 2815 + prom_debug("Booting CPU hw index = %lu\n", prom.cpu); 2799 2816 } 2800 2817 2801 2818 static void __init prom_check_initrd(unsigned long r3, unsigned long r4) 2802 2819 { 2803 2820 #ifdef CONFIG_BLK_DEV_INITRD 2804 - struct prom_t *_prom = &RELOC(prom); 2805 - 2806 2821 if (r3 && r4 && r4 != 0xdeadbeef) { 2807 2822 unsigned long val; 2808 2823 2809 - RELOC(prom_initrd_start) = is_kernel_addr(r3) ? __pa(r3) : r3; 2810 - RELOC(prom_initrd_end) = RELOC(prom_initrd_start) + r4; 2824 + prom_initrd_start = is_kernel_addr(r3) ? __pa(r3) : r3; 2825 + prom_initrd_end = prom_initrd_start + r4; 2811 2826 2812 - val = RELOC(prom_initrd_start); 2813 - prom_setprop(_prom->chosen, "/chosen", "linux,initrd-start", 2827 + val = prom_initrd_start; 2828 + prom_setprop(prom.chosen, "/chosen", "linux,initrd-start", 2814 2829 &val, sizeof(val)); 2815 - val = RELOC(prom_initrd_end); 2816 - prom_setprop(_prom->chosen, "/chosen", "linux,initrd-end", 2830 + val = prom_initrd_end; 2831 + prom_setprop(prom.chosen, "/chosen", "linux,initrd-end", 2817 2832 &val, sizeof(val)); 2818 2833 2819 - reserve_mem(RELOC(prom_initrd_start), 2820 - RELOC(prom_initrd_end) - RELOC(prom_initrd_start)); 2834 + reserve_mem(prom_initrd_start, 2835 + prom_initrd_end - prom_initrd_start); 2821 2836 2822 - prom_debug("initrd_start=0x%x\n", RELOC(prom_initrd_start)); 2823 - prom_debug("initrd_end=0x%x\n", RELOC(prom_initrd_end)); 2837 + prom_debug("initrd_start=0x%x\n", prom_initrd_start); 2838 + prom_debug("initrd_end=0x%x\n", prom_initrd_end); 2824 2839 } 2825 2840 #endif /* CONFIG_BLK_DEV_INITRD */ 2826 2841 } ··· 2880 2901 unsigned long r6, unsigned long r7, 2881 2902 unsigned long kbase) 2882 2903 { 2883 - struct prom_t *_prom; 2884 2904 unsigned long hdr; 2885 2905 2886 2906 #ifdef CONFIG_PPC32 ··· 2889 2911 reloc_toc(); 2890 2912 #endif 2891 2913 2892 - _prom = &RELOC(prom); 2893 - 2894 2914 /* 2895 2915 * First zero the BSS 2896 2916 */ 2897 - memset(&RELOC(__bss_start), 0, __bss_stop - __bss_start); 2917 + memset(&__bss_start, 0, __bss_stop - __bss_start); 2898 2918 2899 2919 /* 2900 2920 * Init interface to Open Firmware, get some node references, ··· 2911 2935 */ 2912 2936 prom_init_stdout(); 2913 2937 2914 - prom_printf("Preparing to boot %s", RELOC(linux_banner)); 2938 + prom_printf("Preparing to boot %s", linux_banner); 2915 2939 2916 2940 /* 2917 2941 * Get default machine type. At this point, we do not differentiate 2918 2942 * between pSeries SMP and pSeries LPAR 2919 2943 */ 2920 - RELOC(of_platform) = prom_find_machine_type(); 2921 - prom_printf("Detected machine type: %x\n", RELOC(of_platform)); 2944 + of_platform = prom_find_machine_type(); 2945 + prom_printf("Detected machine type: %x\n", of_platform); 2922 2946 2923 2947 #ifndef CONFIG_NONSTATIC_KERNEL 2924 2948 /* Bail if this is a kdump kernel. */ ··· 2935 2959 /* 2936 2960 * On pSeries, inform the firmware about our capabilities 2937 2961 */ 2938 - if (RELOC(of_platform) == PLATFORM_PSERIES || 2939 - RELOC(of_platform) == PLATFORM_PSERIES_LPAR) 2962 + if (of_platform == PLATFORM_PSERIES || 2963 + of_platform == PLATFORM_PSERIES_LPAR) 2940 2964 prom_send_capabilities(); 2941 2965 #endif 2942 2966 2943 2967 /* 2944 2968 * Copy the CPU hold code 2945 2969 */ 2946 - if (RELOC(of_platform) != PLATFORM_POWERMAC) 2970 + if (of_platform != PLATFORM_POWERMAC) 2947 2971 copy_and_flush(0, kbase, 0x100, 0); 2948 2972 2949 2973 /* ··· 2972 2996 * that uses the allocator, we need to make sure we get the top of memory 2973 2997 * available for us here... 2974 2998 */ 2975 - if (RELOC(of_platform) == PLATFORM_PSERIES) 2999 + if (of_platform == PLATFORM_PSERIES) 2976 3000 prom_initialize_tce_table(); 2977 3001 #endif 2978 3002 ··· 2980 3004 * On non-powermacs, try to instantiate RTAS. PowerMacs don't 2981 3005 * have a usable RTAS implementation. 2982 3006 */ 2983 - if (RELOC(of_platform) != PLATFORM_POWERMAC && 2984 - RELOC(of_platform) != PLATFORM_OPAL) 3007 + if (of_platform != PLATFORM_POWERMAC && 3008 + of_platform != PLATFORM_OPAL) 2985 3009 prom_instantiate_rtas(); 2986 3010 2987 3011 #ifdef CONFIG_PPC_POWERNV 2988 3012 /* Detect HAL and try instanciating it & doing takeover */ 2989 - if (RELOC(of_platform) == PLATFORM_PSERIES_LPAR) { 3013 + if (of_platform == PLATFORM_PSERIES_LPAR) { 2990 3014 prom_query_opal(); 2991 - if (RELOC(of_platform) == PLATFORM_OPAL) { 3015 + if (of_platform == PLATFORM_OPAL) { 2992 3016 prom_opal_hold_cpus(); 2993 3017 prom_opal_takeover(); 2994 3018 } 2995 - } else if (RELOC(of_platform) == PLATFORM_OPAL) 3019 + } else if (of_platform == PLATFORM_OPAL) 2996 3020 prom_instantiate_opal(); 2997 3021 #endif 2998 3022 ··· 3006 3030 * 3007 3031 * PowerMacs use a different mechanism to spin CPUs 3008 3032 */ 3009 - if (RELOC(of_platform) != PLATFORM_POWERMAC && 3010 - RELOC(of_platform) != PLATFORM_OPAL) 3033 + if (of_platform != PLATFORM_POWERMAC && 3034 + of_platform != PLATFORM_OPAL) 3011 3035 prom_hold_cpus(); 3012 3036 3013 3037 /* 3014 3038 * Fill in some infos for use by the kernel later on 3015 3039 */ 3016 - if (RELOC(prom_memory_limit)) 3017 - prom_setprop(_prom->chosen, "/chosen", "linux,memory-limit", 3018 - &RELOC(prom_memory_limit), 3040 + if (prom_memory_limit) 3041 + prom_setprop(prom.chosen, "/chosen", "linux,memory-limit", 3042 + &prom_memory_limit, 3019 3043 sizeof(prom_memory_limit)); 3020 3044 #ifdef CONFIG_PPC64 3021 - if (RELOC(prom_iommu_off)) 3022 - prom_setprop(_prom->chosen, "/chosen", "linux,iommu-off", 3045 + if (prom_iommu_off) 3046 + prom_setprop(prom.chosen, "/chosen", "linux,iommu-off", 3023 3047 NULL, 0); 3024 3048 3025 - if (RELOC(prom_iommu_force_on)) 3026 - prom_setprop(_prom->chosen, "/chosen", "linux,iommu-force-on", 3049 + if (prom_iommu_force_on) 3050 + prom_setprop(prom.chosen, "/chosen", "linux,iommu-force-on", 3027 3051 NULL, 0); 3028 3052 3029 - if (RELOC(prom_tce_alloc_start)) { 3030 - prom_setprop(_prom->chosen, "/chosen", "linux,tce-alloc-start", 3031 - &RELOC(prom_tce_alloc_start), 3053 + if (prom_tce_alloc_start) { 3054 + prom_setprop(prom.chosen, "/chosen", "linux,tce-alloc-start", 3055 + &prom_tce_alloc_start, 3032 3056 sizeof(prom_tce_alloc_start)); 3033 - prom_setprop(_prom->chosen, "/chosen", "linux,tce-alloc-end", 3034 - &RELOC(prom_tce_alloc_end), 3057 + prom_setprop(prom.chosen, "/chosen", "linux,tce-alloc-end", 3058 + &prom_tce_alloc_end, 3035 3059 sizeof(prom_tce_alloc_end)); 3036 3060 } 3037 3061 #endif ··· 3053 3077 * closed stdin already (in particular the powerbook 101). It 3054 3078 * appears that the OPAL version of OFW doesn't like it either. 3055 3079 */ 3056 - if (RELOC(of_platform) != PLATFORM_POWERMAC && 3057 - RELOC(of_platform) != PLATFORM_OPAL) 3080 + if (of_platform != PLATFORM_POWERMAC && 3081 + of_platform != PLATFORM_OPAL) 3058 3082 prom_close_stdin(); 3059 3083 3060 3084 /* ··· 3069 3093 * tree and NULL as r5, thus triggering the new entry point which 3070 3094 * is common to us and kexec 3071 3095 */ 3072 - hdr = RELOC(dt_header_start); 3096 + hdr = dt_header_start; 3073 3097 3074 3098 /* Don't print anything after quiesce under OPAL, it crashes OFW */ 3075 - if (RELOC(of_platform) != PLATFORM_OPAL) { 3099 + if (of_platform != PLATFORM_OPAL) { 3076 3100 prom_printf("returning from prom_init\n"); 3077 3101 prom_debug("->dt_header_start=0x%x\n", hdr); 3078 3102 } ··· 3086 3110 #ifdef CONFIG_PPC_EARLY_DEBUG_OPAL 3087 3111 /* OPAL early debug gets the OPAL base & entry in r8 and r9 */ 3088 3112 __start(hdr, kbase, 0, 0, 0, 3089 - RELOC(prom_opal_base), RELOC(prom_opal_entry)); 3113 + prom_opal_base, prom_opal_entry); 3090 3114 #else 3091 3115 __start(hdr, kbase, 0, 0, 0, 0, 0); 3092 3116 #endif