X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fppc64%2Fkernel%2Fprom.c;h=a4318c378651d372fe5ff8933072fb3be964bbd5;hb=73c4d347a0c98eb6599aefd1f9a91b4b071dd5e0;hp=bdf5e3a476dcb9d01ae619757bd495c7bb146e69;hpb=a91482bdcc2e0f6035702e46f1b99043a0893346;p=linux-2.6.git diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c index bdf5e3a47..a4318c378 100644 --- a/arch/ppc64/kernel/prom.c +++ b/arch/ppc64/kernel/prom.c @@ -133,10 +133,10 @@ typedef unsigned long interpret_func(struct device_node *, unsigned long, /* prom structure */ struct prom_t prom; -char *prom_display_paths[FB_MAX] __initdata = { NULL, }; +char *prom_display_paths[FB_MAX] __initdata = { 0, }; phandle prom_display_nodes[FB_MAX] __initdata; unsigned int prom_num_displays = 0; -char *of_stdout_device = NULL; +char *of_stdout_device = 0; static int iommu_force_on; int ppc64_iommu_off; @@ -148,13 +148,13 @@ extern struct lmb lmb; #define MAX_PHB (32 * 6) /* 32 drawers * 6 PHBs/drawer */ struct of_tce_table of_tce_table[MAX_PHB + 1]; -char *bootpath = NULL; -char *bootdevice = NULL; +char *bootpath = 0; +char *bootdevice = 0; int boot_cpuid = 0; #define MAX_CPU_THREADS 2 -struct device_node *allnodes = NULL; +struct device_node *allnodes = 0; /* use when traversing tree through the allnext, child, sibling, * or parent members of struct device_node. */ @@ -199,16 +199,16 @@ static int __init call_prom(const char *service, int nargs, int nret, ...) unsigned long offset = reloc_offset(); struct prom_t *_prom = PTRRELOC(&prom); va_list list; - + _prom->args.service = ADDR(service); _prom->args.nargs = nargs; _prom->args.nret = nret; - _prom->args.rets = (prom_arg_t *)&(_prom->args.args[nargs]); + _prom->args.rets = (prom_arg_t *)&(_prom->args.args[nargs]); - va_start(list, nret); + va_start(list, nret); for (i=0; i < nargs; i++) _prom->args.args[i] = va_arg(list, prom_arg_t); - va_end(list); + va_end(list); for (i=0; i < nret ;i++) _prom->args.rets[i] = 0; @@ -244,17 +244,17 @@ static void __init prom_print(const char *msg) static void __init prom_print_hex(unsigned long val) { unsigned long offset = reloc_offset(); - int i, nibbles = sizeof(val)*2; - char buf[sizeof(val)*2+1]; + int i, nibbles = sizeof(val)*2; + char buf[sizeof(val)*2+1]; struct prom_t *_prom = PTRRELOC(&prom); - for (i = nibbles-1; i >= 0; i--) { - buf[i] = (val & 0xf) + '0'; - if (buf[i] > '9') - buf[i] += ('a'-'0'-10); - val >>= 4; - } - buf[nibbles] = '\0'; + for (i = nibbles-1; i >= 0; i--) { + buf[i] = (val & 0xf) + '0'; + if (buf[i] > '9') + buf[i] += ('a'-'0'-10); + val >>= 4; + } + buf[nibbles] = '\0'; call_prom("write", 3, 1, _prom->stdout, buf, nibbles); } @@ -343,22 +343,22 @@ static void __init prom_initialize_naca(void) { phandle node; char type[64]; - unsigned long num_cpus = 0; - unsigned long offset = reloc_offset(); + unsigned long num_cpus = 0; + unsigned long offset = reloc_offset(); struct prom_t *_prom = PTRRELOC(&prom); - struct naca_struct *_naca = RELOC(naca); - struct systemcfg *_systemcfg = RELOC(systemcfg); + struct naca_struct *_naca = RELOC(naca); + struct systemcfg *_systemcfg = RELOC(systemcfg); /* NOTE: _naca->debug_switch is already initialized. */ prom_debug("prom_initialize_naca: start...\n"); _naca->pftSize = 0; /* ilog2 of htab size. computed below. */ - for (node = 0; prom_next_node(&node); ) { - type[0] = 0; + for (node = 0; prom_next_node(&node); ) { + type[0] = 0; prom_getprop(node, "device_type", type, sizeof(type)); - if (!strcmp(type, RELOC("cpu"))) { + if (!strcmp(type, RELOC("cpu"))) { num_cpus += 1; /* We're assuming *all* of the CPUs have the same @@ -404,7 +404,7 @@ static void __init prom_initialize_naca(void) _naca->pftSize = pft_size[1]; } } - } else if (!strcmp(type, RELOC("serial"))) { + } else if (!strcmp(type, RELOC("serial"))) { phandle isa, pci; struct isa_reg_property reg; union pci_range ranges; @@ -435,7 +435,7 @@ static void __init prom_initialize_naca(void) ((((unsigned long)ranges.pci64.phys_hi) << 32) | (ranges.pci64.phys_lo)) + reg.address; } - } + } } if (_systemcfg->platform == PLATFORM_POWERMAC) @@ -465,8 +465,8 @@ static void __init prom_initialize_naca(void) } /* We gotta have at least 1 cpu... */ - if ( (_systemcfg->processorCount = num_cpus) < 1 ) - PROM_BUG(); + if ( (_systemcfg->processorCount = num_cpus) < 1 ) + PROM_BUG(); _systemcfg->physicalMemorySize = lmb_phys_mem_size(); @@ -496,21 +496,21 @@ static void __init prom_initialize_naca(void) _systemcfg->version.minor = SYSTEMCFG_MINOR; _systemcfg->processor = _get_PVR(); - prom_debug("systemcfg->processorCount = 0x%x\n", + prom_debug("systemcfg->processorCount = 0x%x\n", _systemcfg->processorCount); - prom_debug("systemcfg->physicalMemorySize = 0x%x\n", + prom_debug("systemcfg->physicalMemorySize = 0x%x\n", _systemcfg->physicalMemorySize); - prom_debug("naca->pftSize = 0x%x\n", + prom_debug("naca->pftSize = 0x%x\n", _naca->pftSize); - prom_debug("systemcfg->dCacheL1LineSize = 0x%x\n", + prom_debug("systemcfg->dCacheL1LineSize = 0x%x\n", _systemcfg->dCacheL1LineSize); - prom_debug("systemcfg->iCacheL1LineSize = 0x%x\n", + prom_debug("systemcfg->iCacheL1LineSize = 0x%x\n", _systemcfg->iCacheL1LineSize); - prom_debug("naca->serialPortAddr = 0x%x\n", + prom_debug("naca->serialPortAddr = 0x%x\n", _naca->serialPortAddr); - prom_debug("naca->interrupt_controller = 0x%x\n", + prom_debug("naca->interrupt_controller = 0x%x\n", _naca->interrupt_controller); - prom_debug("systemcfg->platform = 0x%x\n", + prom_debug("systemcfg->platform = 0x%x\n", _systemcfg->platform); prom_debug("prom_initialize_naca: end...\n"); } @@ -547,36 +547,36 @@ static void __init early_cmdline_parse(void) #ifdef DEBUG_PROM void prom_dump_lmb(void) { - unsigned long i; - unsigned long offset = reloc_offset(); + unsigned long i; + unsigned long offset = reloc_offset(); struct lmb *_lmb = PTRRELOC(&lmb); - prom_printf("\nprom_dump_lmb:\n"); - prom_printf(" memory.cnt = 0x%x\n", + prom_printf("\nprom_dump_lmb:\n"); + prom_printf(" memory.cnt = 0x%x\n", _lmb->memory.cnt); - prom_printf(" memory.size = 0x%x\n", + prom_printf(" memory.size = 0x%x\n", _lmb->memory.size); - for (i=0; i < _lmb->memory.cnt ;i++) { - prom_printf(" memory.region[0x%x].base = 0x%x\n", + for (i=0; i < _lmb->memory.cnt ;i++) { + prom_printf(" memory.region[0x%x].base = 0x%x\n", i, _lmb->memory.region[i].base); - prom_printf(" .physbase = 0x%x\n", + prom_printf(" .physbase = 0x%x\n", _lmb->memory.region[i].physbase); - prom_printf(" .size = 0x%x\n", + prom_printf(" .size = 0x%x\n", _lmb->memory.region[i].size); - } + } - prom_printf("\n reserved.cnt = 0x%x\n", + prom_printf("\n reserved.cnt = 0x%x\n", _lmb->reserved.cnt); - prom_printf(" reserved.size = 0x%x\n", + prom_printf(" reserved.size = 0x%x\n", _lmb->reserved.size); - for (i=0; i < _lmb->reserved.cnt ;i++) { - prom_printf(" reserved.region[0x%x\n].base = 0x%x\n", + for (i=0; i < _lmb->reserved.cnt ;i++) { + prom_printf(" reserved.region[0x%x\n].base = 0x%x\n", i, _lmb->reserved.region[i].base); - prom_printf(" .physbase = 0x%x\n", + prom_printf(" .physbase = 0x%x\n", _lmb->reserved.region[i].physbase); - prom_printf(" .size = 0x%x\n", + prom_printf(" .size = 0x%x\n", _lmb->reserved.region[i].size); - } + } } #endif /* DEBUG_PROM */ @@ -584,9 +584,9 @@ static void __init prom_initialize_lmb(void) { phandle node; char type[64]; - unsigned long i, offset = reloc_offset(); + unsigned long i, offset = reloc_offset(); struct prom_t *_prom = PTRRELOC(&prom); - struct systemcfg *_systemcfg = RELOC(systemcfg); + struct systemcfg *_systemcfg = RELOC(systemcfg); union lmb_reg_property reg; unsigned long lmb_base, lmb_size; unsigned long num_regs, bytes_per_reg = (_prom->encode_phys_size*2)/8; @@ -599,11 +599,11 @@ static void __init prom_initialize_lmb(void) if (_systemcfg->platform == PLATFORM_POWERMAC) bytes_per_reg = 12; - for (node = 0; prom_next_node(&node); ) { - type[0] = 0; - prom_getprop(node, "device_type", type, sizeof(type)); + for (node = 0; prom_next_node(&node); ) { + type[0] = 0; + prom_getprop(node, "device_type", type, sizeof(type)); - if (strcmp(type, RELOC("memory"))) + if (strcmp(type, RELOC("memory"))) continue; num_regs = prom_getprop(node, "reg", ®, sizeof(reg)) @@ -651,7 +651,7 @@ prom_instantiate_rtas(void) struct rtas_t *_rtas = PTRRELOC(&rtas); struct systemcfg *_systemcfg = RELOC(systemcfg); ihandle prom_rtas; - u32 getprop_rval; + u32 getprop_rval; char hypertas_funcs[4]; prom_debug("prom_instantiate_rtas: start...\n"); @@ -669,7 +669,7 @@ prom_instantiate_rtas(void) prom_getprop(prom_rtas, "rtas-size", &getprop_rval, sizeof(getprop_rval)); - _rtas->size = getprop_rval; + _rtas->size = getprop_rval; prom_printf("instantiating rtas"); if (_rtas->size != 0) { unsigned long rtas_region = RTAS_INSTANTIATE_MAX; @@ -707,9 +707,9 @@ prom_instantiate_rtas(void) prom_printf(" done\n"); } - prom_debug("rtas->base = 0x%x\n", _rtas->base); - prom_debug("rtas->entry = 0x%x\n", _rtas->entry); - prom_debug("rtas->size = 0x%x\n", _rtas->size); + prom_debug("rtas->base = 0x%x\n", _rtas->base); + prom_debug("rtas->entry = 0x%x\n", _rtas->entry); + prom_debug("rtas->size = 0x%x\n", _rtas->size); } prom_debug("prom_instantiate_rtas: end...\n"); } @@ -744,7 +744,7 @@ static void __init prom_initialize_tce_table(void) { phandle node; ihandle phb_node; - unsigned long offset = reloc_offset(); + unsigned long offset = reloc_offset(); char compatible[64], path[64], type[64], model[64]; unsigned long i, table = 0; unsigned long base, vbase, align; @@ -775,9 +775,9 @@ static void __init prom_initialize_tce_table(void) /* Keep the old logic in tack to avoid regression. */ if (compatible[0] != 0) { - if ((strstr(compatible, RELOC("python")) == NULL) && - (strstr(compatible, RELOC("Speedwagon")) == NULL) && - (strstr(compatible, RELOC("Winnipeg")) == NULL)) + if((strstr(compatible, RELOC("python")) == NULL) && + (strstr(compatible, RELOC("Speedwagon")) == NULL) && + (strstr(compatible, RELOC("Winnipeg")) == NULL)) continue; } else if (model[0] != 0) { if ((strstr(model, RELOC("ython")) == NULL) && @@ -853,21 +853,21 @@ static void __init prom_initialize_tce_table(void) /* Call OF to setup the TCE hardware */ if (call_prom("package-to-path", 3, 1, node, path, sizeof(path)-1) == PROM_ERROR) { - prom_printf("package-to-path failed\n"); - } else { - prom_printf("opening PHB %s", path); - } - - phb_node = call_prom("open", 1, 1, path); - if ( (long)phb_node <= 0) { - prom_printf("... failed\n"); - } else { - prom_printf("... done\n"); - } - call_prom("call-method", 6, 0, ADDR("set-64-bit-addressing"), + prom_printf("package-to-path failed\n"); + } else { + prom_printf("opening PHB %s", path); + } + + phb_node = call_prom("open", 1, 1, path); + if ( (long)phb_node <= 0) { + prom_printf("... failed\n"); + } else { + prom_printf("... done\n"); + } + call_prom("call-method", 6, 0, ADDR("set-64-bit-addressing"), phb_node, -1, minsize, (u32) base, (u32) (base >> 32)); - call_prom("close", 1, 0, phb_node); + call_prom("close", 1, 0, phb_node); table++; } @@ -910,15 +910,15 @@ static void __init prom_hold_cpus(unsigned long mem) unsigned int cpu_threads, hw_cpu_num; int propsize; extern void __secondary_hold(void); - extern unsigned long __secondary_hold_spinloop; - extern unsigned long __secondary_hold_acknowledge; - unsigned long *spinloop + extern unsigned long __secondary_hold_spinloop; + extern unsigned long __secondary_hold_acknowledge; + unsigned long *spinloop = (void *)virt_to_abs(&__secondary_hold_spinloop); - unsigned long *acknowledge + unsigned long *acknowledge = (void *)virt_to_abs(&__secondary_hold_acknowledge); - unsigned long secondary_hold + unsigned long secondary_hold = virt_to_abs(*PTRRELOC((unsigned long *)__secondary_hold)); - struct systemcfg *_systemcfg = RELOC(systemcfg); + struct systemcfg *_systemcfg = RELOC(systemcfg); struct paca_struct *lpaca = PTRRELOC(&paca[0]); struct prom_t *_prom = PTRRELOC(&prom); #ifdef CONFIG_SMP @@ -962,12 +962,12 @@ static void __init prom_hold_cpus(unsigned long mem) prom_debug(" 1) *acknowledge = 0x%x\n", *acknowledge); prom_debug(" 1) secondary_hold = 0x%x\n", secondary_hold); - /* Set the common spinloop variable, so all of the secondary cpus + /* Set the common spinloop variable, so all of the secondary cpus * will block when they are awakened from their OF spinloop. * This must occur for both SMP and non SMP kernels, since OF will * be trashed when we move the kernel. - */ - *spinloop = 0; + */ + *spinloop = 0; #ifdef CONFIG_HMT for (i=0; i < NR_CPUS; i++) { @@ -986,7 +986,7 @@ static void __init prom_hold_cpus(unsigned long mem) if (strcmp(type, RELOC("okay")) != 0) continue; - reg = -1; + reg = -1; prom_getprop(node, "reg", ®, sizeof(reg)); path = (char *) mem; @@ -1124,7 +1124,7 @@ static void __init smt_setup(void) ihandle prom_options = 0; char option[9]; unsigned long offset = reloc_offset(); - struct naca_struct *_naca = RELOC(naca); + struct naca_struct *_naca = RELOC(naca); char found = 0; if (strstr(RELOC(cmd_line), RELOC("smt-enabled="))) { @@ -1253,10 +1253,10 @@ static void __init prom_init_stdout(void) struct prom_t *_prom = PTRRELOC(&prom); u32 val; - if (prom_getprop(_prom->chosen, "stdout", &val, sizeof(val)) <= 0) - prom_panic("cannot find stdout"); + if (prom_getprop(_prom->chosen, "stdout", &val, sizeof(val)) <= 0) + prom_panic("cannot find stdout"); - _prom->stdout = val; + _prom->stdout = val; } static int __init prom_find_machine_type(void) @@ -1306,7 +1306,7 @@ static unsigned long __init check_display(unsigned long mem) ihandle ih; int i, j; unsigned long offset = reloc_offset(); - struct prom_t *_prom = PTRRELOC(&prom); + struct prom_t *_prom = PTRRELOC(&prom); char type[16], *path; static unsigned char default_colors[] = { 0x00, 0x00, 0x00, @@ -1403,7 +1403,7 @@ static unsigned long __init check_display(unsigned long mem) break; #endif /* CONFIG_LOGO_LINUX_CLUT224 */ } - + return DOUBLEWORD_ALIGN(mem); } @@ -1412,11 +1412,11 @@ static void __init *__make_room(unsigned long *mem_start, unsigned long *mem_end unsigned long needed, unsigned long align) { void *ret; + unsigned long offset = reloc_offset(); *mem_start = ALIGN(*mem_start, align); if (*mem_start + needed > *mem_end) { #ifdef CONFIG_BLK_DEV_INITRD - unsigned long offset = reloc_offset(); /* FIXME: Apple OF doesn't map unclaimed mem. If this * ever happened on G5, we'd need to fix. */ unsigned long initrd_len; @@ -1582,8 +1582,8 @@ copy_device_tree(unsigned long mem_start) prom_panic("couldn't get device tree root\n"); } allnextp = &RELOC(allnodes); - inspect_node(root, NULL, &mem_start, &mem_end, &allnextp); - *allnextp = NULL; + inspect_node(root, 0, &mem_start, &mem_end, &allnextp); + *allnextp = 0; return mem_start; } @@ -1592,7 +1592,7 @@ static struct bi_record * __init prom_bi_rec_verify(struct bi_record *bi_recs) { struct bi_record *first, *last; - prom_debug("birec_verify: r6=0x%x\n", (unsigned long)bi_recs); + prom_debug("birec_verify: r6=0x%x\n", (unsigned long)bi_recs); if (bi_recs != NULL) prom_debug(" tag=0x%x\n", bi_recs->tag); @@ -1601,7 +1601,7 @@ static struct bi_record * __init prom_bi_rec_verify(struct bi_record *bi_recs) last = (struct bi_record *)(long)bi_recs->data[0]; - prom_debug(" last=0x%x\n", (unsigned long)last); + prom_debug(" last=0x%x\n", (unsigned long)last); if (last != NULL) prom_debug(" last_tag=0x%x\n", last->tag); @@ -1609,7 +1609,7 @@ static struct bi_record * __init prom_bi_rec_verify(struct bi_record *bi_recs) return NULL; first = (struct bi_record *)(long)last->data[0]; - prom_debug(" first=0x%x\n", (unsigned long)first); + prom_debug(" first=0x%x\n", (unsigned long)first); if ( first == NULL || first != bi_recs ) return NULL; @@ -1681,9 +1681,9 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp, /* Init prom stdout device */ prom_init_stdout(); - prom_debug("klimit=0x%x\n", RELOC(klimit)); - prom_debug("offset=0x%x\n", offset); - prom_debug("->mem=0x%x\n", RELOC(klimit) - offset); + prom_debug("klimit=0x%x\n", RELOC(klimit)); + prom_debug("offset=0x%x\n", offset); + prom_debug("->mem=0x%x\n", RELOC(klimit) - offset); /* check out if we have bi_recs */ _prom->bi_recs = prom_bi_rec_verify((struct bi_record *)r6); @@ -1713,7 +1713,7 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp, copy_and_flush(0, KERNELBASE - offset, 0x100, 0); /* Start storing things at klimit */ - mem = RELOC(klimit) - offset; + mem = RELOC(klimit) - offset; /* Get the full OF pathname of the stdout device */ p = (char *) mem; @@ -1728,9 +1728,9 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp, _prom->encode_phys_size = (getprop_rval == 1) ? 32 : 64; /* Determine which cpu is actually running right _now_ */ - if (prom_getprop(_prom->chosen, "cpu", + if (prom_getprop(_prom->chosen, "cpu", &prom_cpu, sizeof(prom_cpu)) <= 0) - prom_panic("cannot find boot cpu"); + prom_panic("cannot find boot cpu"); cpu_pkg = call_prom("instance-to-package", 1, 1, prom_cpu); prom_getprop(cpu_pkg, "reg", &getprop_rval, sizeof(getprop_rval)); @@ -1739,7 +1739,7 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp, RELOC(boot_cpuid) = 0; - prom_debug("Booting CPU hw index = 0x%x\n", _prom->cpu); + prom_debug("Booting CPU hw index = 0x%x\n", _prom->cpu); /* Get the boot device and translate it to a full OF pathname. */ p = (char *) mem; @@ -1773,18 +1773,18 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp, if (_systemcfg->platform != PLATFORM_POWERMAC) prom_instantiate_rtas(); - /* Initialize some system info into the Naca early... */ - prom_initialize_naca(); + /* Initialize some system info into the Naca early... */ + prom_initialize_naca(); smt_setup(); - /* If we are on an SMP machine, then we *MUST* do the - * following, regardless of whether we have an SMP - * kernel or not. - */ + /* If we are on an SMP machine, then we *MUST* do the + * following, regardless of whether we have an SMP + * kernel or not. + */ prom_hold_cpus(mem); - prom_debug("after basic inits, mem=0x%x\n", mem); + prom_debug("after basic inits, mem=0x%x\n", mem); #ifdef CONFIG_BLK_DEV_INITRD prom_debug("initrd_start=0x%x\n", RELOC(initrd_start)); prom_debug("initrd_end=0x%x\n", RELOC(initrd_end)); @@ -1796,7 +1796,7 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp, RELOC(klimit) = mem + offset; prom_debug("new klimit is\n"); - prom_debug("klimit=0x%x\n", RELOC(klimit)); + prom_debug("klimit=0x%x\n", RELOC(klimit)); prom_debug(" ->mem=0x%x\n", mem); lmb_reserve(0, __pa(RELOC(klimit))); @@ -1881,7 +1881,8 @@ intr_parent(struct device_node *p) * Find out the size of each entry of the interrupts property * for a node. */ -int __devinit prom_n_intr_cells(struct device_node *np) +static int __devinit +prom_n_intr_cells(struct device_node *np) { struct device_node *p; unsigned int *icp; @@ -1895,7 +1896,7 @@ int __devinit prom_n_intr_cells(struct device_node *np) || get_property(p, "interrupt-map", NULL) != NULL) { printk("oops, node %s doesn't have #interrupt-cells\n", p->full_name); - return 1; + return 1; } } #ifdef DEBUG_IRQ @@ -2081,7 +2082,7 @@ interpret_pci_props(struct device_node *np, unsigned long mem_start, i = 0; adr = (struct address_range *) mem_start; while ((l -= sizeof(struct pci_reg_property)) >= 0) { - if (!measure_only) { + if (!measure_only) { adr[i].space = pci_addrs[i].addr.a_hi; adr[i].address = pci_addrs[i].addr.a_lo; adr[i].size = pci_addrs[i].size_lo; @@ -2120,7 +2121,7 @@ interpret_dbdma_props(struct device_node *np, unsigned long mem_start, i = 0; adr = (struct address_range *) mem_start; while ((l -= sizeof(struct reg_property32)) >= 0) { - if (!measure_only) { + if (!measure_only) { adr[i].space = 2; adr[i].address = rp[i].address + base_address; adr[i].size = rp[i].size; @@ -2160,7 +2161,7 @@ interpret_macio_props(struct device_node *np, unsigned long mem_start, i = 0; adr = (struct address_range *) mem_start; while ((l -= sizeof(struct reg_property32)) >= 0) { - if (!measure_only) { + if (!measure_only) { adr[i].space = 2; adr[i].address = rp[i].address + base_address; adr[i].size = rp[i].size; @@ -2188,7 +2189,7 @@ interpret_isa_props(struct device_node *np, unsigned long mem_start, i = 0; adr = (struct address_range *) mem_start; while ((l -= sizeof(struct reg_property)) >= 0) { - if (!measure_only) { + if (!measure_only) { adr[i].space = rp[i].space; adr[i].address = rp[i].address; adr[i].size = rp[i].size; @@ -2217,7 +2218,7 @@ interpret_root_props(struct device_node *np, unsigned long mem_start, i = 0; adr = (struct address_range *) mem_start; while ((l -= rpsize) >= 0) { - if (!measure_only) { + if (!measure_only) { adr[i].space = 0; adr[i].address = rp[naddrc - 1]; adr[i].size = rp[naddrc + nsizec - 1]; @@ -2240,8 +2241,8 @@ finish_node(struct device_node *np, unsigned long mem_start, struct device_node *child; int *ip; - np->name = get_property(np, "name", NULL); - np->type = get_property(np, "device_type", NULL); + np->name = get_property(np, "name", 0); + np->type = get_property(np, "device_type", 0); if (!np->name) np->name = ""; @@ -2255,10 +2256,10 @@ finish_node(struct device_node *np, unsigned long mem_start, mem_start = finish_node_interrupts(np, mem_start, measure_only); /* Look for #address-cells and #size-cells properties. */ - ip = (int *) get_property(np, "#address-cells", NULL); + ip = (int *) get_property(np, "#address-cells", 0); if (ip != NULL) naddrc = *ip; - ip = (int *) get_property(np, "#size-cells", NULL); + ip = (int *) get_property(np, "#size-cells", 0); if (ip != NULL) nsizec = *ip; @@ -2266,7 +2267,7 @@ finish_node(struct device_node *np, unsigned long mem_start, * expect for the name -- Cort */ if (!strcmp(np->name, "display")) - np->name = get_property(np, "compatible", NULL); + np->name = get_property(np, "compatible", 0); if (!strcmp(np->name, "device-tree") || np->parent == NULL) ifunc = interpret_root_props; @@ -2295,7 +2296,7 @@ finish_node(struct device_node *np, unsigned long mem_start, return mem_start; } -/** +/* * finish_device_tree is called once things are running normally * (i.e. with text and data mapped to the address they were linked at). * It traverses the device tree and fills in the name, type, @@ -2323,7 +2324,7 @@ prom_n_addr_cells(struct device_node* np) do { if (np->parent) np = np->parent; - ip = (int *) get_property(np, "#address-cells", NULL); + ip = (int *) get_property(np, "#address-cells", 0); if (ip != NULL) return *ip; } while (np->parent); @@ -2338,7 +2339,7 @@ prom_n_size_cells(struct device_node* np) do { if (np->parent) np = np->parent; - ip = (int *) get_property(np, "#size-cells", NULL); + ip = (int *) get_property(np, "#size-cells", 0); if (ip != NULL) return *ip; } while (np->parent); @@ -2346,7 +2347,7 @@ prom_n_size_cells(struct device_node* np) return 1; } -/** +/* * Work out the sense (active-low level / active-high edge) * of each interrupt from the device tree. */ @@ -2368,7 +2369,7 @@ prom_get_irq_senses(unsigned char *senses, int off, int max) } } -/** +/* * Construct and return a list of the device_nodes with a given name. */ struct device_node * @@ -2383,11 +2384,11 @@ find_devices(const char *name) prevp = &np->next; } } - *prevp = NULL; + *prevp = 0; return head; } -/** +/* * Construct and return a list of the device_nodes with a given type. */ struct device_node * @@ -2402,11 +2403,11 @@ find_type_devices(const char *type) prevp = &np->next; } } - *prevp = NULL; + *prevp = 0; return head; } -/** +/* * Returns all nodes linked together */ struct device_node * @@ -2419,11 +2420,11 @@ find_all_nodes(void) *prevp = np; prevp = &np->next; } - *prevp = NULL; + *prevp = 0; return head; } -/** Checks if the given "compat" string matches one of the strings in +/* Checks if the given "compat" string matches one of the strings in * the device's "compatible" property */ int @@ -2447,7 +2448,7 @@ device_is_compatible(struct device_node *device, const char *compat) } -/** +/* * Indicates whether the root node has a given value in its * compatible property. */ @@ -2456,7 +2457,7 @@ machine_is_compatible(const char *compat) { struct device_node *root; int rc = 0; - + root = of_find_node_by_path("/"); if (root) { rc = device_is_compatible(root, compat); @@ -2465,7 +2466,7 @@ machine_is_compatible(const char *compat) return rc; } -/** +/* * Construct and return a list of the device_nodes with a given type * and compatible property. */ @@ -2484,11 +2485,11 @@ find_compatible_devices(const char *type, const char *compat) prevp = &np->next; } } - *prevp = NULL; + *prevp = 0; return head; } -/** +/* * Find the device_node with a given full_name. */ struct device_node * @@ -2903,9 +2904,9 @@ static int of_finish_dynamic_node(struct device_node *node) u32 *regs; int err = 0; phandle *ibm_phandle; - - node->name = get_property(node, "name", NULL); - node->type = get_property(node, "device_type", NULL); + + node->name = get_property(node, "name", 0); + node->type = get_property(node, "device_type", 0); if (!parent) { err = -ENODEV; @@ -2951,31 +2952,32 @@ static int of_finish_dynamic_node(struct device_node *node) } /* now do the work of finish_node_interrupts */ - if (get_property(node, "interrupts", NULL)) { + if (get_property(node, "interrupts", 0)) { err = of_finish_dynamic_node_interrupts(node); if (err) goto out; } - /* now do the rough equivalent of update_dn_pci_info, this - * probably is not correct for phb's, but should work for - * IOAs and slots. - */ + /* now do the rough equivalent of update_dn_pci_info, this + * probably is not correct for phb's, but should work for + * IOAs and slots. + */ - node->phb = parent->phb; + node->phb = parent->phb; - regs = (u32 *)get_property(node, "reg", NULL); - if (regs) { - node->busno = (regs[0] >> 16) & 0xff; - node->devfn = (regs[0] >> 8) & 0xff; - } + regs = (u32 *)get_property(node, "reg", 0); + if (regs) { + node->busno = (regs[0] >> 16) & 0xff; + node->devfn = (regs[0] >> 8) & 0xff; + } /* fixing up iommu_table */ - if (strcmp(node->name, "pci") == 0 && - get_property(node, "ibm,dma-window", NULL)) { - node->bussubno = node->busno; - iommu_devnode_init(node); - } else + if(strcmp(node->name, "pci") == 0 && + get_property(node, "ibm,dma-window", NULL)) { + node->bussubno = node->busno; + iommu_devnode_init(node); + } + else node->iommu_table = parent->iommu_table; out: @@ -3095,7 +3097,7 @@ get_property(struct device_node *np, const char *name, int *lenp) *lenp = pp->length; return pp->value; } - return NULL; + return 0; } /*