summaryrefslogtreecommitdiff
path: root/Source/Kernel/Devices/ATA/ATADrive.class.cpp
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-11-29 17:06:47 +0100
committerAlexis211 <alexis211@gmail.com>2009-11-29 17:06:47 +0100
commit32ffa508b6ee9c9b36e3a054d218ee90caea4c8b (patch)
tree4136164e7fb52005d57782c9ae70da89eca85807 /Source/Kernel/Devices/ATA/ATADrive.class.cpp
parent2be9def10e048b3245bb14e9fb57324c11c527d6 (diff)
downloadMelon-32ffa508b6ee9c9b36e3a054d218ee90caea4c8b.tar.gz
Melon-32ffa508b6ee9c9b36e3a054d218ee90caea4c8b.zip
make qemu-hdd now works great
Diffstat (limited to 'Source/Kernel/Devices/ATA/ATADrive.class.cpp')
-rw-r--r--Source/Kernel/Devices/ATA/ATADrive.class.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/Kernel/Devices/ATA/ATADrive.class.cpp b/Source/Kernel/Devices/ATA/ATADrive.class.cpp
index d9cc4a7..247e798 100644
--- a/Source/Kernel/Devices/ATA/ATADrive.class.cpp
+++ b/Source/Kernel/Devices/ATA/ATADrive.class.cpp
@@ -37,6 +37,7 @@ void ATADrive::cmdCommon(u32int numblock, u32int count) {
bool ATADrive::readBlocks(u64int start, u32int count, u8int* data) {
if (start + count >= m_blockCount) return false;
+ m_ctrlr->waitLock();
cmdCommon(start, count);
m_ctrlr->writeByte(ATA_PORT_COMMAND, ATA_CMD_READ);
@@ -47,6 +48,7 @@ bool ATADrive::readBlocks(u64int start, u32int count, u8int* data) {
data[idx * 2] = (u8int)tmpword;
data[idx * 2 + 1] = (u8int)(tmpword >> 8);
}
+ m_ctrlr->unlock();
return true;
}
@@ -54,6 +56,7 @@ bool ATADrive::writeBlocks(u64int start, u32int count, u8int* data) {
if (start + count >= m_blockCount) return false;
if (readOnly()) return false;
+ m_ctrlr->waitLock();
cmdCommon(start, count);
m_ctrlr->writeByte(ATA_PORT_COMMAND, ATA_CMD_WRITE);
@@ -63,6 +66,7 @@ bool ATADrive::writeBlocks(u64int start, u32int count, u8int* data) {
u16int tmpword = (data[idx * 2]) | (data[idx * 2 + 1] << 8);
m_ctrlr->writeByte(ATA_PORT_DATA, tmpword);
}
+ m_ctrlr->unlock();
return true;
}