From 23006b2b43783908ae27e85afe64e0795defff42 Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Mon, 27 Aug 2018 06:39:31 -0700 Subject: [PATCH] Fixed number of args in ahci interrupt log call --- src/kernel/ahci/hba.cpp | 2 +- src/kernel/ahci/port.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/kernel/ahci/hba.cpp b/src/kernel/ahci/hba.cpp index 245eddc..4ea8969 100644 --- a/src/kernel/ahci/hba.cpp +++ b/src/kernel/ahci/hba.cpp @@ -76,7 +76,7 @@ hba::hba(pci_device *device) unsigned ports = (icap & 0xf) + 1; unsigned slots = ((icap >> 8) & 0x1f) + 1; - log::debug(logs::driver, " %d ports", ports); + log::debug(logs::driver, " %d ports: %08x", ports, m_data->port_impl); log::debug(logs::driver, " %d command slots", slots); auto *pd = reinterpret_cast( diff --git a/src/kernel/ahci/port.cpp b/src/kernel/ahci/port.cpp index 76255a1..43c5b37 100644 --- a/src/kernel/ahci/port.cpp +++ b/src/kernel/ahci/port.cpp @@ -383,7 +383,7 @@ port::issue_command(int slot) void port::handle_interrupt() { - log::debug(logs::driver, "AHCI port %d got an interrupt"); + log::debug(logs::driver, "AHCI port %d got an interrupt", m_index); // TODO: handle other states in interrupt_status @@ -407,8 +407,11 @@ port::handle_interrupt() uint32_t ci = m_data->cmd_issue; for (int i = 0; i < 32; ++i) { + // Skip commands still listed as "issued" if (ci & (1 << i)) continue; + // Any commands not still listed as "issued" that are still pending for + // the driver are now finished, so handle them. pending &p = m_pending[i]; switch (p.type) { case command_type::read: @@ -421,6 +424,8 @@ port::handle_interrupt() break; } } + + // Clear the whole status register to mark it as handled m_data->interrupt_status = m_data->interrupt_status; }