kernel: Lock ATADevice::read_lba() using ATA::Channel's KMutex
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-06-17 00:22:38 +02:00
parent 4f86cd9f08
commit 27b26f389c
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 13 additions and 1 deletions

View File

@ -748,6 +748,8 @@ Result<u64> ATADevice::read(u8* buf, usize offset, usize size) const
auto block_size = m_drive->block_size();
ScopedKMutexLock<100>(m_drive->channel()->lock());
auto* temp = TRY(make_array<u8>(block_size));
auto guard = make_scope_guard([temp] { delete[] temp; });

View File

@ -157,6 +157,11 @@ namespace ATA
return m_block_count * m_block_size;
}
Channel* channel() const
{
return m_channel;
}
Result<void> read_lba(u64 lba, void* out, usize nblocks);
static Result<String> create_drive_name(SharedPtr<ATA::Drive> drive);
@ -233,11 +238,16 @@ namespace ATA
bool wait_for_irq_or_timeout(u64 timeout);
void irq_handler(Registers*);
u8 irq_line()
u8 irq_line() const
{
return m_interrupt_line;
}
KMutex<100>& lock()
{
return m_lock;
}
void select(u8 drive);
bool initialize();