summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/HALKit/AMD64/Storage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-23 11:12:31 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-05-23 11:13:38 +0200
commit54a0f4c49d9bfb955174c87dae2f442d7f5a8b25 (patch)
treead59d31c9444fcfc6d5f0da7b17c8843710e6014 /dev/kernel/HALKit/AMD64/Storage
parentfc67c4af554189c941c811486a0b2b21aa3f54ea (diff)
feat!(Kernel): Improvements on the BitMapMgr, HTS, and UPS.
other: - Add ZXD header file. - Reworking AMD64 interrupts. - Improved HTS's design implementation. - Improved UPS's balancing implementation. breaking changes: - Rename MemoryMgr to HeapMgr. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/HALKit/AMD64/Storage')
-rw-r--r--dev/kernel/HALKit/AMD64/Storage/PIO+Generic.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/dev/kernel/HALKit/AMD64/Storage/PIO+Generic.cc b/dev/kernel/HALKit/AMD64/Storage/PIO+Generic.cc
index dd6b9aea..99e1c619 100644
--- a/dev/kernel/HALKit/AMD64/Storage/PIO+Generic.cc
+++ b/dev/kernel/HALKit/AMD64/Storage/PIO+Generic.cc
@@ -15,8 +15,6 @@
*
*/
-#if 0
-
#include <ArchKit/ArchKit.h>
#include <KernelKit/DriveMgr.h>
#include <StorageKit/ATA.h>
@@ -85,8 +83,8 @@ ATAInit_Retry:
rt_out8(OutBus + ATA_REG_COMMAND, ATA_CMD_IDENTIFY);
- while (!(rt_in8(IO + ATA_REG_STATUS) & ATA_SR_DRQ));
-
+ while (!(rt_in8(IO + ATA_REG_STATUS) & ATA_SR_DRQ))
+ ;
/// fetch serial info
/// model, speed, number of sectors...
@@ -119,21 +117,22 @@ Void drv_pio_std_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT Sect
rt_out8(IO + ATA_REG_SEC_COUNT0, ((Size + SectorSz) / SectorSz));
- rt_out8(IO + ATA_REG_LBA0, (Lba) & 0xFF);
+ rt_out8(IO + ATA_REG_LBA0, (Lba) &0xFF);
rt_out8(IO + ATA_REG_LBA1, (Lba) >> 8);
rt_out8(IO + ATA_REG_LBA2, (Lba) >> 16);
rt_out8(IO + ATA_REG_LBA3, (Lba) >> 24);
rt_out8(IO + ATA_REG_COMMAND, ATA_CMD_READ_PIO);
- while (!(rt_in8(IO + ATA_REG_STATUS) & ATA_SR_DRQ));
+ while (!(rt_in8(IO + ATA_REG_STATUS) & ATA_SR_DRQ))
+ ;
for (SizeT IndexOff = 0; IndexOff < Size; IndexOff += 2) {
drv_pio_std_wait_io(IO);
auto in = rt_in16(IO + ATA_REG_DATA);
- Buf[IndexOff] = in & 0xFF;
+ Buf[IndexOff] = in & 0xFF;
Buf[IndexOff + 1] = (in >> 8) & 0xFF;
}
}
@@ -150,22 +149,23 @@ Void drv_pio_std_write(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT Sec
rt_out8(IO + ATA_REG_SEC_COUNT0, ((Size + SectorSz) / SectorSz));
- rt_out8(IO + ATA_REG_LBA0, (Lba) & 0xFF);
+ rt_out8(IO + ATA_REG_LBA0, (Lba) &0xFF);
rt_out8(IO + ATA_REG_LBA1, (Lba) >> 8);
rt_out8(IO + ATA_REG_LBA2, (Lba) >> 16);
rt_out8(IO + ATA_REG_LBA3, (Lba) >> 24);
rt_out8(IO + ATA_REG_COMMAND, ATA_CMD_WRITE_PIO);
- while (!(rt_in8(IO + ATA_REG_STATUS) & ATA_SR_DRQ));
+ while (!(rt_in8(IO + ATA_REG_STATUS) & ATA_SR_DRQ))
+ ;
for (SizeT IndexOff = 0; IndexOff < Size; IndexOff += 2) {
drv_pio_std_wait_io(IO);
- UInt8 low = (UInt8)Buf[IndexOff];
- UInt8 high = (IndexOff + 1 < Size) ? (UInt8)Buf[IndexOff + 1] : 0;
+ UInt8 low = (UInt8) Buf[IndexOff];
+ UInt8 high = (IndexOff + 1 < Size) ? (UInt8) Buf[IndexOff + 1] : 0;
UInt16 packed = (high << 8) | low;
-
+
rt_out16(IO + ATA_REG_DATA, packed);
}
}
@@ -275,6 +275,4 @@ Boolean drv_std_init(UInt16 Bus, UInt8 Drive, UInt16& OutBus, UInt8& OutMaster)
return drv_pio_std_init(Bus, Drive, OutBus, OutMaster);
}
-#endif
-
#endif \ No newline at end of file