mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 00:32:45 +00:00 
			
		
		
		
	Kernel/CommandLine: Add option to disable physical networking hardware
This is useful for debugging sessions mostly.
This commit is contained in:
		
							parent
							
								
									1c94b5e8eb
								
							
						
					
					
						commit
						2e2201e8e1
					
				
					 3 changed files with 15 additions and 7 deletions
				
			
		|  | @ -154,6 +154,11 @@ UNMAP_AFTER_INIT HPETMode CommandLine::hpet_mode() const | ||||||
|     PANIC("Unknown HPETMode: {}", hpet_mode); |     PANIC("Unknown HPETMode: {}", hpet_mode); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | UNMAP_AFTER_INIT bool CommandLine::is_physical_networking_disabled() const | ||||||
|  | { | ||||||
|  |     return contains("disable_physical_networking"sv); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| UNMAP_AFTER_INIT bool CommandLine::disable_ps2_controller() const | UNMAP_AFTER_INIT bool CommandLine::disable_ps2_controller() const | ||||||
| { | { | ||||||
|     return contains("disable_ps2_controller"sv); |     return contains("disable_ps2_controller"sv); | ||||||
|  |  | ||||||
|  | @ -55,6 +55,7 @@ public: | ||||||
|     [[nodiscard]] bool is_boot_profiling_enabled() const; |     [[nodiscard]] bool is_boot_profiling_enabled() const; | ||||||
|     [[nodiscard]] bool is_ide_enabled() const; |     [[nodiscard]] bool is_ide_enabled() const; | ||||||
|     [[nodiscard]] bool is_smp_enabled() const; |     [[nodiscard]] bool is_smp_enabled() const; | ||||||
|  |     [[nodiscard]] bool is_physical_networking_disabled() const; | ||||||
|     [[nodiscard]] bool is_vmmouse_enabled() const; |     [[nodiscard]] bool is_vmmouse_enabled() const; | ||||||
|     [[nodiscard]] PCIAccessLevel pci_access_level() const; |     [[nodiscard]] PCIAccessLevel pci_access_level() const; | ||||||
|     [[nodiscard]] bool is_legacy_time_enabled() const; |     [[nodiscard]] bool is_legacy_time_enabled() const; | ||||||
|  |  | ||||||
|  | @ -85,13 +85,15 @@ UNMAP_AFTER_INIT RefPtr<NetworkAdapter> NetworkingManagement::determine_network_ | ||||||
| 
 | 
 | ||||||
| bool NetworkingManagement::initialize() | bool NetworkingManagement::initialize() | ||||||
| { | { | ||||||
|     PCI::enumerate([&](const PCI::Address& address, PCI::ID) { |     if (!kernel_command_line().is_physical_networking_disabled()) { | ||||||
|         // Note: PCI class 2 is the class of Network devices
 |         PCI::enumerate([&](const PCI::Address& address, PCI::ID) { | ||||||
|         if (PCI::get_class(address) != 0x02) |             // Note: PCI class 2 is the class of Network devices
 | ||||||
|             return; |             if (PCI::get_class(address) != 0x02) | ||||||
|         if (auto adapter = determine_network_device(address); !adapter.is_null()) |                 return; | ||||||
|             m_adapters.append(adapter.release_nonnull()); |             if (auto adapter = determine_network_device(address); !adapter.is_null()) | ||||||
|     }); |                 m_adapters.append(adapter.release_nonnull()); | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|     auto loopback = LoopbackAdapter::create(); |     auto loopback = LoopbackAdapter::create(); | ||||||
|     m_adapters.append(loopback); |     m_adapters.append(loopback); | ||||||
|     m_loopback_adapter = loopback; |     m_loopback_adapter = loopback; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Liav A
						Liav A