Changeset 184f2f8a in mainline
- Timestamp:
- 2018-10-29T11:35:40Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b25970f, f5837524
- Parents:
- 889cdb1
- git-author:
- Jiri Svoboda <jiri@…> (2018-10-28 21:35:14)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-10-29 11:35:40)
- Location:
- uspace/drv/bus/pci/pciintel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/pci/pciintel/pci.c
r889cdb1 r184f2f8a 1 1 /* 2 2 * Copyright (c) 2010 Lenka Trochtova 3 * Copyright (c) 201 1Jiri Svoboda3 * Copyright (c) 2018 Jiri Svoboda 4 4 * All rights reserved. 5 5 * … … 596 596 * @param bus Host-to-PCI bridge 597 597 * @param bus_num Bus number 598 * 599 * @return EOK on success, ENOENT if no PCI devices found, ENOMEM if out of 600 * memory, EIO on other I/O error 598 601 */ 599 voidpci_bus_scan(pci_bus_t *bus, int bus_num)602 errno_t pci_bus_scan(pci_bus_t *bus, int bus_num) 600 603 { 601 604 pci_fun_t *fun; … … 606 609 bool multi; 607 610 uint8_t header_type; 611 bool device_found; 612 613 device_found = false; 608 614 609 615 for (dnum = 0; dnum < 32; dnum++) { … … 625 631 } 626 632 633 device_found = true; 634 627 635 header_type = pci_conf_read_8(fun, PCI_HEADER_TYPE); 628 636 if (fnum == 0) { … … 637 645 ddf_msg(LVL_ERROR, "Out of memory."); 638 646 pci_fun_delete(fun); 639 return ;647 return ENOMEM; 640 648 } 641 649 … … 645 653 ddf_msg(LVL_ERROR, "Failed setting function name."); 646 654 pci_fun_delete(fun); 647 return ;655 return EIO; 648 656 } 649 657 … … 661 669 662 670 pci_fun_create_match_ids(fun); 663 664 if (ddf_fun_bind(fun->fnode) != EOK) {665 pci_clean_resource_list(fun);666 pci_fun_delete(fun);667 continue;668 }669 671 670 672 if (header_type == PCI_HEADER_TYPE_BRIDGE || … … 675 677 "bridge, secondary bus number = %d.", 676 678 bus_num); 677 if (child_bus > bus_num) 678 pci_bus_scan(bus, child_bus); 679 if (child_bus > bus_num) { 680 rc = pci_bus_scan(bus, child_bus); 681 if (rc != EOK) { 682 pci_fun_delete(fun); 683 return rc; 684 } 685 } 686 } 687 688 if (ddf_fun_bind(fun->fnode) != EOK) { 689 pci_clean_resource_list(fun); 690 pci_fun_delete(fun); 691 continue; 679 692 } 680 693 } 681 694 } 695 696 /* Fail bus scan if no devices are found. */ 697 if (!device_found) 698 return ENOENT; 699 700 return EOK; 682 701 } 683 702 … … 783 802 } 784 803 804 /* Enumerate functions. */ 805 ddf_msg(LVL_DEBUG, "Enumerating the bus"); 806 rc = pci_bus_scan(bus, 0); 807 if (rc != EOK) { 808 ddf_msg(LVL_ERROR, "Bus enumeration failed."); 809 goto fail; 810 } 811 785 812 rc = ddf_fun_bind(ctl); 786 813 if (rc != EOK) { … … 788 815 goto fail; 789 816 } 790 791 /* Enumerate functions. */792 ddf_msg(LVL_DEBUG, "Scanning the bus");793 pci_bus_scan(bus, 0);794 817 795 818 hw_res_clean_resource_list(&hw_resources); -
uspace/drv/bus/pci/pciintel/pci.h
r889cdb1 r184f2f8a 90 90 extern char *pci_fun_create_name(pci_fun_t *); 91 91 92 extern voidpci_bus_scan(pci_bus_t *, int);92 extern errno_t pci_bus_scan(pci_bus_t *, int); 93 93 94 94 extern bool pci_alloc_resource_list(pci_fun_t *);
Note:
See TracChangeset
for help on using the changeset viewer.