# Algorithm to determine max. PCI bus number is incorrect

Reported by: Owned by: strauman Joel Sherrill highest 4.9.5 bsps 4.9 normal

The algorithm scans all PCI busses (0..ff)
and all devices (0..31) on each bus for bridges
and determines the maximum of all subordinate
busses encountered.

However, the algorithm does not scan all functions
present in multi-function devices -- I have a PCI express
root complex (82801H) where multiple (non-zero index)
functions are 'PCI bridges' whose subordinate bus number is
missed by the original algorithm.

The attached patch makes sure that the scan
is extended to all functions of multi-function
devices.

### Changed on 05/31/12 at 03:01:17 by strauman

fix for the reported bug

### comment:1 Changed on 05/31/12 at 03:01:17 by strauman

The algorithm scans all PCI busses (0..ff)
and all devices (0..31) on each bus for bridges
and determines the maximum of all subordinate
busses encountered.

However, the algorithm does not scan all functions
present in multi-function devices -- I have a PCI express
root complex (82801H) where multiple (non-zero index)
functions are 'PCI bridges' whose subordinate bus number is
missed by the original algorithm.

The attached patch makes sure that the scan
is extended to all functions of multi-function
devices.

### comment:2 Changed on 12/19/14 at 05:06:18 by Gedare Bloom

Priority: normal → highest

Bump priority to highest for tickets with a fix attached or seemingly simple fix proposed in the description or comments.

### comment:3 Changed on 12/24/14 at 03:29:57 by Till Strauman <strauman@…>

pc386: scan all functions of multi-function PCI devices

The current algorithm scans all PCI busses (0..ff)
and all devices (0..31) on each bus for bridges
and determines the maximum of all subordinate
busses encountered.

However, the algorithm does not scan all functions
present in multi-function devices -- I have a PCI express
root complex (82801H) where multiple (non-zero index)
functions are 'PCI bridges' whose subordinate bus number is
missed by the original algorithm.

This commit makes sure that the scan
is extended to all functions of multi-function
devices.

See #2067

### comment:4 Changed on 12/24/14 at 03:30:10 by Till Strauman <strauman@…>

pc386: scan all functions of multi-function PCI devices

The current algorithm scans all PCI busses (0..ff)
and all devices (0..31) on each bus for bridges
and determines the maximum of all subordinate
busses encountered.

However, the algorithm does not scan all functions
present in multi-function devices -- I have a PCI express
root complex (82801H) where multiple (non-zero index)
functions are 'PCI bridges' whose subordinate bus number is
missed by the original algorithm.

This commit makes sure that the scan
is extended to all functions of multi-function
devices.

See #2067

### comment:5 Changed on 12/24/14 at 03:30:27 by Till Strauman <strauman@…>

pc386: scan all functions of multi-function PCI devices

The current algorithm scans all PCI busses (0..ff)
and all devices (0..31) on each bus for bridges
and determines the maximum of all subordinate
busses encountered.

However, the algorithm does not scan all functions
present in multi-function devices -- I have a PCI express
root complex (82801H) where multiple (non-zero index)
functions are 'PCI bridges' whose subordinate bus number is
missed by the original algorithm.

This commit makes sure that the scan
is extended to all functions of multi-function
devices.

See #2067

### comment:6 Changed on 12/24/14 at 03:31:56 by Gedare Bloom

Description: modified (diff) → fixed new → closed

Patch reformatted to fix whitespace and applied to master and release branches 4.10 and 4.9

### comment:7 Changed on 12/24/14 at 03:44:45 by Gedare Bloom

Milestone: 4.11 → 4.9.5 4.10 → 4.9
Note: See TracTickets for help on using tickets.