mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 10:38:13 +00:00
Kernel/Graphics: Introduce a new mechanism to initialize a PCI device
Instead of using a clunky switch-case paradigm, we now have all drivers being declaring two methods for their adapter class - create and probe. These methods are linked in each PCIGraphicsDriverInitializer structure, in a new s_initializers static list of them. Then, when we probe for a PCI device, we use each probe method and if there's a match, then the corresponding create method is called. As a result of this change, it's much more easy to add more drivers and the initialization code is more readable.
This commit is contained in:
parent
7625f7db73
commit
72b144e9e9
12 changed files with 85 additions and 71 deletions
|
@ -81,7 +81,7 @@ class IntelNativeDisplayConnector final
|
|||
friend class DeviceManagement;
|
||||
|
||||
public:
|
||||
static NonnullLockRefPtr<IntelNativeDisplayConnector> must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, PhysicalAddress registers_region_address, size_t registers_region_length);
|
||||
static ErrorOr<NonnullLockRefPtr<IntelNativeDisplayConnector>> try_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, PhysicalAddress registers_region_address, size_t registers_region_length);
|
||||
|
||||
private:
|
||||
// ^DisplayConnector
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue