kernel: Lock ATADevice::read_lba() using ATA::Channel's KMutex
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
4f86cd9f08
commit
27b26f389c
@ -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; });
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user