summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelle Raaijmakers <jelle@gmta.nl>2022-01-09 15:55:35 +0100
committerIdan Horowitz <idan.horowitz@gmail.com>2022-01-09 19:11:29 +0200
commit864f842dfe6c7a0dfbb01b1c62338f5be12b86e8 (patch)
treeb797d820f44e4c0db20e0e0c5e600ee24b805028
parent20e29c403e7cf6878ab4fec2cca19dd4cf698568 (diff)
downloadserenity-864f842dfe6c7a0dfbb01b1c62338f5be12b86e8.zip
Kernel: Page-align AC'97 audio buffer descriptor list
This was broken in commit 0a1b34c753 / PR #11687 since the buffer descriptor list size was not page-aligned, and the new `MM.allocate_dma_buffer_pages` expects a page-aligned size.
-rw-r--r--Kernel/Devices/Audio/AC97.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Kernel/Devices/Audio/AC97.cpp b/Kernel/Devices/Audio/AC97.cpp
index 6951e19807..b19ab3b00b 100644
--- a/Kernel/Devices/Audio/AC97.cpp
+++ b/Kernel/Devices/Audio/AC97.cpp
@@ -200,7 +200,8 @@ ErrorOr<size_t> AC97::write(OpenFileDescription&, u64, UserOrKernelBuffer const&
m_output_buffer = TRY(MM.allocate_dma_buffer_pages(m_output_buffer_page_count * PAGE_SIZE, "AC97 Output buffer"sv, Memory::Region::Access::Write));
}
if (!m_buffer_descriptor_list) {
- constexpr size_t buffer_descriptor_list_size = buffer_descriptor_list_max_entries * sizeof(BufferDescriptorListEntry);
+ size_t buffer_descriptor_list_size = buffer_descriptor_list_max_entries * sizeof(BufferDescriptorListEntry);
+ buffer_descriptor_list_size = TRY(Memory::page_round_up(buffer_descriptor_list_size));
m_buffer_descriptor_list = TRY(MM.allocate_dma_buffer_pages(buffer_descriptor_list_size, "AC97 Buffer Descriptor List"sv, Memory::Region::Access::Write));
}