diff --git a/targets/_any/include/drivers/pci.hpp b/targets/_any/include/drivers/pci.hpp
index 94418e3..bfd0098 100644
--- a/targets/_any/include/drivers/pci.hpp
+++ b/targets/_any/include/drivers/pci.hpp
@@ -9,6 +9,7 @@
namespace baos::pci
{
+//
enum class BaseClass : std::uint8_t
{
UNCLASSIFIED = 0x0,
@@ -164,6 +165,7 @@ enum class SubClass : std::uint8_t
COMMUNICATION_SYNCHRONIZER = 0x10,
SIGNAL_PROCESSING_MANAGEMENT = 0x20
};
+//
enum class HeaderType : std::uint8_t
{
@@ -172,7 +174,7 @@ enum class HeaderType : std::uint8_t
PCI_TO_CARDBUS_BRIDGE = 0x2
};
-struct Header
+struct alignas(32) Header
{
std::uint8_t bus;
std::uint8_t device;
@@ -183,10 +185,12 @@ struct Header
std::uint16_t deviceID;
std::uint16_t command;
std::uint16_t status;
+
std::uint8_t revisionID;
std::uint8_t progIf;
SubClass subClass;
BaseClass baseClass;
+
std::uint8_t cacheLineSize;
std::uint8_t latencyTimer;
HeaderType headerType : 7;
diff --git a/targets/_any/kernel/src/drivers/pci.cpp b/targets/_any/kernel/src/drivers/pci.cpp
index 6f9b84a..33450bc 100644
--- a/targets/_any/kernel/src/drivers/pci.cpp
+++ b/targets/_any/kernel/src/drivers/pci.cpp
@@ -96,23 +96,23 @@ void enumerateDevice(const Header& header, std::vector& outHeaders) noex
std::vector enumerateDevices() noexcept
{
- Header header = {};
- if (!getHeader(0, 0, 0, header)) {
+ Header hostControllerHeader = {};
+ if (!getHeader(0, 0, 0, hostControllerHeader)) {
return {};
}
- // also add the controller itself
std::vector headers;
- headers.push_back(header);
+ // also add the controller itself
+ headers.push_back(hostControllerHeader);
enumerateBusDevices(0, headers, /* firstDevice = */ 1);
- if (header.multiFunction)
+ if (hostControllerHeader.multiFunction)
{
for (std::uint8_t function = 1; function < 8; ++function)
{
- if (!getHeader(0, 0, function, header)) {
+ if (!getHeader(0, 0, function, hostControllerHeader)) {
continue;
}
- headers.push_back(header);
+ headers.push_back(hostControllerHeader);
enumerateBusDevices(function, headers);
}
}