PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr)

{

    int dom, bus;

    unsigned slot;



    assert(!root->parent_dev);



    if (!root) {

        fprintf(stderr, "No primary PCI bus\n");

        return NULL;

    }



    if (!devaddr) {

        *devfnp = -1;

        return pci_find_bus_nr(root, 0);

    }



    if (pci_parse_devaddr(devaddr, &dom, &bus, &slot, NULL) < 0) {

        return NULL;

    }



    if (dom != 0) {

        fprintf(stderr, "No support for non-zero PCI domains\n");

        return NULL;

    }



    *devfnp = PCI_DEVFN(slot, 0);

    return pci_find_bus_nr(root, bus);

}

PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr)

{

    int dom, bus;

    unsigned slot;



    assert(!root->parent_dev);



    if (!root) {

        fprintf(stderr, "No primary PCI bus\n");

        return NULL;

    }



    if (!devaddr) {

        *devfnp = -1;

        return pci_find_bus_nr(root, 0);

    }



    if (pci_parse_devaddr(devaddr, &dom, &bus, &slot, NULL) < 0) {

        return NULL;

    }



    if (dom != 0) {

        fprintf(stderr, "No support for non-zero PCI domains\n");

        return NULL;

    }



    *devfnp = PCI_DEVFN(slot, 0);

    return pci_find_bus_nr(root, bus);

}

    assert(!root->parent_dev);
PCIBus *FUNC_0(int *devfnp, PCIBus *root, const char *devaddr)

{

    int VAR_0, VAR_1;

    unsigned VAR_2;



    assert(!root->parent_dev);



    if (!root) {

        fprintf(stderr, "No primary PCI VAR_1\n");

        return NULL;

    }



    if (!devaddr) {

        *devfnp = -1;

        return pci_find_bus_nr(root, 0);

    }



    if (pci_parse_devaddr(devaddr, &VAR_0, &VAR_1, &VAR_2, NULL) < 0) {

        return NULL;

    }



    if (VAR_0 != 0) {

        fprintf(stderr, "No support for non-zero PCI domains\n");

        return NULL;

    }



    *devfnp = PCI_DEVFN(VAR_2, 0);

    return pci_find_bus_nr(root, VAR_1);

}

PCIBus *FUNC_0(int *devfnp, PCIBus *root, const char *devaddr)
{ int VAR_0, VAR_1; unsigned VAR_2; assert(!root->parent_dev); if (!root) { fprintf(stderr, "No primary PCI VAR_1\n"); return NULL; } if (!devaddr) { *devfnp = -1; return pci_find_bus_nr(root, 0); } if (pci_parse_devaddr(devaddr, &VAR_0, &VAR_1, &VAR_2, NULL) < 0) { return NULL; } if (VAR_0 != 0) { fprintf(stderr, "No support for non-zero PCI domains\n"); return NULL; } *devfnp = PCI_DEVFN(VAR_2, 0); return pci_find_bus_nr(root, VAR_1); }