mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 12:32:43 +00:00 
			
		
		
		
	Kernel/USB: Tighten up USBManagement enumeration code a bit
This commit is contained in:
		
							parent
							
								
									1479ee3f3e
								
							
						
					
					
						commit
						d16d116b65
					
				
					 1 changed files with 27 additions and 26 deletions
				
			
		|  | @ -22,38 +22,39 @@ UNMAP_AFTER_INIT USBManagement::USBManagement() | |||
| 
 | ||||
| UNMAP_AFTER_INIT void USBManagement::enumerate_controllers() | ||||
| { | ||||
|     if (!kernel_command_line().disable_usb()) { | ||||
|         PCI::enumerate([this](PCI::Address const& address, PCI::ID) { | ||||
|             if (PCI::get_class(address) == 0xc && PCI::get_subclass(address) == 0x3) { | ||||
|                 if (PCI::get_programming_interface(address) == 0x0) { | ||||
|                     if (kernel_command_line().disable_uhci_controller()) | ||||
|                         return; | ||||
|     if (kernel_command_line().disable_usb()) | ||||
|         return; | ||||
| 
 | ||||
|                     if (auto uhci_controller_or_error = UHCIController::try_to_initialize(address); !uhci_controller_or_error.is_error()) | ||||
|                         m_controllers.append(uhci_controller_or_error.release_value()); | ||||
|     PCI::enumerate([this](PCI::Address const& address, PCI::ID) { | ||||
|         if (!(PCI::get_class(address) == 0xc && PCI::get_subclass(address) == 0x3)) | ||||
|             return; | ||||
|         if (PCI::get_programming_interface(address) == 0x0) { | ||||
|             if (kernel_command_line().disable_uhci_controller()) | ||||
|                 return; | ||||
| 
 | ||||
|                     return; | ||||
|                 } | ||||
|             if (auto uhci_controller_or_error = UHCIController::try_to_initialize(address); !uhci_controller_or_error.is_error()) | ||||
|                 m_controllers.append(uhci_controller_or_error.release_value()); | ||||
| 
 | ||||
|                 if (PCI::get_programming_interface(address) == 0x10) { | ||||
|                     dmesgln("USBManagement: OHCI controller found at {} is not currently supported.", address); | ||||
|                     return; | ||||
|                 } | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|                 if (PCI::get_programming_interface(address) == 0x20) { | ||||
|                     dmesgln("USBManagement: EHCI controller found at {} is not currently supported.", address); | ||||
|                     return; | ||||
|                 } | ||||
|         if (PCI::get_programming_interface(address) == 0x10) { | ||||
|             dmesgln("USBManagement: OHCI controller found at {} is not currently supported.", address); | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|                 if (PCI::get_programming_interface(address) == 0x30) { | ||||
|                     dmesgln("USBManagement: xHCI controller found at {} is not currently supported.", address); | ||||
|                     return; | ||||
|                 } | ||||
|         if (PCI::get_programming_interface(address) == 0x20) { | ||||
|             dmesgln("USBManagement: EHCI controller found at {} is not currently supported.", address); | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|                 dmesgln("USBManagement: Unknown/unsupported controller at {} with programming interface 0x{:02x}", address, PCI::get_programming_interface(address)); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|         if (PCI::get_programming_interface(address) == 0x30) { | ||||
|             dmesgln("USBManagement: xHCI controller found at {} is not currently supported.", address); | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         dmesgln("USBManagement: Unknown/unsupported controller at {} with programming interface 0x{:02x}", address, PCI::get_programming_interface(address)); | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| bool USBManagement::initialized() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Liav A
						Liav A