Lines Matching refs:count
342 int count; in configure_device() local
355 for (count = 0; address[count]; count++) { /* for 6 BARs */ in configure_device()
370 pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); in configure_device()
371 pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); in configure_device()
373 if (!bar[count]) /* This BAR is not implemented */ in configure_device()
376 debug("Device %x BAR %d wants %x\n", func->device, count, bar[count]); in configure_device()
378 if (bar[count] & PCI_BASE_ADDRESS_SPACE_IO) { in configure_device()
382 len[count] = bar[count] & 0xFFFFFFFC; in configure_device()
383 len[count] = ~len[count] + 1; in configure_device()
385 debug("len[count] in IO %x, count %d\n", len[count], count); in configure_device()
387 io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); in configure_device()
389 if (!io[count]) in configure_device()
392 io[count]->type = IO; in configure_device()
393 io[count]->busno = func->busno; in configure_device()
394 io[count]->devfunc = PCI_DEVFN(func->device, func->function); in configure_device()
395 io[count]->len = len[count]; in configure_device()
396 if (ibmphp_check_resource(io[count], 0) == 0) { in configure_device()
397 ibmphp_add_resource(io[count]); in configure_device()
398 func->io[count] = io[count]; in configure_device()
401 func->busno, func->device, func->function, len[count]); in configure_device()
402 kfree(io[count]); in configure_device()
405 pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->io[count]->start); in configure_device()
408 debug("b4 writing, the IO address is %x\n", func->io[count]->start); in configure_device()
409 pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); in configure_device()
410 debug("after writing.... the start address is %x\n", bar[count]); in configure_device()
415 if (bar[count] & PCI_BASE_ADDRESS_MEM_PREFETCH) { in configure_device()
419 len[count] = bar[count] & 0xFFFFFFF0; in configure_device()
420 len[count] = ~len[count] + 1; in configure_device()
422 debug("len[count] in PFMEM %x, count %d\n", len[count], count); in configure_device()
424 pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); in configure_device()
425 if (!pfmem[count]) in configure_device()
428 pfmem[count]->type = PFMEM; in configure_device()
429 pfmem[count]->busno = func->busno; in configure_device()
430 pfmem[count]->devfunc = PCI_DEVFN(func->device, in configure_device()
432 pfmem[count]->len = len[count]; in configure_device()
433 pfmem[count]->fromMem = 0; in configure_device()
434 if (ibmphp_check_resource(pfmem[count], 0) == 0) { in configure_device()
435 ibmphp_add_resource(pfmem[count]); in configure_device()
436 func->pfmem[count] = pfmem[count]; in configure_device()
440 kfree(pfmem[count]); in configure_device()
444 mem_tmp->busno = pfmem[count]->busno; in configure_device()
445 mem_tmp->devfunc = pfmem[count]->devfunc; in configure_device()
446 mem_tmp->len = pfmem[count]->len; in configure_device()
450 pfmem[count]->fromMem = 1; in configure_device()
451 pfmem[count]->rangeno = mem_tmp->rangeno; in configure_device()
452 pfmem[count]->start = mem_tmp->start; in configure_device()
453 pfmem[count]->end = mem_tmp->end; in configure_device()
454 ibmphp_add_pfmem_from_mem(pfmem[count]); in configure_device()
455 func->pfmem[count] = pfmem[count]; in configure_device()
458 func->busno, func->device, len[count]); in configure_device()
460 kfree(pfmem[count]); in configure_device()
465 pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->pfmem[count]->start); in configure_device()
468 debug("b4 writing, start address is %x\n", func->pfmem[count]->start); in configure_device()
469 pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); in configure_device()
470 debug("after writing, start address is %x\n", bar[count]); in configure_device()
473 if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { /* takes up another dword */ in configure_device()
474 debug("inside the mem 64 case, count %d\n", count); in configure_device()
475 count += 1; in configure_device()
477 pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0x00000000); in configure_device()
483 len[count] = bar[count] & 0xFFFFFFF0; in configure_device()
484 len[count] = ~len[count] + 1; in configure_device()
486 debug("len[count] in Mem %x, count %d\n", len[count], count); in configure_device()
488 mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); in configure_device()
489 if (!mem[count]) in configure_device()
492 mem[count]->type = MEM; in configure_device()
493 mem[count]->busno = func->busno; in configure_device()
494 mem[count]->devfunc = PCI_DEVFN(func->device, in configure_device()
496 mem[count]->len = len[count]; in configure_device()
497 if (ibmphp_check_resource(mem[count], 0) == 0) { in configure_device()
498 ibmphp_add_resource(mem[count]); in configure_device()
499 func->mem[count] = mem[count]; in configure_device()
502 func->busno, func->device, len[count]); in configure_device()
503 kfree(mem[count]); in configure_device()
506 pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->mem[count]->start); in configure_device()
508 debug("b4 writing, start address is %x\n", func->mem[count]->start); in configure_device()
509 pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); in configure_device()
510 debug("after writing, the address is %x\n", bar[count]); in configure_device()
513 if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { in configure_device()
515 debug("inside mem 64 case, reg. mem, count %d\n", count); in configure_device()
516 count += 1; in configure_device()
518 pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0x00000000); in configure_device()
545 int count; in configure_bridge() local
631 for (count = 0; address[count]; count++) { /* for 2 BARs */ in configure_bridge()
632 pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); in configure_bridge()
633 pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); in configure_bridge()
635 if (!bar[count]) { in configure_bridge()
637 debug("so we come here then, eh?, count = %d\n", count); in configure_bridge()
642 debug("Bar %d wants %x\n", count, bar[count]); in configure_bridge()
644 if (bar[count] & PCI_BASE_ADDRESS_SPACE_IO) { in configure_bridge()
646 len[count] = bar[count] & 0xFFFFFFFC; in configure_bridge()
647 len[count] = ~len[count] + 1; in configure_bridge()
649 debug("len[count] in IO = %x\n", len[count]); in configure_bridge()
651 bus_io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); in configure_bridge()
653 if (!bus_io[count]) { in configure_bridge()
657 bus_io[count]->type = IO; in configure_bridge()
658 bus_io[count]->busno = func->busno; in configure_bridge()
659 bus_io[count]->devfunc = PCI_DEVFN(func->device, in configure_bridge()
661 bus_io[count]->len = len[count]; in configure_bridge()
662 if (ibmphp_check_resource(bus_io[count], 0) == 0) { in configure_bridge()
663 ibmphp_add_resource(bus_io[count]); in configure_bridge()
664 func->io[count] = bus_io[count]; in configure_bridge()
667 func->busno, func->device, len[count]); in configure_bridge()
668 kfree(bus_io[count]); in configure_bridge()
672 pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->io[count]->start); in configure_bridge()
676 if (bar[count] & PCI_BASE_ADDRESS_MEM_PREFETCH) { in configure_bridge()
678 len[count] = bar[count] & 0xFFFFFFF0; in configure_bridge()
679 len[count] = ~len[count] + 1; in configure_bridge()
681 debug("len[count] in PFMEM = %x\n", len[count]); in configure_bridge()
683 bus_pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); in configure_bridge()
684 if (!bus_pfmem[count]) { in configure_bridge()
688 bus_pfmem[count]->type = PFMEM; in configure_bridge()
689 bus_pfmem[count]->busno = func->busno; in configure_bridge()
690 bus_pfmem[count]->devfunc = PCI_DEVFN(func->device, in configure_bridge()
692 bus_pfmem[count]->len = len[count]; in configure_bridge()
693 bus_pfmem[count]->fromMem = 0; in configure_bridge()
694 if (ibmphp_check_resource(bus_pfmem[count], 0) == 0) { in configure_bridge()
695 ibmphp_add_resource(bus_pfmem[count]); in configure_bridge()
696 func->pfmem[count] = bus_pfmem[count]; in configure_bridge()
704 mem_tmp->busno = bus_pfmem[count]->busno; in configure_bridge()
705 mem_tmp->devfunc = bus_pfmem[count]->devfunc; in configure_bridge()
706 mem_tmp->len = bus_pfmem[count]->len; in configure_bridge()
709 bus_pfmem[count]->fromMem = 1; in configure_bridge()
710 bus_pfmem[count]->rangeno = mem_tmp->rangeno; in configure_bridge()
711 ibmphp_add_pfmem_from_mem(bus_pfmem[count]); in configure_bridge()
712 func->pfmem[count] = bus_pfmem[count]; in configure_bridge()
715 func->busno, func->device, len[count]); in configure_bridge()
717 kfree(bus_pfmem[count]); in configure_bridge()
722 pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->pfmem[count]->start); in configure_bridge()
724 if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { in configure_bridge()
726 count += 1; in configure_bridge()
728 pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0x00000000); in configure_bridge()
733 len[count] = bar[count] & 0xFFFFFFF0; in configure_bridge()
734 len[count] = ~len[count] + 1; in configure_bridge()
736 debug("len[count] in Memory is %x\n", len[count]); in configure_bridge()
738 bus_mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); in configure_bridge()
739 if (!bus_mem[count]) { in configure_bridge()
743 bus_mem[count]->type = MEM; in configure_bridge()
744 bus_mem[count]->busno = func->busno; in configure_bridge()
745 bus_mem[count]->devfunc = PCI_DEVFN(func->device, in configure_bridge()
747 bus_mem[count]->len = len[count]; in configure_bridge()
748 if (ibmphp_check_resource(bus_mem[count], 0) == 0) { in configure_bridge()
749 ibmphp_add_resource(bus_mem[count]); in configure_bridge()
750 func->mem[count] = bus_mem[count]; in configure_bridge()
753 func->busno, func->device, len[count]); in configure_bridge()
754 kfree(bus_mem[count]); in configure_bridge()
758 pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->mem[count]->start); in configure_bridge()
760 if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { in configure_bridge()
762 count += 1; in configure_bridge()
764 pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0x00000000); in configure_bridge()
785 for (count = 0; address[count]; count++) { in configure_bridge()
787 if (bus_io[count]) { in configure_bridge()
788 ibmphp_remove_resource(bus_io[count]); in configure_bridge()
789 func->io[count] = NULL; in configure_bridge()
790 } else if (bus_pfmem[count]) { in configure_bridge()
791 ibmphp_remove_resource(bus_pfmem[count]); in configure_bridge()
792 func->pfmem[count] = NULL; in configure_bridge()
793 } else if (bus_mem[count]) { in configure_bridge()
794 ibmphp_remove_resource(bus_mem[count]); in configure_bridge()
795 func->mem[count] = NULL; in configure_bridge()
1048 int count, len[6]; in scan_behind_bridge() local
1109 for (count = 0; address[count]; count++) { in scan_behind_bridge()
1118 pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); in scan_behind_bridge()
1119 pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); in scan_behind_bridge()
1121 debug("what is bar[count]? %x, count = %d\n", bar[count], count); in scan_behind_bridge()
1123 if (!bar[count]) /* This BAR is not implemented */ in scan_behind_bridge()
1128 … debug("count %d device %x function %x wants %x resources\n", count, device, function, bar[count]); in scan_behind_bridge()
1130 if (bar[count] & PCI_BASE_ADDRESS_SPACE_IO) { in scan_behind_bridge()
1132 len[count] = bar[count] & 0xFFFFFFFC; in scan_behind_bridge()
1133 len[count] = ~len[count] + 1; in scan_behind_bridge()
1134 amount->io += len[count]; in scan_behind_bridge()
1137 if (bar[count] & PCI_BASE_ADDRESS_MEM_PREFETCH) { in scan_behind_bridge()
1139 len[count] = bar[count] & 0xFFFFFFF0; in scan_behind_bridge()
1140 len[count] = ~len[count] + 1; in scan_behind_bridge()
1141 amount->pfmem += len[count]; in scan_behind_bridge()
1142 if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) in scan_behind_bridge()
1144 count += 1; in scan_behind_bridge()
1148 len[count] = bar[count] & 0xFFFFFFF0; in scan_behind_bridge()
1149 len[count] = ~len[count] + 1; in scan_behind_bridge()
1150 amount->mem += len[count]; in scan_behind_bridge()
1151 if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { in scan_behind_bridge()
1153 count += 1; in scan_behind_bridge()
1194 int count; in unconfigure_boot_device() local
1215 for (count = 0; address[count]; count++) { /* for 6 BARs */ in unconfigure_boot_device()
1216 pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &start_address); in unconfigure_boot_device()
1220 pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); in unconfigure_boot_device()
1221 pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &size); in unconfigure_boot_device()
1222 pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], start_address); in unconfigure_boot_device()
1228 debug("is this bar no implemented?, count = %d\n", count); in unconfigure_boot_device()
1291 count += 1; in unconfigure_boot_device()
1305 int count; in unconfigure_boot_bridge() local
1354 for (count = 0; address[count]; count++) { in unconfigure_boot_bridge()
1356 pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &start_address); in unconfigure_boot_bridge()
1407 count += 1; in unconfigure_boot_bridge()
1534 int count; in ibmphp_unconfigure_card() local
1557 count = 2; in ibmphp_unconfigure_card()
1559 count = 6; in ibmphp_unconfigure_card()
1562 for (i = 0; i < count; i++) { in ibmphp_unconfigure_card()