kernel: PCI constness updates
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-01-25 21:01:45 +01:00
parent fa29d6e9b9
commit 39042cbbd4
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -11,16 +11,16 @@ namespace PCI
{ {
Device::ID read_id(const Device::Address& address) Device::ID read_id(const Device::Address& address)
{ {
u16 vendor = read16(address, Field::VendorID); const u16 vendor = read16(address, Field::VendorID);
u16 device = read16(address, Field::DeviceID); const u16 device = read16(address, Field::DeviceID);
return { vendor, device }; return { vendor, device };
} }
Device::Type read_type(const Device::Address& address) Device::Type read_type(const Device::Address& address)
{ {
u8 klass = read8(address, Field::Class); const u8 klass = read8(address, Field::Class);
u8 subclass = read8(address, Field::Subclass); const u8 subclass = read8(address, Field::Subclass);
u8 prog_if = read8(address, Field::ProgIF); const u8 prog_if = read8(address, Field::ProgIF);
return { klass, subclass, prog_if }; return { klass, subclass, prog_if };
} }
@ -45,8 +45,8 @@ namespace PCI
void scan_function(const Device::Address& address, ScanInfo info) void scan_function(const Device::Address& address, ScanInfo info)
{ {
Device::ID id = read_id(address); const Device::ID id = read_id(address);
Device::Type type = read_type(address); const Device::Type type = read_type(address);
if (matches(type, info.match)) { info.callback({ id, type, address }); } if (matches(type, info.match)) { info.callback({ id, type, address }); }
@ -66,7 +66,7 @@ namespace PCI
scan_function(address, info); scan_function(address, info);
u8 header_type = read8(address, Field::HeaderType); const u8 header_type = read8(address, Field::HeaderType);
// Multiple-function PCI device // Multiple-function PCI device
if ((header_type & 0x80) == 0x80) if ((header_type & 0x80) == 0x80)
@ -87,7 +87,7 @@ namespace PCI
void scan(Callback callback, Match match) void scan(Callback callback, Match match)
{ {
u8 header_type = read8({ 0, 0, 0 }, Field::HeaderType); const u8 header_type = read8({ 0, 0, 0 }, Field::HeaderType);
// Single-function PCI bus // Single-function PCI bus
if ((header_type & 0x80) == 0) if ((header_type & 0x80) == 0)