mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
IDEDiskDevice: Add sysctl variable for turning DMA on/off.
This commit is contained in:
parent
29863d3815
commit
5f26f83451
2 changed files with 6 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include "PIC.h"
|
#include "PIC.h"
|
||||||
#include <Kernel/Lock.h>
|
#include <Kernel/Lock.h>
|
||||||
#include <Kernel/VM/MemoryManager.h>
|
#include <Kernel/VM/MemoryManager.h>
|
||||||
|
#include <Kernel/FileSystem/ProcFS.h>
|
||||||
|
|
||||||
//#define DISK_DEBUG
|
//#define DISK_DEBUG
|
||||||
|
|
||||||
|
@ -110,6 +111,8 @@ Retained<IDEDiskDevice> IDEDiskDevice::create()
|
||||||
IDEDiskDevice::IDEDiskDevice()
|
IDEDiskDevice::IDEDiskDevice()
|
||||||
: IRQHandler(IRQ_FIXED_DISK)
|
: IRQHandler(IRQ_FIXED_DISK)
|
||||||
{
|
{
|
||||||
|
m_dma_enabled.resource() = true;
|
||||||
|
ProcFS::the().add_sys_bool("ide_dma", m_dma_enabled);
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,14 +132,14 @@ unsigned IDEDiskDevice::block_size() const
|
||||||
|
|
||||||
bool IDEDiskDevice::read_blocks(unsigned index, word count, byte* out)
|
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_with_dma(index, count, out);
|
||||||
return read_sectors(index, count, out);
|
return read_sectors(index, count, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IDEDiskDevice::read_block(unsigned index, byte* out) const
|
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_with_dma(index, 1, out);
|
||||||
return const_cast<IDEDiskDevice&>(*this).read_sectors(index, 1, out);
|
return const_cast<IDEDiskDevice&>(*this).read_sectors(index, 1, out);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,5 +53,6 @@ private:
|
||||||
PhysicalRegionDescriptor m_prdt;
|
PhysicalRegionDescriptor m_prdt;
|
||||||
RetainPtr<PhysicalPage> m_dma_buffer_page;
|
RetainPtr<PhysicalPage> m_dma_buffer_page;
|
||||||
word m_bus_master_base { 0 };
|
word m_bus_master_base { 0 };
|
||||||
|
Lockable<bool> m_dma_enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue