mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21: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:
parent
2c647da0b5
commit
1b25513ed7
2 changed files with 19 additions and 6 deletions
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <Kernel/Devices/Audio/Controller.h>
|
||||
#include <Kernel/Devices/CharacterDevice.h>
|
||||
#include <Kernel/Interrupts/IRQHandler.h>
|
||||
#include <Kernel/Locking/SpinlockProtected.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
@ -129,7 +130,10 @@ private:
|
|||
{
|
||||
}
|
||||
|
||||
bool dma_running() const { return m_dma_running; }
|
||||
bool dma_running() const
|
||||
{
|
||||
return m_dma_running.with([](auto value) { return value; });
|
||||
}
|
||||
void handle_dma_stopped();
|
||||
StringView name() const { return m_name; }
|
||||
IOAddress reg(Register reg) const { return m_channel_base.offset(reg); }
|
||||
|
@ -140,7 +144,7 @@ private:
|
|||
private:
|
||||
IOAddress m_channel_base;
|
||||
AC97& m_device;
|
||||
bool m_dma_running { false };
|
||||
SpinlockProtected<bool> m_dma_running { false };
|
||||
StringView m_name;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue