mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:22:45 +00:00 
			
		
		
		
	Kernel/IntelGraphics: Add Generation enum to the Definitions file
This will be used to annotate which Generation is being used for each Intel iGPU we discover.
This commit is contained in:
		
							parent
							
								
									8042ae43c3
								
							
						
					
					
						commit
						e393071a9b
					
				
					 4 changed files with 13 additions and 12 deletions
				
			
		|  | @ -10,6 +10,11 @@ | ||||||
| 
 | 
 | ||||||
| namespace Kernel::IntelGraphics { | namespace Kernel::IntelGraphics { | ||||||
| 
 | 
 | ||||||
|  | enum class Generation { | ||||||
|  |     Gen4, | ||||||
|  |     Gen9, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| struct PLLSettings; | struct PLLSettings; | ||||||
| 
 | 
 | ||||||
| struct PLLParameterLimit { | struct PLLParameterLimit { | ||||||
|  |  | ||||||
|  | @ -122,7 +122,7 @@ Optional<IntelGraphics::PLLSettings> IntelDisplayConnectorGroup::create_pll_sett | ||||||
|     return {}; |     return {}; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ErrorOr<NonnullLockRefPtr<IntelDisplayConnectorGroup>> IntelDisplayConnectorGroup::try_create(Badge<IntelNativeGraphicsAdapter>, Generation generation, MMIORegion const& first_region, MMIORegion const& second_region) | ErrorOr<NonnullLockRefPtr<IntelDisplayConnectorGroup>> IntelDisplayConnectorGroup::try_create(Badge<IntelNativeGraphicsAdapter>, IntelGraphics::Generation generation, MMIORegion const& first_region, MMIORegion const& second_region) | ||||||
| { | { | ||||||
|     auto registers_region = TRY(MM.allocate_kernel_region(first_region.pci_bar_paddr, first_region.pci_bar_space_length, "Intel Native Graphics Registers"sv, Memory::Region::Access::ReadWrite)); |     auto registers_region = TRY(MM.allocate_kernel_region(first_region.pci_bar_paddr, first_region.pci_bar_space_length, "Intel Native Graphics Registers"sv, Memory::Region::Access::ReadWrite)); | ||||||
|     // NOTE: 0x5100 is the offset of the start of the GMBus registers
 |     // NOTE: 0x5100 is the offset of the start of the GMBus registers
 | ||||||
|  | @ -132,7 +132,7 @@ ErrorOr<NonnullLockRefPtr<IntelDisplayConnectorGroup>> IntelDisplayConnectorGrou | ||||||
|     return connector_group; |     return connector_group; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| IntelDisplayConnectorGroup::IntelDisplayConnectorGroup(Generation generation, NonnullOwnPtr<GMBusConnector> gmbus_connector, NonnullOwnPtr<Memory::Region> registers_region, MMIORegion const& first_region, MMIORegion const& second_region) | IntelDisplayConnectorGroup::IntelDisplayConnectorGroup(IntelGraphics::Generation generation, NonnullOwnPtr<GMBusConnector> gmbus_connector, NonnullOwnPtr<Memory::Region> registers_region, MMIORegion const& first_region, MMIORegion const& second_region) | ||||||
|     : m_mmio_first_region(first_region) |     : m_mmio_first_region(first_region) | ||||||
|     , m_mmio_second_region(second_region) |     , m_mmio_second_region(second_region) | ||||||
|     , m_assigned_mmio_registers_region(m_mmio_first_region) |     , m_assigned_mmio_registers_region(m_mmio_first_region) | ||||||
|  | @ -172,7 +172,7 @@ ErrorOr<void> IntelDisplayConnectorGroup::initialize_connectors() | ||||||
| 
 | 
 | ||||||
|     // NOTE: Intel Graphics Generation 4 is pretty ancient beast, and we should not
 |     // NOTE: Intel Graphics Generation 4 is pretty ancient beast, and we should not
 | ||||||
|     // assume we can find a VBT for it. Just initialize the (assumed) CRT connector and be done with it.
 |     // assume we can find a VBT for it. Just initialize the (assumed) CRT connector and be done with it.
 | ||||||
|     if (m_generation == Generation::Gen4) { |     if (m_generation == IntelGraphics::Generation::Gen4) { | ||||||
|         TRY(initialize_gen4_connectors()); |         TRY(initialize_gen4_connectors()); | ||||||
|     } else { |     } else { | ||||||
|         VERIFY_NOT_REACHED(); |         VERIFY_NOT_REACHED(); | ||||||
|  | @ -232,7 +232,7 @@ ErrorOr<void> IntelDisplayConnectorGroup::set_mode_setting(IntelNativeDisplayCon | ||||||
|     DisplayConnector::ModeSetting actual_mode_setting = mode_setting; |     DisplayConnector::ModeSetting actual_mode_setting = mode_setting; | ||||||
|     actual_mode_setting.horizontal_stride = actual_mode_setting.horizontal_active * sizeof(u32); |     actual_mode_setting.horizontal_stride = actual_mode_setting.horizontal_active * sizeof(u32); | ||||||
|     VERIFY(actual_mode_setting.horizontal_stride != 0); |     VERIFY(actual_mode_setting.horizontal_stride != 0); | ||||||
|     if (m_generation == Generation::Gen4) { |     if (m_generation == IntelGraphics::Generation::Gen4) { | ||||||
|         TRY(set_gen4_mode_setting(connector, actual_mode_setting)); |         TRY(set_gen4_mode_setting(connector, actual_mode_setting)); | ||||||
|     } else { |     } else { | ||||||
|         VERIFY_NOT_REACHED(); |         VERIFY_NOT_REACHED(); | ||||||
|  |  | ||||||
|  | @ -25,9 +25,6 @@ class IntelDisplayConnectorGroup : public RefCounted<IntelDisplayConnectorGroup> | ||||||
|     friend class IntelNativeGraphicsAdapter; |     friend class IntelNativeGraphicsAdapter; | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
|     enum class Generation { |  | ||||||
|         Gen4, |  | ||||||
|     }; |  | ||||||
|     struct MMIORegion { |     struct MMIORegion { | ||||||
|         enum class BARAssigned { |         enum class BARAssigned { | ||||||
|             BAR0, |             BAR0, | ||||||
|  | @ -47,13 +44,13 @@ private: | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
|     static ErrorOr<NonnullLockRefPtr<IntelDisplayConnectorGroup>> try_create(Badge<IntelNativeGraphicsAdapter>, Generation, MMIORegion const&, MMIORegion const&); |     static ErrorOr<NonnullLockRefPtr<IntelDisplayConnectorGroup>> try_create(Badge<IntelNativeGraphicsAdapter>, IntelGraphics::Generation, MMIORegion const&, MMIORegion const&); | ||||||
| 
 | 
 | ||||||
|     ErrorOr<void> set_safe_mode_setting(Badge<IntelNativeDisplayConnector>, IntelNativeDisplayConnector&); |     ErrorOr<void> set_safe_mode_setting(Badge<IntelNativeDisplayConnector>, IntelNativeDisplayConnector&); | ||||||
|     ErrorOr<void> set_mode_setting(Badge<IntelNativeDisplayConnector>, IntelNativeDisplayConnector&, DisplayConnector::ModeSetting const&); |     ErrorOr<void> set_mode_setting(Badge<IntelNativeDisplayConnector>, IntelNativeDisplayConnector&, DisplayConnector::ModeSetting const&); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     IntelDisplayConnectorGroup(Generation generation, NonnullOwnPtr<GMBusConnector>, NonnullOwnPtr<Memory::Region> registers_region, MMIORegion const&, MMIORegion const&); |     IntelDisplayConnectorGroup(IntelGraphics::Generation generation, NonnullOwnPtr<GMBusConnector>, NonnullOwnPtr<Memory::Region> registers_region, MMIORegion const&, MMIORegion const&); | ||||||
| 
 | 
 | ||||||
|     ErrorOr<void> set_mode_setting(IntelNativeDisplayConnector&, DisplayConnector::ModeSetting const&); |     ErrorOr<void> set_mode_setting(IntelNativeDisplayConnector&, DisplayConnector::ModeSetting const&); | ||||||
| 
 | 
 | ||||||
|  | @ -95,7 +92,7 @@ private: | ||||||
|     const MMIORegion m_mmio_second_region; |     const MMIORegion m_mmio_second_region; | ||||||
|     MMIORegion const& m_assigned_mmio_registers_region; |     MMIORegion const& m_assigned_mmio_registers_region; | ||||||
| 
 | 
 | ||||||
|     const Generation m_generation; |     const IntelGraphics::Generation m_generation; | ||||||
|     NonnullOwnPtr<Memory::Region> m_registers_region; |     NonnullOwnPtr<Memory::Region> m_registers_region; | ||||||
|     NonnullOwnPtr<GMBusConnector> m_gmbus_connector; |     NonnullOwnPtr<GMBusConnector> m_gmbus_connector; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -54,10 +54,9 @@ ErrorOr<void> IntelNativeGraphicsAdapter::initialize_adapter() | ||||||
|     PCI::enable_io_space(device_identifier()); |     PCI::enable_io_space(device_identifier()); | ||||||
|     PCI::enable_memory_space(device_identifier()); |     PCI::enable_memory_space(device_identifier()); | ||||||
| 
 | 
 | ||||||
|     using Generation = IntelDisplayConnectorGroup::Generation; |  | ||||||
|     switch (device_identifier().hardware_id().device_id) { |     switch (device_identifier().hardware_id().device_id) { | ||||||
|     case 0x29c2: |     case 0x29c2: | ||||||
|         m_connector_group = TRY(IntelDisplayConnectorGroup::try_create({}, Generation::Gen4, first_region, second_region)); |         m_connector_group = TRY(IntelDisplayConnectorGroup::try_create({}, IntelGraphics::Generation::Gen4, first_region, second_region)); | ||||||
|         return {}; |         return {}; | ||||||
|     default: |     default: | ||||||
|         return Error::from_errno(ENODEV); |         return Error::from_errno(ENODEV); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Liav A
						Liav A