Lines Matching refs:res

467 	struct resource_node *res = NULL;  in update_resources()  local
473 res = bus_cur->firstMem; in update_resources()
477 res = bus_cur->firstPFMem; in update_resources()
481 res = bus_cur->firstIO; in update_resources()
485 if (res) { in update_resources()
486 while (res) { in update_resources()
487 if (res->rangeno == rangeno) in update_resources()
489 if (res->next) in update_resources()
490 res = res->next; in update_resources()
491 else if (res->nextRange) in update_resources()
492 res = res->nextRange; in update_resources()
501 while (res) { in update_resources()
502 ++res->rangeno; in update_resources()
503 res = res->next; in update_resources()
509 static void fix_me (struct resource_node *res, struct bus_node *bus_cur, struct range_node *range) in fix_me() argument
512 switch (res->type) { in fix_me()
524 while (res) { in fix_me()
525 if (res->rangeno == -1) { in fix_me()
527 if ((res->start >= range->start) && (res->end <= range->end)) { in fix_me()
528 res->rangeno = range->rangeno; in fix_me()
529 debug ("%s->rangeno in fix_resources is %d\n", str, res->rangeno); in fix_me()
530 switch (res->type) { in fix_me()
546 if (res->next) in fix_me()
547 res = res->next; in fix_me()
549 res = res->nextRange; in fix_me()
567 struct resource_node *res; in fix_resources() local
572 res = bus_cur->firstIO; in fix_resources()
574 fix_me (res, bus_cur, range); in fix_resources()
577 res = bus_cur->firstMem; in fix_resources()
579 fix_me (res, bus_cur, range); in fix_resources()
582 res = bus_cur->firstPFMem; in fix_resources()
584 fix_me (res, bus_cur, range); in fix_resources()
597 int ibmphp_add_resource (struct resource_node *res) in ibmphp_add_resource() argument
607 if (!res) { in ibmphp_add_resource()
612 bus_cur = find_bus_wprev (res->busno, NULL, 0); in ibmphp_add_resource()
621 switch (res->type) { in ibmphp_add_resource()
639 if ((res->start >= range_cur->start) && (res->end <= range_cur->end)) { in ibmphp_add_resource()
640 res->rangeno = range_cur->rangeno; in ibmphp_add_resource()
652 switch (res->type) { in ibmphp_add_resource()
663 res->rangeno = -1; in ibmphp_add_resource()
666 debug ("The range is %d\n", res->rangeno); in ibmphp_add_resource()
669 switch (res->type) { in ibmphp_add_resource()
671 bus_cur->firstIO = res; in ibmphp_add_resource()
674 bus_cur->firstMem = res; in ibmphp_add_resource()
677 bus_cur->firstPFMem = res; in ibmphp_add_resource()
680 res->next = NULL; in ibmphp_add_resource()
681 res->nextRange = NULL; in ibmphp_add_resource()
689 if (res_cur->rangeno >= res->rangeno) in ibmphp_add_resource()
700 debug ("i should be here, [%x - %x]\n", res->start, res->end); in ibmphp_add_resource()
701 res_prev->nextRange = res; in ibmphp_add_resource()
702 res->next = NULL; in ibmphp_add_resource()
703 res->nextRange = NULL; in ibmphp_add_resource()
704 } else if (res_cur->rangeno == res->rangeno) { in ibmphp_add_resource()
707 if (res->start < res_cur->start) in ibmphp_add_resource()
714 res_prev->next = res; in ibmphp_add_resource()
715 res->next = NULL; in ibmphp_add_resource()
716 res->nextRange = res_prev->nextRange; in ibmphp_add_resource()
718 } else if (res->start < res_cur->start) { in ibmphp_add_resource()
721 switch (res->type) { in ibmphp_add_resource()
723 bus_cur->firstIO = res; in ibmphp_add_resource()
726 bus_cur->firstMem = res; in ibmphp_add_resource()
729 bus_cur->firstPFMem = res; in ibmphp_add_resource()
733 res_prev->next = res; in ibmphp_add_resource()
735 res_prev->nextRange = res; in ibmphp_add_resource()
737 res->next = res_cur; in ibmphp_add_resource()
738 res->nextRange = NULL; in ibmphp_add_resource()
744 res->next = NULL; in ibmphp_add_resource()
745 switch (res->type) { in ibmphp_add_resource()
747 res->nextRange = bus_cur->firstIO; in ibmphp_add_resource()
748 bus_cur->firstIO = res; in ibmphp_add_resource()
751 res->nextRange = bus_cur->firstMem; in ibmphp_add_resource()
752 bus_cur->firstMem = res; in ibmphp_add_resource()
755 res->nextRange = bus_cur->firstPFMem; in ibmphp_add_resource()
756 bus_cur->firstPFMem = res; in ibmphp_add_resource()
759 } else if (res_cur->rangeno > res->rangeno) { in ibmphp_add_resource()
761 res_prev->nextRange = res; in ibmphp_add_resource()
762 res->next = NULL; in ibmphp_add_resource()
763 res->nextRange = res_cur; in ibmphp_add_resource()
779 int ibmphp_remove_resource (struct resource_node *res) in ibmphp_remove_resource() argument
787 if (!res) { in ibmphp_remove_resource()
792 bus_cur = find_bus_wprev (res->busno, NULL, 0); in ibmphp_remove_resource()
799 switch (res->type) { in ibmphp_remove_resource()
819 if ((res_cur->start == res->start) && (res_cur->end == res->end)) in ibmphp_remove_resource()
829 if (res->type == PFMEM) { in ibmphp_remove_resource()
839 if ((res_cur->start == res->start) && (res_cur->end == res->end)) { in ibmphp_remove_resource()
881 switch (res->type) { in ibmphp_remove_resource()
893 switch (res->type) { in ibmphp_remove_resource()
905 switch (res->type) { in ibmphp_remove_resource()
939 static struct range_node *find_range (struct bus_node *bus_cur, struct resource_node *res) in find_range() argument
943 switch (res->type) { in find_range()
958 if (res->rangeno == range->rangeno) in find_range()
974 int ibmphp_check_resource (struct resource_node *res, u8 bridge) in ibmphp_check_resource() argument
986 if (!res) in ibmphp_check_resource()
991 if (res->type == IO) in ibmphp_check_resource()
996 tmp_divide = res->len; in ibmphp_check_resource()
998 bus_cur = find_bus_wprev (res->busno, NULL, 0); in ibmphp_check_resource()
1011 res->len -= 1; in ibmphp_check_resource()
1013 switch (res->type) { in ibmphp_check_resource()
1046 if ((res_cur->start != range->start) && (len_tmp >= res->len)) { in ibmphp_check_resource()
1061 while ((len_tmp = res_cur->start - 1 - tmp_start) >= res->len) { in ibmphp_check_resource()
1074 if (flag && len_cur == res->len) { in ibmphp_check_resource()
1076 res->start = start_cur; in ibmphp_check_resource()
1077 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1078 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1088 if ((range->end != res_cur->end) && (len_tmp >= res->len)) { in ibmphp_check_resource()
1102 while ((len_tmp = range->end - tmp_start) >= res->len) { in ibmphp_check_resource()
1114 if (flag && len_cur == res->len) { in ibmphp_check_resource()
1115 res->start = start_cur; in ibmphp_check_resource()
1116 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1117 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1129 if ((res_cur->start != range->start) && (len_tmp >= res->len)) { in ibmphp_check_resource()
1141 while ((len_tmp = res_cur->start - 1 - tmp_start) >= res->len) { in ibmphp_check_resource()
1154 if (flag && len_cur == res->len) { in ibmphp_check_resource()
1155 res->start = start_cur; in ibmphp_check_resource()
1156 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1157 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1166 if (len_tmp >= res->len) { in ibmphp_check_resource()
1178 while ((len_tmp = res_cur->start - 1 - tmp_start) >= res->len) { in ibmphp_check_resource()
1191 if (flag && len_cur == res->len) { in ibmphp_check_resource()
1192 res->start = start_cur; in ibmphp_check_resource()
1193 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1194 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1213 switch (res->type) { in ibmphp_check_resource()
1227 if (len_tmp >= res->len) { in ibmphp_check_resource()
1239 while ((len_tmp = range->end - tmp_start) >= res->len) { in ibmphp_check_resource()
1252 if (flag && len_cur == res->len) { in ibmphp_check_resource()
1253 res->start = start_cur; in ibmphp_check_resource()
1254 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1255 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1268 res->start = start_cur; in ibmphp_check_resource()
1269 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1270 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1279 switch (res->type) { in ibmphp_check_resource()
1293 if (len_tmp >= res->len) { in ibmphp_check_resource()
1305 while ((len_tmp = range->end - tmp_start) >= res->len) { in ibmphp_check_resource()
1318 if (flag && len_cur == res->len) { in ibmphp_check_resource()
1319 res->start = start_cur; in ibmphp_check_resource()
1320 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1321 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1334 res->start = start_cur; in ibmphp_check_resource()
1335 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1336 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1342 res->start = start_cur; in ibmphp_check_resource()
1343 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1344 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1450 struct resource_node *res = NULL; in remove_ranges() local
1455 if (ibmphp_find_resource (bus_prev, range_cur->start, &res, IO) < 0) in remove_ranges()
1457 ibmphp_remove_resource (res); in remove_ranges()
1469 if (ibmphp_find_resource (bus_prev, range_cur->start, &res, MEM) < 0) in remove_ranges()
1472 ibmphp_remove_resource (res); in remove_ranges()
1483 if (ibmphp_find_resource (bus_prev, range_cur->start, &res, PFMEM) < 0) in remove_ranges()
1486 ibmphp_remove_resource (res); in remove_ranges()
1501 int ibmphp_find_resource (struct bus_node *bus, u32 start_address, struct resource_node **res, int … in ibmphp_find_resource() argument
1531 *res = res_cur; in ibmphp_find_resource()
1545 *res = res_cur; in ibmphp_find_resource()
1560 if (*res) in ibmphp_find_resource()
1561 debug ("*res->start = %x\n", (*res)->start); in ibmphp_find_resource()
1790 struct resource_node *res; in ibmphp_print_test() local
1841 res = bus_cur->firstIO; in ibmphp_print_test()
1842 while (res) { in ibmphp_print_test()
1843 debug_pci ("The range # is %d\n", res->rangeno); in ibmphp_print_test()
1844 debug_pci ("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); in ibmphp_print_test()
1845 debug_pci ("[%x - %x], len=%x\n", res->start, res->end, res->len); in ibmphp_print_test()
1846 if (res->next) in ibmphp_print_test()
1847 res = res->next; in ibmphp_print_test()
1848 else if (res->nextRange) in ibmphp_print_test()
1849 res = res->nextRange; in ibmphp_print_test()
1856 res = bus_cur->firstMem; in ibmphp_print_test()
1857 while (res) { in ibmphp_print_test()
1858 debug_pci ("The range # is %d\n", res->rangeno); in ibmphp_print_test()
1859 debug_pci ("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); in ibmphp_print_test()
1860 debug_pci ("[%x - %x], len=%x\n", res->start, res->end, res->len); in ibmphp_print_test()
1861 if (res->next) in ibmphp_print_test()
1862 res = res->next; in ibmphp_print_test()
1863 else if (res->nextRange) in ibmphp_print_test()
1864 res = res->nextRange; in ibmphp_print_test()
1871 res = bus_cur->firstPFMem; in ibmphp_print_test()
1872 while (res) { in ibmphp_print_test()
1873 debug_pci ("The range # is %d\n", res->rangeno); in ibmphp_print_test()
1874 debug_pci ("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); in ibmphp_print_test()
1875 debug_pci ("[%x - %x], len=%x\n", res->start, res->end, res->len); in ibmphp_print_test()
1876 if (res->next) in ibmphp_print_test()
1877 res = res->next; in ibmphp_print_test()
1878 else if (res->nextRange) in ibmphp_print_test()
1879 res = res->nextRange; in ibmphp_print_test()
1887 res = bus_cur->firstPFMemFromMem; in ibmphp_print_test()
1888 while (res) { in ibmphp_print_test()
1889 debug_pci ("The range # is %d\n", res->rangeno); in ibmphp_print_test()
1890 debug_pci ("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); in ibmphp_print_test()
1891 debug_pci ("[%x - %x], len=%x\n", res->start, res->end, res->len); in ibmphp_print_test()
1892 res = res->next; in ibmphp_print_test()