Browse Source

[pci] Replace pci_max_bus() with pci_num_bus()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
abb5590b29

+ 5
- 5
src/arch/i386/interface/pcbios/pcibios.c View File

@@ -29,11 +29,11 @@ FILE_LICENCE ( GPL2_OR_LATER );
29 29
  */
30 30
 
31 31
 /**
32
- * Determine maximum PCI bus number within system
32
+ * Determine number of PCI buses within system
33 33
  *
34
- * @ret max_bus		Maximum bus number
34
+ * @ret num_bus		Number of buses
35 35
  */
36
-static int pcibios_max_bus ( void ) {
36
+static int pcibios_num_bus ( void ) {
37 37
 	int discard_a, discard_D;
38 38
 	uint8_t max_bus;
39 39
 
@@ -48,7 +48,7 @@ static int pcibios_max_bus ( void ) {
48 48
 				 "D" ( 0 )
49 49
 			       : "ebx", "edx" );
50 50
 
51
-	return max_bus;
51
+	return ( max_bus + 1 );
52 52
 }
53 53
 
54 54
 /**
@@ -105,7 +105,7 @@ int pcibios_write ( struct pci_device *pci, uint32_t command, uint32_t value ){
105 105
 	return ( ( status >> 8 ) & 0xff );
106 106
 }
107 107
 
108
-PROVIDE_PCIAPI ( pcbios, pci_max_bus, pcibios_max_bus );
108
+PROVIDE_PCIAPI ( pcbios, pci_num_bus, pcibios_num_bus );
109 109
 PROVIDE_PCIAPI_INLINE ( pcbios, pci_read_config_byte );
110 110
 PROVIDE_PCIAPI_INLINE ( pcbios, pci_read_config_word );
111 111
 PROVIDE_PCIAPI_INLINE ( pcbios, pci_read_config_dword );

+ 1
- 1
src/arch/x86/core/pcidirect.c View File

@@ -38,7 +38,7 @@ void pcidirect_prepare ( struct pci_device *pci, int where ) {
38 38
 	       PCIDIRECT_CONFIG_ADDRESS );
39 39
 }
40 40
 
41
-PROVIDE_PCIAPI_INLINE ( direct, pci_max_bus );
41
+PROVIDE_PCIAPI_INLINE ( direct, pci_num_bus );
42 42
 PROVIDE_PCIAPI_INLINE ( direct, pci_read_config_byte );
43 43
 PROVIDE_PCIAPI_INLINE ( direct, pci_read_config_word );
44 44
 PROVIDE_PCIAPI_INLINE ( direct, pci_read_config_dword );

+ 4
- 4
src/arch/x86/include/ipxe/pcidirect.h View File

@@ -26,14 +26,14 @@ struct pci_device;
26 26
 extern void pcidirect_prepare ( struct pci_device *pci, int where );
27 27
 
28 28
 /**
29
- * Determine maximum PCI bus number within system
29
+ * Determine number of PCI buses within system
30 30
  *
31
- * @ret max_bus		Maximum bus number
31
+ * @ret num_bus		Number of buses
32 32
  */
33 33
 static inline __always_inline int
34
-PCIAPI_INLINE ( direct, pci_max_bus ) ( void ) {
34
+PCIAPI_INLINE ( direct, pci_num_bus ) ( void ) {
35 35
 	/* No way to work this out via Type 1 accesses */
36
-	return 0xff;
36
+	return 0x100;
37 37
 }
38 38
 
39 39
 /**

+ 1
- 1
src/drivers/bus/pci.c View File

@@ -234,7 +234,7 @@ static int pcibus_probe ( struct root_device *rootdev ) {
234 234
 	uint32_t tmp;
235 235
 	int rc;
236 236
 
237
-	num_bus = ( pci_max_bus() + 1 );
237
+	num_bus = pci_num_bus();
238 238
 	for ( busdevfn = 0 ; busdevfn < PCI_BUSDEVFN ( num_bus, 0, 0 ) ;
239 239
 	      busdevfn++ ) {
240 240
 

+ 4
- 4
src/include/ipxe/efi/efi_pci.h View File

@@ -33,14 +33,14 @@ extern int efipci_write ( struct pci_device *pci, unsigned long location,
33 33
 			  unsigned long value );
34 34
 
35 35
 /**
36
- * Determine maximum PCI bus number within system
36
+ * Determine number of PCI buses within system
37 37
  *
38
- * @ret max_bus		Maximum bus number
38
+ * @ret num_bus		Number of buses
39 39
  */
40 40
 static inline __always_inline int
41
-PCIAPI_INLINE ( efi, pci_max_bus ) ( void ) {
41
+PCIAPI_INLINE ( efi, pci_num_bus ) ( void ) {
42 42
 	/* No way to work this out via EFI */
43
-	return 0xff;
43
+	return 0x100;
44 44
 }
45 45
 
46 46
 /**

+ 3
- 3
src/include/ipxe/pci_io.h View File

@@ -49,11 +49,11 @@ FILE_LICENCE ( GPL2_OR_LATER );
49 49
 #include <bits/pci_io.h>
50 50
 
51 51
 /**
52
- * Determine maximum PCI bus number within system
52
+ * Determine number of PCI buses within system
53 53
  *
54
- * @ret max_bus		Maximum bus number
54
+ * @ret num_bus		Number of buses
55 55
  */
56
-int pci_max_bus ( void );
56
+int pci_num_bus ( void );
57 57
 
58 58
 /**
59 59
  * Read byte from PCI configuration space

+ 1
- 1
src/interface/efi/efi_pci.c View File

@@ -73,7 +73,7 @@ int efipci_write ( struct pci_device *pci, unsigned long location,
73 73
 	return 0;
74 74
 }
75 75
 
76
-PROVIDE_PCIAPI_INLINE ( efi, pci_max_bus );
76
+PROVIDE_PCIAPI_INLINE ( efi, pci_num_bus );
77 77
 PROVIDE_PCIAPI_INLINE ( efi, pci_read_config_byte );
78 78
 PROVIDE_PCIAPI_INLINE ( efi, pci_read_config_word );
79 79
 PROVIDE_PCIAPI_INLINE ( efi, pci_read_config_dword );

Loading…
Cancel
Save