mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-08 12:56:23 +03:00
Kernel: Make PCI [Sub]ClassCode comparable to the corresponding ID enums
This commit is contained in:
parent
3273ef1e3f
commit
66647b58d4
Notes:
sideshowbarker
2024-07-16 22:51:10 +09:00
Author: https://github.com/Hendiadyoin1 Commit: https://github.com/SerenityOS/serenity/commit/66647b58d4 Pull-request: https://github.com/SerenityOS/serenity/pull/21028 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/supercomputer7 ✅
@ -260,7 +260,14 @@ private:
|
||||
};
|
||||
|
||||
AK_TYPEDEF_DISTINCT_ORDERED_ID(u8, ClassCode);
|
||||
AK_MAKE_DISTINCT_NUMERIC_COMPARABLE_TO_ENUM(ClassCode, ClassID)
|
||||
|
||||
AK_TYPEDEF_DISTINCT_ORDERED_ID(u8, SubclassCode);
|
||||
AK_MAKE_DISTINCT_NUMERIC_COMPARABLE_TO_ENUM(SubclassCode, MassStorage::SubclassID);
|
||||
AK_MAKE_DISTINCT_NUMERIC_COMPARABLE_TO_ENUM(SubclassCode, Multimedia::SubclassID);
|
||||
AK_MAKE_DISTINCT_NUMERIC_COMPARABLE_TO_ENUM(SubclassCode, Bridge::SubclassID);
|
||||
AK_MAKE_DISTINCT_NUMERIC_COMPARABLE_TO_ENUM(SubclassCode, Base::SubclassID);
|
||||
|
||||
AK_TYPEDEF_DISTINCT_ORDERED_ID(u8, ProgrammingInterface);
|
||||
AK_TYPEDEF_DISTINCT_ORDERED_ID(u8, RevisionID);
|
||||
AK_TYPEDEF_DISTINCT_ORDERED_ID(u16, SubsystemID);
|
||||
|
@ -34,8 +34,8 @@ UNMAP_AFTER_INIT ErrorOr<NonnullRefPtr<AudioController>> AC97::create(PCI::Devic
|
||||
|
||||
UNMAP_AFTER_INIT ErrorOr<bool> AC97::probe(PCI::DeviceIdentifier const& device_identifier)
|
||||
{
|
||||
VERIFY(device_identifier.class_code().value() == to_underlying(PCI::ClassID::Multimedia));
|
||||
return device_identifier.subclass_code().value() == to_underlying(PCI::Multimedia::SubclassID::AudioController);
|
||||
VERIFY(device_identifier.class_code() == PCI::ClassID::Multimedia);
|
||||
return device_identifier.subclass_code() == PCI::Multimedia::SubclassID::AudioController;
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT AC97::AC97(PCI::DeviceIdentifier const& pci_device_identifier, NonnullOwnPtr<AC97Channel> pcm_out_channel, NonnullOwnPtr<IOWindow> mixer_io_window, NonnullOwnPtr<IOWindow> bus_io_window)
|
||||
|
@ -19,8 +19,8 @@ namespace Kernel::Audio::IntelHDA {
|
||||
|
||||
UNMAP_AFTER_INIT ErrorOr<bool> Controller::probe(PCI::DeviceIdentifier const& device_identifier)
|
||||
{
|
||||
VERIFY(device_identifier.class_code().value() == to_underlying(PCI::ClassID::Multimedia));
|
||||
return device_identifier.subclass_code().value() == to_underlying(PCI::Multimedia::SubclassID::HDACompatibleController);
|
||||
VERIFY(device_identifier.class_code() == PCI::ClassID::Multimedia);
|
||||
return device_identifier.subclass_code() == PCI::Multimedia::SubclassID::HDACompatibleController;
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT ErrorOr<NonnullRefPtr<AudioController>> Controller::create(PCI::DeviceIdentifier const& pci_device_identifier)
|
||||
|
@ -71,7 +71,7 @@ UNMAP_AFTER_INIT void AudioManagement::enumerate_hardware_controllers()
|
||||
return;
|
||||
MUST(PCI::enumerate([&](PCI::DeviceIdentifier const& device_identifier) {
|
||||
// Only consider PCI multimedia devices
|
||||
if (device_identifier.class_code().value() != to_underlying(PCI::ClassID::Multimedia))
|
||||
if (device_identifier.class_code() != PCI::ClassID::Multimedia)
|
||||
return;
|
||||
|
||||
auto result = determine_audio_device(device_identifier);
|
||||
|
@ -152,10 +152,10 @@ UNMAP_AFTER_INIT void StorageManagement::enumerate_pci_controllers(bool force_pi
|
||||
};
|
||||
|
||||
MUST(PCI::enumerate([&](PCI::DeviceIdentifier const& device_identifier) -> void {
|
||||
auto class_code = device_identifier.class_code().value();
|
||||
if (class_code == to_underlying(PCI::ClassID::MassStorage)) {
|
||||
auto class_code = device_identifier.class_code();
|
||||
if (class_code == PCI::ClassID::MassStorage) {
|
||||
handle_mass_storage_device(device_identifier);
|
||||
} else if (class_code == to_underlying(PCI::ClassID::Base)) {
|
||||
} else if (class_code == PCI::ClassID::Base) {
|
||||
handle_base_device(device_identifier);
|
||||
}
|
||||
}));
|
||||
|
Loading…
Reference in New Issue
Block a user