1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

Kernel: Don't VERIFY that the DMA channel is running on AC'97 interrupt

Fixes #13771; as discussed it's not really a problem to receive an
interrupt while the DMA channel is not running, but we do want to log
it.
This commit is contained in:
kleines Filmröllchen 2022-06-04 22:29:40 +02:00 committed by Idan Horowitz
parent 2c647da0b5
commit 1b25513ed7
2 changed files with 19 additions and 6 deletions

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/Format.h>
#include <Kernel/Devices/Audio/AC97.h>
#include <Kernel/Devices/DeviceManagement.h>
#include <Kernel/Memory/AnonymousVMObject.h>
@ -274,8 +275,12 @@ ErrorOr<void> AC97::write_single_buffer(UserOrKernelBuffer const& data, size_t o
void AC97::AC97Channel::handle_dma_stopped()
{
dbgln_if(AC97_DEBUG, "AC97 @ {}: channel {}: DMA engine has stopped", m_device.pci_address(), name());
VERIFY(m_dma_running);
m_dma_running = false;
m_dma_running.with([this](auto& dma_running) {
// NOTE: QEMU might send spurious interrupts while we're not running, so we don't want to panic here.
if (!dma_running)
dbgln("AC97 @ {}: received DMA interrupt while it wasn't running", m_device.pci_address());
dma_running = false;
});
}
void AC97::AC97Channel::reset()
@ -288,7 +293,9 @@ void AC97::AC97Channel::reset()
while ((control_register.in<u8>() & AudioControlRegisterFlag::ResetRegisters) > 0)
IO::delay(50);
m_dma_running = false;
m_dma_running.with([](auto& dma_running) {
dma_running = false;
});
}
void AC97::AC97Channel::set_last_valid_index(u32 buffer_address, u8 last_valid_index)
@ -310,7 +317,9 @@ void AC97::AC97Channel::start_dma()
control |= AudioControlRegisterFlag::InterruptOnCompletionEnable;
control_register.out(control);
m_dma_running = true;
m_dma_running.with([](auto& dma_running) {
dma_running = true;
});
}
}