Lines Matching refs:res

445 	struct resource_node *res = NULL;  in update_resources()  local
451 res = bus_cur->firstMem; in update_resources()
455 res = bus_cur->firstPFMem; in update_resources()
459 res = bus_cur->firstIO; in update_resources()
463 if (res) { in update_resources()
464 while (res) { in update_resources()
465 if (res->rangeno == rangeno) in update_resources()
467 if (res->next) in update_resources()
468 res = res->next; in update_resources()
469 else if (res->nextRange) in update_resources()
470 res = res->nextRange; in update_resources()
479 while (res) { in update_resources()
480 ++res->rangeno; in update_resources()
481 res = res->next; in update_resources()
487 static void fix_me(struct resource_node *res, struct bus_node *bus_cur, struct range_node *range) in fix_me() argument
490 switch (res->type) { in fix_me()
502 while (res) { in fix_me()
503 if (res->rangeno == -1) { in fix_me()
505 if ((res->start >= range->start) && (res->end <= range->end)) { in fix_me()
506 res->rangeno = range->rangeno; in fix_me()
507 debug("%s->rangeno in fix_resources is %d\n", str, res->rangeno); in fix_me()
508 switch (res->type) { in fix_me()
524 if (res->next) in fix_me()
525 res = res->next; in fix_me()
527 res = res->nextRange; in fix_me()
545 struct resource_node *res; in fix_resources() local
550 res = bus_cur->firstIO; in fix_resources()
552 fix_me(res, bus_cur, range); in fix_resources()
555 res = bus_cur->firstMem; in fix_resources()
557 fix_me(res, bus_cur, range); in fix_resources()
560 res = bus_cur->firstPFMem; in fix_resources()
562 fix_me(res, bus_cur, range); in fix_resources()
575 int ibmphp_add_resource(struct resource_node *res) in ibmphp_add_resource() argument
585 if (!res) { in ibmphp_add_resource()
590 bus_cur = find_bus_wprev(res->busno, NULL, 0); in ibmphp_add_resource()
599 switch (res->type) { in ibmphp_add_resource()
617 if ((res->start >= range_cur->start) && (res->end <= range_cur->end)) { in ibmphp_add_resource()
618 res->rangeno = range_cur->rangeno; in ibmphp_add_resource()
630 switch (res->type) { in ibmphp_add_resource()
641 res->rangeno = -1; in ibmphp_add_resource()
644 debug("The range is %d\n", res->rangeno); in ibmphp_add_resource()
647 switch (res->type) { in ibmphp_add_resource()
649 bus_cur->firstIO = res; in ibmphp_add_resource()
652 bus_cur->firstMem = res; in ibmphp_add_resource()
655 bus_cur->firstPFMem = res; in ibmphp_add_resource()
658 res->next = NULL; in ibmphp_add_resource()
659 res->nextRange = NULL; in ibmphp_add_resource()
667 if (res_cur->rangeno >= res->rangeno) in ibmphp_add_resource()
678 debug("i should be here, [%x - %x]\n", res->start, res->end); in ibmphp_add_resource()
679 res_prev->nextRange = res; in ibmphp_add_resource()
680 res->next = NULL; in ibmphp_add_resource()
681 res->nextRange = NULL; in ibmphp_add_resource()
682 } else if (res_cur->rangeno == res->rangeno) { in ibmphp_add_resource()
685 if (res->start < res_cur->start) in ibmphp_add_resource()
692 res_prev->next = res; in ibmphp_add_resource()
693 res->next = NULL; in ibmphp_add_resource()
694 res->nextRange = res_prev->nextRange; in ibmphp_add_resource()
696 } else if (res->start < res_cur->start) { in ibmphp_add_resource()
699 switch (res->type) { in ibmphp_add_resource()
701 bus_cur->firstIO = res; in ibmphp_add_resource()
704 bus_cur->firstMem = res; in ibmphp_add_resource()
707 bus_cur->firstPFMem = res; in ibmphp_add_resource()
711 res_prev->next = res; in ibmphp_add_resource()
713 res_prev->nextRange = res; in ibmphp_add_resource()
715 res->next = res_cur; in ibmphp_add_resource()
716 res->nextRange = NULL; in ibmphp_add_resource()
722 res->next = NULL; in ibmphp_add_resource()
723 switch (res->type) { in ibmphp_add_resource()
725 res->nextRange = bus_cur->firstIO; in ibmphp_add_resource()
726 bus_cur->firstIO = res; in ibmphp_add_resource()
729 res->nextRange = bus_cur->firstMem; in ibmphp_add_resource()
730 bus_cur->firstMem = res; in ibmphp_add_resource()
733 res->nextRange = bus_cur->firstPFMem; in ibmphp_add_resource()
734 bus_cur->firstPFMem = res; in ibmphp_add_resource()
737 } else if (res_cur->rangeno > res->rangeno) { in ibmphp_add_resource()
739 res_prev->nextRange = res; in ibmphp_add_resource()
740 res->next = NULL; in ibmphp_add_resource()
741 res->nextRange = res_cur; in ibmphp_add_resource()
757 int ibmphp_remove_resource(struct resource_node *res) in ibmphp_remove_resource() argument
765 if (!res) { in ibmphp_remove_resource()
770 bus_cur = find_bus_wprev(res->busno, NULL, 0); in ibmphp_remove_resource()
777 switch (res->type) { in ibmphp_remove_resource()
797 if ((res_cur->start == res->start) && (res_cur->end == res->end)) in ibmphp_remove_resource()
807 if (res->type == PFMEM) { in ibmphp_remove_resource()
817 if ((res_cur->start == res->start) && (res_cur->end == res->end)) { in ibmphp_remove_resource()
859 switch (res->type) { in ibmphp_remove_resource()
871 switch (res->type) { in ibmphp_remove_resource()
883 switch (res->type) { in ibmphp_remove_resource()
917 static struct range_node *find_range(struct bus_node *bus_cur, struct resource_node *res) in find_range() argument
921 switch (res->type) { in find_range()
936 if (res->rangeno == range->rangeno) in find_range()
952 int ibmphp_check_resource(struct resource_node *res, u8 bridge) in ibmphp_check_resource() argument
964 if (!res) in ibmphp_check_resource()
969 if (res->type == IO) in ibmphp_check_resource()
974 tmp_divide = res->len; in ibmphp_check_resource()
976 bus_cur = find_bus_wprev(res->busno, NULL, 0); in ibmphp_check_resource()
989 res->len -= 1; in ibmphp_check_resource()
991 switch (res->type) { in ibmphp_check_resource()
1024 if ((res_cur->start != range->start) && (len_tmp >= res->len)) { in ibmphp_check_resource()
1039 while ((len_tmp = res_cur->start - 1 - tmp_start) >= res->len) { in ibmphp_check_resource()
1052 if (flag && len_cur == res->len) { in ibmphp_check_resource()
1054 res->start = start_cur; in ibmphp_check_resource()
1055 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1056 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1066 if ((range->end != res_cur->end) && (len_tmp >= res->len)) { in ibmphp_check_resource()
1080 while ((len_tmp = range->end - tmp_start) >= res->len) { in ibmphp_check_resource()
1092 if (flag && len_cur == res->len) { in ibmphp_check_resource()
1093 res->start = start_cur; in ibmphp_check_resource()
1094 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1095 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1107 if ((res_cur->start != range->start) && (len_tmp >= res->len)) { in ibmphp_check_resource()
1119 while ((len_tmp = res_cur->start - 1 - tmp_start) >= res->len) { in ibmphp_check_resource()
1132 if (flag && len_cur == res->len) { in ibmphp_check_resource()
1133 res->start = start_cur; in ibmphp_check_resource()
1134 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1135 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1144 if (len_tmp >= res->len) { in ibmphp_check_resource()
1156 while ((len_tmp = res_cur->start - 1 - tmp_start) >= res->len) { in ibmphp_check_resource()
1169 if (flag && len_cur == res->len) { in ibmphp_check_resource()
1170 res->start = start_cur; in ibmphp_check_resource()
1171 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1172 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1191 switch (res->type) { in ibmphp_check_resource()
1205 if (len_tmp >= res->len) { in ibmphp_check_resource()
1217 while ((len_tmp = range->end - tmp_start) >= res->len) { in ibmphp_check_resource()
1230 if (flag && len_cur == res->len) { in ibmphp_check_resource()
1231 res->start = start_cur; in ibmphp_check_resource()
1232 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1233 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1246 res->start = start_cur; in ibmphp_check_resource()
1247 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1248 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1257 switch (res->type) { in ibmphp_check_resource()
1271 if (len_tmp >= res->len) { in ibmphp_check_resource()
1283 while ((len_tmp = range->end - tmp_start) >= res->len) { in ibmphp_check_resource()
1296 if (flag && len_cur == res->len) { in ibmphp_check_resource()
1297 res->start = start_cur; in ibmphp_check_resource()
1298 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1299 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1312 res->start = start_cur; in ibmphp_check_resource()
1313 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1314 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1320 res->start = start_cur; in ibmphp_check_resource()
1321 res->len += 1; /* To restore the balance */ in ibmphp_check_resource()
1322 res->end = res->start + res->len - 1; in ibmphp_check_resource()
1428 struct resource_node *res = NULL; in remove_ranges() local
1433 if (ibmphp_find_resource(bus_prev, range_cur->start, &res, IO) < 0) in remove_ranges()
1435 ibmphp_remove_resource(res); in remove_ranges()
1447 if (ibmphp_find_resource(bus_prev, range_cur->start, &res, MEM) < 0) in remove_ranges()
1450 ibmphp_remove_resource(res); in remove_ranges()
1461 if (ibmphp_find_resource(bus_prev, range_cur->start, &res, PFMEM) < 0) in remove_ranges()
1464 ibmphp_remove_resource(res); in remove_ranges()
1479 int ibmphp_find_resource(struct bus_node *bus, u32 start_address, struct resource_node **res, int f… in ibmphp_find_resource() argument
1509 *res = res_cur; in ibmphp_find_resource()
1523 *res = res_cur; in ibmphp_find_resource()
1538 if (*res) in ibmphp_find_resource()
1539 debug("*res->start = %x\n", (*res)->start); in ibmphp_find_resource()
1758 struct resource_node *res; in ibmphp_print_test() local
1807 res = bus_cur->firstIO; in ibmphp_print_test()
1808 while (res) { in ibmphp_print_test()
1809 debug_pci("The range # is %d\n", res->rangeno); in ibmphp_print_test()
1810 debug_pci("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); in ibmphp_print_test()
1811 debug_pci("[%x - %x], len=%x\n", res->start, res->end, res->len); in ibmphp_print_test()
1812 if (res->next) in ibmphp_print_test()
1813 res = res->next; in ibmphp_print_test()
1814 else if (res->nextRange) in ibmphp_print_test()
1815 res = res->nextRange; in ibmphp_print_test()
1822 res = bus_cur->firstMem; in ibmphp_print_test()
1823 while (res) { in ibmphp_print_test()
1824 debug_pci("The range # is %d\n", res->rangeno); in ibmphp_print_test()
1825 debug_pci("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); in ibmphp_print_test()
1826 debug_pci("[%x - %x], len=%x\n", res->start, res->end, res->len); in ibmphp_print_test()
1827 if (res->next) in ibmphp_print_test()
1828 res = res->next; in ibmphp_print_test()
1829 else if (res->nextRange) in ibmphp_print_test()
1830 res = res->nextRange; in ibmphp_print_test()
1837 res = bus_cur->firstPFMem; in ibmphp_print_test()
1838 while (res) { in ibmphp_print_test()
1839 debug_pci("The range # is %d\n", res->rangeno); in ibmphp_print_test()
1840 debug_pci("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); in ibmphp_print_test()
1841 debug_pci("[%x - %x], len=%x\n", res->start, res->end, res->len); in ibmphp_print_test()
1842 if (res->next) in ibmphp_print_test()
1843 res = res->next; in ibmphp_print_test()
1844 else if (res->nextRange) in ibmphp_print_test()
1845 res = res->nextRange; in ibmphp_print_test()
1853 res = bus_cur->firstPFMemFromMem; in ibmphp_print_test()
1854 while (res) { in ibmphp_print_test()
1855 debug_pci("The range # is %d\n", res->rangeno); in ibmphp_print_test()
1856 debug_pci("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); in ibmphp_print_test()
1857 debug_pci("[%x - %x], len=%x\n", res->start, res->end, res->len); in ibmphp_print_test()
1858 res = res->next; in ibmphp_print_test()