aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/prom_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/prom_init.c')
-rw-r--r--arch/powerpc/kernel/prom_init.c44
1 files changed, 35 insertions, 9 deletions
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 3b6f8ae9b8cc..941ff4dbc567 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -311,6 +311,24 @@ static void __init prom_print_hex(unsigned long val)
311 call_prom("write", 3, 1, _prom->stdout, buf, nibbles); 311 call_prom("write", 3, 1, _prom->stdout, buf, nibbles);
312} 312}
313 313
314/* max number of decimal digits in an unsigned long */
315#define UL_DIGITS 21
316static void __init prom_print_dec(unsigned long val)
317{
318 int i, size;
319 char buf[UL_DIGITS+1];
320 struct prom_t *_prom = &RELOC(prom);
321
322 for (i = UL_DIGITS-1; i >= 0; i--) {
323 buf[i] = (val % 10) + '0';
324 val = val/10;
325 if (val == 0)
326 break;
327 }
328 /* shift stuff down */
329 size = UL_DIGITS - i;
330 call_prom("write", 3, 1, _prom->stdout, buf+i, size);
331}
314 332
315static void __init prom_printf(const char *format, ...) 333static void __init prom_printf(const char *format, ...)
316{ 334{
@@ -350,6 +368,14 @@ static void __init prom_printf(const char *format, ...)
350 v = va_arg(args, unsigned long); 368 v = va_arg(args, unsigned long);
351 prom_print_hex(v); 369 prom_print_hex(v);
352 break; 370 break;
371 case 'l':
372 ++q;
373 if (*q == 'u') { /* '%lu' */
374 ++q;
375 v = va_arg(args, unsigned long);
376 prom_print_dec(v);
377 }
378 break;
353 } 379 }
354 } 380 }
355} 381}
@@ -835,11 +861,11 @@ static int __init prom_count_smt_threads(void)
835 if (plen == PROM_ERROR) 861 if (plen == PROM_ERROR)
836 break; 862 break;
837 plen >>= 2; 863 plen >>= 2;
838 prom_debug("Found 0x%x smt threads per core\n", (unsigned long)plen); 864 prom_debug("Found %lu smt threads per core\n", (unsigned long)plen);
839 865
840 /* Sanity check */ 866 /* Sanity check */
841 if (plen < 1 || plen > 64) { 867 if (plen < 1 || plen > 64) {
842 prom_printf("Threads per core 0x%x out of bounds, assuming 1\n", 868 prom_printf("Threads per core %lu out of bounds, assuming 1\n",
843 (unsigned long)plen); 869 (unsigned long)plen);
844 return 1; 870 return 1;
845 } 871 }
@@ -869,12 +895,12 @@ static void __init prom_send_capabilities(void)
869 cores = (u32 *)PTRRELOC(&ibm_architecture_vec[IBM_ARCH_VEC_NRCORES_OFFSET]); 895 cores = (u32 *)PTRRELOC(&ibm_architecture_vec[IBM_ARCH_VEC_NRCORES_OFFSET]);
870 if (*cores != NR_CPUS) { 896 if (*cores != NR_CPUS) {
871 prom_printf("WARNING ! " 897 prom_printf("WARNING ! "
872 "ibm_architecture_vec structure inconsistent: 0x%x !\n", 898 "ibm_architecture_vec structure inconsistent: %lu!\n",
873 *cores); 899 *cores);
874 } else { 900 } else {
875 *cores = DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads()); 901 *cores = DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads());
876 prom_printf("Max number of cores passed to firmware: 0x%x\n", 902 prom_printf("Max number of cores passed to firmware: %lu (NR_CPUS = %lu)\n",
877 (unsigned long)*cores); 903 *cores, NR_CPUS);
878 } 904 }
879 905
880 /* try calling the ibm,client-architecture-support method */ 906 /* try calling the ibm,client-architecture-support method */
@@ -1482,7 +1508,7 @@ static void __init prom_hold_cpus(void)
1482 reg = -1; 1508 reg = -1;
1483 prom_getprop(node, "reg", &reg, sizeof(reg)); 1509 prom_getprop(node, "reg", &reg, sizeof(reg));
1484 1510
1485 prom_debug("cpu hw idx = 0x%x\n", reg); 1511 prom_debug("cpu hw idx = %lu\n", reg);
1486 1512
1487 /* Init the acknowledge var which will be reset by 1513 /* Init the acknowledge var which will be reset by
1488 * the secondary cpu when it awakens from its OF 1514 * the secondary cpu when it awakens from its OF
@@ -1492,7 +1518,7 @@ static void __init prom_hold_cpus(void)
1492 1518
1493 if (reg != _prom->cpu) { 1519 if (reg != _prom->cpu) {
1494 /* Primary Thread of non-boot cpu */ 1520 /* Primary Thread of non-boot cpu */
1495 prom_printf("starting cpu hw idx %x... ", reg); 1521 prom_printf("starting cpu hw idx %lu... ", reg);
1496 call_prom("start-cpu", 3, 0, node, 1522 call_prom("start-cpu", 3, 0, node,
1497 secondary_hold, reg); 1523 secondary_hold, reg);
1498 1524
@@ -1507,7 +1533,7 @@ static void __init prom_hold_cpus(void)
1507 } 1533 }
1508#ifdef CONFIG_SMP 1534#ifdef CONFIG_SMP
1509 else 1535 else
1510 prom_printf("boot cpu hw idx %x\n", reg); 1536 prom_printf("boot cpu hw idx %lu\n", reg);
1511#endif /* CONFIG_SMP */ 1537#endif /* CONFIG_SMP */
1512 } 1538 }
1513 1539
@@ -2420,7 +2446,7 @@ static void __init prom_find_boot_cpu(void)
2420 prom_getprop(cpu_pkg, "reg", &getprop_rval, sizeof(getprop_rval)); 2446 prom_getprop(cpu_pkg, "reg", &getprop_rval, sizeof(getprop_rval));
2421 _prom->cpu = getprop_rval; 2447 _prom->cpu = getprop_rval;
2422 2448
2423 prom_debug("Booting CPU hw index = 0x%x\n", _prom->cpu); 2449 prom_debug("Booting CPU hw index = %lu\n", _prom->cpu);
2424} 2450}
2425 2451
2426static void __init prom_check_initrd(unsigned long r3, unsigned long r4) 2452static void __init prom_check_initrd(unsigned long r3, unsigned long r4)