xref: /reactos/drivers/bus/pcix/pci/busno.c (revision 8a978a17)
1 /*
2  * PROJECT:         ReactOS PCI Bus Driver
3  * LICENSE:         BSD - See COPYING.ARM in the top level directory
4  * FILE:            drivers/bus/pci/pci/busno.c
5  * PURPOSE:         Bus Number Management
6  * PROGRAMMERS:     ReactOS Portable Systems Group
7  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include <pci.h>
12 
13 #define NDEBUG
14 #include <debug.h>
15 
16 /* FUNCTIONS ******************************************************************/
17 
18 BOOLEAN
19 NTAPI
20 PciAreBusNumbersConfigured(IN PPCI_PDO_EXTENSION PdoExtension)
21 {
22     UCHAR PrimaryBus, BaseBus, SecondaryBus, SubordinateBus;
23 
24     PAGED_CODE();
25 
26     /* Get all relevant bus number details */
27     PrimaryBus = PdoExtension->Dependent.type1.PrimaryBus;
28     BaseBus = PdoExtension->ParentFdoExtension->BaseBus;
29     SecondaryBus = PdoExtension->Dependent.type1.SecondaryBus;
30     SubordinateBus = PdoExtension->Dependent.type1.SubordinateBus;
31 
32     /* The primary bus should be the base bus of the parent */
33     if ((PrimaryBus != BaseBus) || (SecondaryBus <= PrimaryBus)) return FALSE;
34 
35     /* The subordinate should be a higher bus number than the secondary */
36     return SubordinateBus >= SecondaryBus;
37 }
38 
39 /* EOF */
40