aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/prom_parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/prom_parse.c')
-rw-r--r--arch/powerpc/kernel/prom_parse.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index 91b443c9a488..aa40a5307294 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -68,9 +68,9 @@ static void of_bus_default_count_cells(struct device_node *dev,
68 int *addrc, int *sizec) 68 int *addrc, int *sizec)
69{ 69{
70 if (addrc) 70 if (addrc)
71 *addrc = prom_n_addr_cells(dev); 71 *addrc = of_n_addr_cells(dev);
72 if (sizec) 72 if (sizec)
73 *sizec = prom_n_size_cells(dev); 73 *sizec = of_n_size_cells(dev);
74} 74}
75 75
76static u64 of_bus_default_map(u32 *addr, const u32 *range, 76static u64 of_bus_default_map(u32 *addr, const u32 *range,
@@ -196,7 +196,7 @@ const u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
196 return NULL; 196 return NULL;
197 197
198 /* Get "reg" or "assigned-addresses" property */ 198 /* Get "reg" or "assigned-addresses" property */
199 prop = get_property(dev, bus->addresses, &psize); 199 prop = of_get_property(dev, bus->addresses, &psize);
200 if (prop == NULL) 200 if (prop == NULL)
201 return NULL; 201 return NULL;
202 psize /= 4; 202 psize /= 4;
@@ -438,7 +438,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
438 * to translate addresses that aren't supposed to be translated in 438 * to translate addresses that aren't supposed to be translated in
439 * the first place. --BenH. 439 * the first place. --BenH.
440 */ 440 */
441 ranges = get_property(parent, "ranges", &rlen); 441 ranges = of_get_property(parent, "ranges", &rlen);
442 if (ranges == NULL || rlen == 0) { 442 if (ranges == NULL || rlen == 0) {
443 offset = of_read_number(addr, na); 443 offset = of_read_number(addr, na);
444 memset(addr, 0, pna * 4); 444 memset(addr, 0, pna * 4);
@@ -578,7 +578,7 @@ const u32 *of_get_address(struct device_node *dev, int index, u64 *size,
578 return NULL; 578 return NULL;
579 579
580 /* Get "reg" or "assigned-addresses" property */ 580 /* Get "reg" or "assigned-addresses" property */
581 prop = get_property(dev, bus->addresses, &psize); 581 prop = of_get_property(dev, bus->addresses, &psize);
582 if (prop == NULL) 582 if (prop == NULL)
583 return NULL; 583 return NULL;
584 psize /= 4; 584 psize /= 4;
@@ -650,17 +650,17 @@ void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
650 /* busno is always one cell */ 650 /* busno is always one cell */
651 *busno = *(dma_window++); 651 *busno = *(dma_window++);
652 652
653 prop = get_property(dn, "ibm,#dma-address-cells", NULL); 653 prop = of_get_property(dn, "ibm,#dma-address-cells", NULL);
654 if (!prop) 654 if (!prop)
655 prop = get_property(dn, "#address-cells", NULL); 655 prop = of_get_property(dn, "#address-cells", NULL);
656 656
657 cells = prop ? *(u32 *)prop : prom_n_addr_cells(dn); 657 cells = prop ? *(u32 *)prop : of_n_addr_cells(dn);
658 *phys = of_read_number(dma_window, cells); 658 *phys = of_read_number(dma_window, cells);
659 659
660 dma_window += cells; 660 dma_window += cells;
661 661
662 prop = get_property(dn, "ibm,#dma-size-cells", NULL); 662 prop = of_get_property(dn, "ibm,#dma-size-cells", NULL);
663 cells = prop ? *(u32 *)prop : prom_n_size_cells(dn); 663 cells = prop ? *(u32 *)prop : of_n_size_cells(dn);
664 *size = of_read_number(dma_window, cells); 664 *size = of_read_number(dma_window, cells);
665} 665}
666 666
@@ -680,7 +680,7 @@ static struct device_node *of_irq_find_parent(struct device_node *child)
680 return NULL; 680 return NULL;
681 681
682 do { 682 do {
683 parp = get_property(child, "interrupt-parent", NULL); 683 parp = of_get_property(child, "interrupt-parent", NULL);
684 if (parp == NULL) 684 if (parp == NULL)
685 p = of_get_parent(child); 685 p = of_get_parent(child);
686 else { 686 else {
@@ -691,7 +691,7 @@ static struct device_node *of_irq_find_parent(struct device_node *child)
691 } 691 }
692 of_node_put(child); 692 of_node_put(child);
693 child = p; 693 child = p;
694 } while (p && get_property(p, "#interrupt-cells", NULL) == NULL); 694 } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL);
695 695
696 return p; 696 return p;
697} 697}
@@ -716,7 +716,7 @@ void of_irq_map_init(unsigned int flags)
716 struct device_node *np; 716 struct device_node *np;
717 717
718 for(np = NULL; (np = of_find_all_nodes(np)) != NULL;) { 718 for(np = NULL; (np = of_find_all_nodes(np)) != NULL;) {
719 if (get_property(np, "interrupt-controller", NULL) 719 if (of_get_property(np, "interrupt-controller", NULL)
720 == NULL) 720 == NULL)
721 continue; 721 continue;
722 /* Skip /chosen/interrupt-controller */ 722 /* Skip /chosen/interrupt-controller */
@@ -755,7 +755,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
755 * is none, we are nice and just walk up the tree 755 * is none, we are nice and just walk up the tree
756 */ 756 */
757 do { 757 do {
758 tmp = get_property(ipar, "#interrupt-cells", NULL); 758 tmp = of_get_property(ipar, "#interrupt-cells", NULL);
759 if (tmp != NULL) { 759 if (tmp != NULL) {
760 intsize = *tmp; 760 intsize = *tmp;
761 break; 761 break;
@@ -779,7 +779,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
779 */ 779 */
780 old = of_node_get(ipar); 780 old = of_node_get(ipar);
781 do { 781 do {
782 tmp = get_property(old, "#address-cells", NULL); 782 tmp = of_get_property(old, "#address-cells", NULL);
783 tnode = of_get_parent(old); 783 tnode = of_get_parent(old);
784 of_node_put(old); 784 of_node_put(old);
785 old = tnode; 785 old = tnode;
@@ -795,7 +795,8 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
795 /* Now check if cursor is an interrupt-controller and if it is 795 /* Now check if cursor is an interrupt-controller and if it is
796 * then we are done 796 * then we are done
797 */ 797 */
798 if (get_property(ipar, "interrupt-controller", NULL) != NULL) { 798 if (of_get_property(ipar, "interrupt-controller", NULL) !=
799 NULL) {
799 DBG(" -> got it !\n"); 800 DBG(" -> got it !\n");
800 memcpy(out_irq->specifier, intspec, 801 memcpy(out_irq->specifier, intspec,
801 intsize * sizeof(u32)); 802 intsize * sizeof(u32));
@@ -806,7 +807,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
806 } 807 }
807 808
808 /* Now look for an interrupt-map */ 809 /* Now look for an interrupt-map */
809 imap = get_property(ipar, "interrupt-map", &imaplen); 810 imap = of_get_property(ipar, "interrupt-map", &imaplen);
810 /* No interrupt map, check for an interrupt parent */ 811 /* No interrupt map, check for an interrupt parent */
811 if (imap == NULL) { 812 if (imap == NULL) {
812 DBG(" -> no map, getting parent\n"); 813 DBG(" -> no map, getting parent\n");
@@ -816,7 +817,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
816 imaplen /= sizeof(u32); 817 imaplen /= sizeof(u32);
817 818
818 /* Look for a mask */ 819 /* Look for a mask */
819 imask = get_property(ipar, "interrupt-map-mask", NULL); 820 imask = of_get_property(ipar, "interrupt-map-mask", NULL);
820 821
821 /* If we were passed no "reg" property and we attempt to parse 822 /* If we were passed no "reg" property and we attempt to parse
822 * an interrupt-map, then #address-cells must be 0. 823 * an interrupt-map, then #address-cells must be 0.
@@ -863,15 +864,13 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
863 /* Get #interrupt-cells and #address-cells of new 864 /* Get #interrupt-cells and #address-cells of new
864 * parent 865 * parent
865 */ 866 */
866 tmp = get_property(newpar, "#interrupt-cells", 867 tmp = of_get_property(newpar, "#interrupt-cells", NULL);
867 NULL);
868 if (tmp == NULL) { 868 if (tmp == NULL) {
869 DBG(" -> parent lacks #interrupt-cells !\n"); 869 DBG(" -> parent lacks #interrupt-cells !\n");
870 goto fail; 870 goto fail;
871 } 871 }
872 newintsize = *tmp; 872 newintsize = *tmp;
873 tmp = get_property(newpar, "#address-cells", 873 tmp = of_get_property(newpar, "#address-cells", NULL);
874 NULL);
875 newaddrsize = (tmp == NULL) ? 0 : *tmp; 874 newaddrsize = (tmp == NULL) ? 0 : *tmp;
876 875
877 DBG(" -> newintsize=%d, newaddrsize=%d\n", 876 DBG(" -> newintsize=%d, newaddrsize=%d\n",
@@ -928,7 +927,7 @@ static int of_irq_map_oldworld(struct device_node *device, int index,
928 * everything together on these) 927 * everything together on these)
929 */ 928 */
930 while (device) { 929 while (device) {
931 ints = get_property(device, "AAPL,interrupts", &intlen); 930 ints = of_get_property(device, "AAPL,interrupts", &intlen);
932 if (ints != NULL) 931 if (ints != NULL)
933 break; 932 break;
934 device = device->parent; 933 device = device->parent;
@@ -970,13 +969,13 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq
970 return of_irq_map_oldworld(device, index, out_irq); 969 return of_irq_map_oldworld(device, index, out_irq);
971 970
972 /* Get the interrupts property */ 971 /* Get the interrupts property */
973 intspec = get_property(device, "interrupts", &intlen); 972 intspec = of_get_property(device, "interrupts", &intlen);
974 if (intspec == NULL) 973 if (intspec == NULL)
975 return -EINVAL; 974 return -EINVAL;
976 intlen /= sizeof(u32); 975 intlen /= sizeof(u32);
977 976
978 /* Get the reg property (if any) */ 977 /* Get the reg property (if any) */
979 addr = get_property(device, "reg", NULL); 978 addr = of_get_property(device, "reg", NULL);
980 979
981 /* Look for the interrupt parent. */ 980 /* Look for the interrupt parent. */
982 p = of_irq_find_parent(device); 981 p = of_irq_find_parent(device);
@@ -984,7 +983,7 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq
984 return -EINVAL; 983 return -EINVAL;
985 984
986 /* Get size of interrupt specifier */ 985 /* Get size of interrupt specifier */
987 tmp = get_property(p, "#interrupt-cells", NULL); 986 tmp = of_get_property(p, "#interrupt-cells", NULL);
988 if (tmp == NULL) { 987 if (tmp == NULL) {
989 of_node_put(p); 988 of_node_put(p);
990 return -EINVAL; 989 return -EINVAL;