Lines Matching refs:bus_cur

25 static void update_resources(struct bus_node *bus_cur, int type, int rangeno);
185 struct bus_node *bus_cur; in ibmphp_rsrc_init() local
212 bus_cur = find_bus_wprev(curr->bus_num, &bus_prev, 1); in ibmphp_rsrc_init()
214 if (bus_cur) { in ibmphp_rsrc_init()
215 rc = alloc_bus_range(&bus_cur, &newrange, curr, MEM, 0); in ibmphp_rsrc_init()
238 bus_cur = find_bus_wprev(curr->bus_num, &bus_prev, 1); in ibmphp_rsrc_init()
239 if (bus_cur) { in ibmphp_rsrc_init()
241 rc = alloc_bus_range(&bus_cur, &newrange, curr, PFMEM, 0); in ibmphp_rsrc_init()
263 bus_cur = find_bus_wprev(curr->bus_num, &bus_prev, 1); in ibmphp_rsrc_init()
264 if (bus_cur) { in ibmphp_rsrc_init()
265 rc = alloc_bus_range(&bus_cur, &newrange, curr, IO, 0); in ibmphp_rsrc_init()
351 list_for_each_entry(bus_cur, &gbuses, bus_list) { in ibmphp_rsrc_init()
353 rc = update_bridge_ranges(&bus_cur); in ibmphp_rsrc_init()
368 static int add_bus_range(int type, struct range_node *range, struct bus_node *bus_cur) in add_bus_range() argument
377 range_cur = bus_cur->rangeMem; in add_bus_range()
378 noRanges = bus_cur->noMemRanges; in add_bus_range()
381 range_cur = bus_cur->rangePFMem; in add_bus_range()
382 noRanges = bus_cur->noPFMemRanges; in add_bus_range()
385 range_cur = bus_cur->rangeIO; in add_bus_range()
386 noRanges = bus_cur->noIORanges; in add_bus_range()
402 bus_cur->rangeMem = range; in add_bus_range()
405 bus_cur->rangePFMem = range; in add_bus_range()
408 bus_cur->rangeIO = range; in add_bus_range()
433 update_resources(bus_cur, type, i_init + 1); in add_bus_range()
443 static void update_resources(struct bus_node *bus_cur, int type, int rangeno) in update_resources() argument
450 if (bus_cur->firstMem) in update_resources()
451 res = bus_cur->firstMem; in update_resources()
454 if (bus_cur->firstPFMem) in update_resources()
455 res = bus_cur->firstPFMem; in update_resources()
458 if (bus_cur->firstIO) in update_resources()
459 res = bus_cur->firstIO; 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
510 --bus_cur->needIOUpdate; in fix_me()
513 --bus_cur->needMemUpdate; in fix_me()
516 --bus_cur->needPFMemUpdate; in fix_me()
542 static void fix_resources(struct bus_node *bus_cur) in fix_resources() argument
547 debug("%s - bus_cur->busno = %d\n", __func__, bus_cur->busno); in fix_resources()
549 if (bus_cur->needIOUpdate) { in fix_resources()
550 res = bus_cur->firstIO; in fix_resources()
551 range = bus_cur->rangeIO; in fix_resources()
552 fix_me(res, bus_cur, range); in fix_resources()
554 if (bus_cur->needMemUpdate) { in fix_resources()
555 res = bus_cur->firstMem; in fix_resources()
556 range = bus_cur->rangeMem; in fix_resources()
557 fix_me(res, bus_cur, range); in fix_resources()
559 if (bus_cur->needPFMemUpdate) { in fix_resources()
560 res = bus_cur->firstPFMem; in fix_resources()
561 range = bus_cur->rangePFMem; in fix_resources()
562 fix_me(res, bus_cur, range); in fix_resources()
579 struct bus_node *bus_cur; in ibmphp_add_resource() local
590 bus_cur = find_bus_wprev(res->busno, NULL, 0); in ibmphp_add_resource()
592 if (!bus_cur) { in ibmphp_add_resource()
601 range_cur = bus_cur->rangeIO; in ibmphp_add_resource()
602 res_start = bus_cur->firstIO; in ibmphp_add_resource()
605 range_cur = bus_cur->rangeMem; in ibmphp_add_resource()
606 res_start = bus_cur->firstMem; in ibmphp_add_resource()
609 range_cur = bus_cur->rangePFMem; in ibmphp_add_resource()
610 res_start = bus_cur->firstPFMem; in ibmphp_add_resource()
632 ++bus_cur->needIOUpdate; in ibmphp_add_resource()
635 ++bus_cur->needMemUpdate; in ibmphp_add_resource()
638 ++bus_cur->needPFMemUpdate; 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()
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()
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()
759 struct bus_node *bus_cur; in ibmphp_remove_resource() local
770 bus_cur = find_bus_wprev(res->busno, NULL, 0); in ibmphp_remove_resource()
772 if (!bus_cur) { in ibmphp_remove_resource()
779 res_cur = bus_cur->firstIO; in ibmphp_remove_resource()
783 res_cur = bus_cur->firstMem; in ibmphp_remove_resource()
787 res_cur = bus_cur->firstPFMem; in ibmphp_remove_resource()
813 res_cur = bus_cur->firstPFMemFromMem; in ibmphp_remove_resource()
818 mem_cur = bus_cur->firstMem; in ibmphp_remove_resource()
835 bus_cur->firstPFMemFromMem = res_cur->next; in ibmphp_remove_resource()
861 bus_cur->firstIO = res_cur->next; in ibmphp_remove_resource()
864 bus_cur->firstMem = res_cur->next; in ibmphp_remove_resource()
867 bus_cur->firstPFMem = res_cur->next; in ibmphp_remove_resource()
873 bus_cur->firstIO = res_cur->nextRange; in ibmphp_remove_resource()
876 bus_cur->firstMem = res_cur->nextRange; in ibmphp_remove_resource()
879 bus_cur->firstPFMem = res_cur->nextRange; in ibmphp_remove_resource()
885 bus_cur->firstIO = NULL; in ibmphp_remove_resource()
888 bus_cur->firstMem = NULL; in ibmphp_remove_resource()
891 bus_cur->firstPFMem = NULL; in ibmphp_remove_resource()
917 static struct range_node *find_range(struct bus_node *bus_cur, struct resource_node *res) in find_range() argument
923 range = bus_cur->rangeIO; in find_range()
926 range = bus_cur->rangeMem; in find_range()
929 range = bus_cur->rangePFMem; in find_range()
954 struct bus_node *bus_cur; in ibmphp_check_resource() local
976 bus_cur = find_bus_wprev(res->busno, NULL, 0); in ibmphp_check_resource()
978 if (!bus_cur) { in ibmphp_check_resource()
985 debug("bus_cur->busno is %d\n", bus_cur->busno); in ibmphp_check_resource()
993 res_cur = bus_cur->firstIO; in ibmphp_check_resource()
994 noranges = bus_cur->noIORanges; in ibmphp_check_resource()
997 res_cur = bus_cur->firstMem; in ibmphp_check_resource()
998 noranges = bus_cur->noMemRanges; in ibmphp_check_resource()
1001 res_cur = bus_cur->firstPFMem; in ibmphp_check_resource()
1002 noranges = bus_cur->noPFMemRanges; in ibmphp_check_resource()
1011 range = find_range(bus_cur, res_cur); in ibmphp_check_resource()
1193 range = bus_cur->rangeIO; in ibmphp_check_resource()
1196 range = bus_cur->rangeMem; in ibmphp_check_resource()
1199 range = bus_cur->rangePFMem; in ibmphp_check_resource()
1259 range = bus_cur->rangeIO; in ibmphp_check_resource()
1262 range = bus_cur->rangeMem; in ibmphp_check_resource()
1265 range = bus_cur->rangePFMem; in ibmphp_check_resource()
1423 static int remove_ranges(struct bus_node *bus_cur, struct bus_node *bus_prev) in remove_ranges() argument
1430 if (bus_cur->noIORanges) { in remove_ranges()
1431 range_cur = bus_cur->rangeIO; in remove_ranges()
1432 for (i = 0; i < bus_cur->noIORanges; i++) { in remove_ranges()
1442 bus_cur->rangeIO = NULL; in remove_ranges()
1444 if (bus_cur->noMemRanges) { in remove_ranges()
1445 range_cur = bus_cur->rangeMem; in remove_ranges()
1446 for (i = 0; i < bus_cur->noMemRanges; i++) { in remove_ranges()
1456 bus_cur->rangeMem = NULL; in remove_ranges()
1458 if (bus_cur->noPFMemRanges) { in remove_ranges()
1459 range_cur = bus_cur->rangePFMem; in remove_ranges()
1460 for (i = 0; i < bus_cur->noPFMemRanges; i++) { in remove_ranges()
1470 bus_cur->rangePFMem = NULL; in remove_ranges()
1552 struct bus_node *bus_cur = NULL, *next; in ibmphp_free_resources() local
1561 list_for_each_entry_safe(bus_cur, next, &gbuses, bus_list) { in ibmphp_free_resources()
1562 if (bus_cur->noIORanges) { in ibmphp_free_resources()
1563 range_cur = bus_cur->rangeIO; in ibmphp_free_resources()
1564 for (i = 0; i < bus_cur->noIORanges; i++) { in ibmphp_free_resources()
1573 if (bus_cur->noMemRanges) { in ibmphp_free_resources()
1574 range_cur = bus_cur->rangeMem; in ibmphp_free_resources()
1575 for (i = 0; i < bus_cur->noMemRanges; i++) { in ibmphp_free_resources()
1584 if (bus_cur->noPFMemRanges) { in ibmphp_free_resources()
1585 range_cur = bus_cur->rangePFMem; in ibmphp_free_resources()
1586 for (i = 0; i < bus_cur->noPFMemRanges; i++) { in ibmphp_free_resources()
1596 if (bus_cur->firstIO) { in ibmphp_free_resources()
1597 res_cur = bus_cur->firstIO; in ibmphp_free_resources()
1607 bus_cur->firstIO = NULL; in ibmphp_free_resources()
1609 if (bus_cur->firstMem) { in ibmphp_free_resources()
1610 res_cur = bus_cur->firstMem; in ibmphp_free_resources()
1620 bus_cur->firstMem = NULL; in ibmphp_free_resources()
1622 if (bus_cur->firstPFMem) { in ibmphp_free_resources()
1623 res_cur = bus_cur->firstPFMem; in ibmphp_free_resources()
1633 bus_cur->firstPFMem = NULL; in ibmphp_free_resources()
1636 if (bus_cur->firstPFMemFromMem) { in ibmphp_free_resources()
1637 res_cur = bus_cur->firstPFMemFromMem; in ibmphp_free_resources()
1645 bus_cur->firstPFMemFromMem = NULL; in ibmphp_free_resources()
1648 bus_tmp = bus_cur; in ibmphp_free_resources()
1649 list_del(&bus_cur->bus_list); in ibmphp_free_resources()
1668 struct bus_node *bus_cur; in once_over() local
1670 list_for_each_entry(bus_cur, &gbuses, bus_list) { in once_over()
1671 if ((!bus_cur->rangePFMem) && (bus_cur->firstPFMem)) { in once_over()
1672 …for (pfmem_cur = bus_cur->firstPFMem, pfmem_prev = NULL; pfmem_cur; pfmem_prev = pfmem_cur, pfmem_… in once_over()
1677 bus_cur->firstPFMem = pfmem_cur->next; in once_over()
1679 if (!bus_cur->firstPFMemFromMem) in once_over()
1686 pfmem_cur->next = bus_cur->firstPFMemFromMem; in once_over()
1688 bus_cur->firstPFMemFromMem = pfmem_cur; in once_over()
1711 struct bus_node *bus_cur = find_bus_wprev(pfmem->busno, NULL, 0); in ibmphp_add_pfmem_from_mem() local
1713 if (!bus_cur) { in ibmphp_add_pfmem_from_mem()
1718 if (bus_cur->firstPFMemFromMem) in ibmphp_add_pfmem_from_mem()
1719 pfmem->next = bus_cur->firstPFMemFromMem; in ibmphp_add_pfmem_from_mem()
1723 bus_cur->firstPFMemFromMem = pfmem; in ibmphp_add_pfmem_from_mem()
1741 struct bus_node *bus_cur; in find_bus_wprev() local
1743 list_for_each_entry(bus_cur, &gbuses, bus_list) { in find_bus_wprev()
1745 *prev = list_prev_entry(bus_cur, bus_list); in find_bus_wprev()
1746 if (bus_cur->busno == bus_number) in find_bus_wprev()
1747 return bus_cur; in find_bus_wprev()
1756 struct bus_node *bus_cur = NULL; in ibmphp_print_test() local
1767 list_for_each_entry(bus_cur, &gbuses, bus_list) { in ibmphp_print_test()
1768 debug_pci ("This is bus # %d. There are\n", bus_cur->busno); in ibmphp_print_test()
1769 debug_pci ("IORanges = %d\t", bus_cur->noIORanges); in ibmphp_print_test()
1770 debug_pci ("MemRanges = %d\t", bus_cur->noMemRanges); in ibmphp_print_test()
1771 debug_pci ("PFMemRanges = %d\n", bus_cur->noPFMemRanges); in ibmphp_print_test()
1773 if (bus_cur->rangeIO) { in ibmphp_print_test()
1774 range = bus_cur->rangeIO; in ibmphp_print_test()
1775 for (i = 0; i < bus_cur->noIORanges; i++) { in ibmphp_print_test()
1783 if (bus_cur->rangeMem) { in ibmphp_print_test()
1784 range = bus_cur->rangeMem; in ibmphp_print_test()
1785 for (i = 0; i < bus_cur->noMemRanges; i++) { in ibmphp_print_test()
1794 if (bus_cur->rangePFMem) { in ibmphp_print_test()
1795 range = bus_cur->rangePFMem; in ibmphp_print_test()
1796 for (i = 0; i < bus_cur->noPFMemRanges; i++) { in ibmphp_print_test()
1806 if (bus_cur->firstIO) { in ibmphp_print_test()
1807 res = bus_cur->firstIO; in ibmphp_print_test()
1821 if (bus_cur->firstMem) { in ibmphp_print_test()
1822 res = bus_cur->firstMem; in ibmphp_print_test()
1836 if (bus_cur->firstPFMem) { in ibmphp_print_test()
1837 res = bus_cur->firstPFMem; in ibmphp_print_test()
1852 if (bus_cur->firstPFMemFromMem) { in ibmphp_print_test()
1853 res = bus_cur->firstPFMemFromMem; in ibmphp_print_test()
1865 static int range_exists_already(struct range_node *range, struct bus_node *bus_cur, u8 type) in range_exists_already() argument
1870 range_cur = bus_cur->rangeIO; in range_exists_already()
1873 range_cur = bus_cur->rangeMem; in range_exists_already()
1876 range_cur = bus_cur->rangePFMem; in range_exists_already()
1912 struct bus_node *bus_cur; in update_bridge_ranges() local
1919 bus_cur = *bus; in update_bridge_ranges()
1920 if (!bus_cur) in update_bridge_ranges()
1922 ibmphp_pci_bus->number = bus_cur->busno; in update_bridge_ranges()
1925 debug("bus_cur->busno = %x\n", bus_cur->busno); in update_bridge_ranges()
1995 if (ibmphp_find_resource(bus_cur, start_address, &io, IO)) { in update_bridge_ranges()
2002 io->busno = bus_cur->busno; in update_bridge_ranges()
2043 if (ibmphp_find_resource(bus_cur, start_address, &mem, MEM)) { in update_bridge_ranges()
2050 mem->busno = bus_cur->busno; in update_bridge_ranges()
2094 if (ibmphp_find_resource(bus_cur, start_address, &pfmem, PFMEM)) { in update_bridge_ranges()
2101 pfmem->busno = bus_cur->busno; in update_bridge_ranges()