mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 06:02:44 +00:00 
			
		
		
		
	Kernel: Fix PCI bridge enumeration
The enumeration code is already enumerating all buses, recursively enumerating bridges (which are buses) makes devices on bridges being enumerated multiple times. Also, the PCI code was incorrectly mixing up terminology; let's settle down on bus, device and function because ever since PCIe came along "slots" isn't really a thing anymore.
This commit is contained in:
		
							parent
							
								
									34508c0b01
								
							
						
					
					
						commit
						06d76a4717
					
				
					 6 changed files with 42 additions and 42 deletions
				
			
		|  | @ -91,15 +91,15 @@ void IOAccess::enumerate_hardware(Function<void(Address, ID)> callback) | |||
| #endif | ||||
|     // Single PCI host controller.
 | ||||
|     if ((read8_field(Address(), PCI_HEADER_TYPE) & 0x80) == 0) { | ||||
|         enumerate_bus(-1, 0, callback); | ||||
|         enumerate_bus(-1, 0, callback, true); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     // Multiple PCI host controllers.
 | ||||
|     for (u8 function = 0; function < 8; ++function) { | ||||
|         if (read16_field(Address(0, 0, 0, function), PCI_VENDOR_ID) == PCI_NONE) | ||||
|     for (int bus = 0; bus < 256; ++bus) { | ||||
|         if (read16_field(Address(0, 0, 0, bus), PCI_VENDOR_ID) == PCI_NONE) | ||||
|             break; | ||||
|         enumerate_bus(-1, function, callback); | ||||
|         enumerate_bus(-1, bus, callback, false); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jean-Baptiste Boric
						Jean-Baptiste Boric