mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
IDEDiskDevice: Add sysctl variable for turning DMA on/off.
This commit is contained in:
parent
29863d3815
commit
5f26f83451
Notes:
sideshowbarker
2024-07-19 14:01:07 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/5f26f83451e
2 changed files with 6 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
|||
#include "PIC.h"
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/FileSystem/ProcFS.h>
|
||||
|
||||
//#define DISK_DEBUG
|
||||
|
||||
|
@ -110,6 +111,8 @@ Retained<IDEDiskDevice> IDEDiskDevice::create()
|
|||
IDEDiskDevice::IDEDiskDevice()
|
||||
: IRQHandler(IRQ_FIXED_DISK)
|
||||
{
|
||||
m_dma_enabled.resource() = true;
|
||||
ProcFS::the().add_sys_bool("ide_dma", m_dma_enabled);
|
||||
initialize();
|
||||
}
|
||||
|
||||
|
@ -129,14 +132,14 @@ unsigned IDEDiskDevice::block_size() const
|
|||
|
||||
bool IDEDiskDevice::read_blocks(unsigned index, word count, byte* out)
|
||||
{
|
||||
if (m_bus_master_base)
|
||||
if (m_bus_master_base && m_dma_enabled.resource())
|
||||
return read_sectors_with_dma(index, count, out);
|
||||
return read_sectors(index, count, out);
|
||||
}
|
||||
|
||||
bool IDEDiskDevice::read_block(unsigned index, byte* out) const
|
||||
{
|
||||
if (m_bus_master_base)
|
||||
if (m_bus_master_base && const_cast<IDEDiskDevice*>(this)->m_dma_enabled.resource())
|
||||
return const_cast<IDEDiskDevice&>(*this).read_sectors_with_dma(index, 1, out);
|
||||
return const_cast<IDEDiskDevice&>(*this).read_sectors(index, 1, out);
|
||||
}
|
||||
|
|
|
@ -53,5 +53,6 @@ private:
|
|||
PhysicalRegionDescriptor m_prdt;
|
||||
RetainPtr<PhysicalPage> m_dma_buffer_page;
|
||||
word m_bus_master_base { 0 };
|
||||
Lockable<bool> m_dma_enabled;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue