diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-01-25 03:07:52 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-01-25 03:07:52 +0100 |
| commit | 0e05e9fd34bd036e9043f20939c53edf967465ce (patch) | |
| tree | 36e3e6b84534a82c53605a19134e9ab772c11c65 /src/kernel/HALKit/AMD64/Storage | |
| parent | 480ccd897d21823af6128f0e3d8d8cdbf653dd0f (diff) | |
feat: CF: Add alias for CFDictionary (CFDict).v0.1.3
fix: kernel: CodeMgr improvements and fixes.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/kernel/HALKit/AMD64/Storage')
| -rw-r--r-- | src/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc | 9 | ||||
| -rw-r--r-- | src/kernel/HALKit/AMD64/Storage/DMA+Generic.cc | 10 | ||||
| -rw-r--r-- | src/kernel/HALKit/AMD64/Storage/PIO+Generic.cc | 13 |
3 files changed, 14 insertions, 18 deletions
diff --git a/src/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc b/src/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc index c4fdf56f..456b6a2a 100644 --- a/src/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc +++ b/src/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc @@ -281,8 +281,7 @@ STATIC Void drv_std_input_output_ahci(UInt64 lba, UInt8* buffer, SizeT sector_sz goto ahci_io_end; } else { kout << "ahci: Disk still busy after command completion!\r"; - while (kSATAHba->Ports[kSATAIndex].Tfd & (kSATASRBsy | kSATASRDrq)) - ; + while (kSATAHba->Ports[kSATAIndex].Tfd & (kSATASRBsy | kSATASRDrq)); } ahci_io_end: @@ -295,13 +294,15 @@ STATIC Void drv_std_input_output_ahci(UInt64 lba, UInt8* buffer, SizeT sector_sz @brief Gets the number of sectors inside the drive. @return Sector size in bytes. */ -STATIC ATTRIBUTE(unused) SizeT drv_get_sector_count_ahci() { +STATIC ATTRIBUTE(unused) +SizeT drv_get_sector_count_ahci() { return kSATASectorCount; } /// @brief Get the drive size. /// @return Disk size in bytes. -STATIC ATTRIBUTE(unused) SizeT drv_get_size_ahci() { +STATIC ATTRIBUTE(unused) +SizeT drv_get_size_ahci() { return drv_std_get_sector_count() * kAHCISectorSize; } diff --git a/src/kernel/HALKit/AMD64/Storage/DMA+Generic.cc b/src/kernel/HALKit/AMD64/Storage/DMA+Generic.cc index a258bf3a..8bf7b161 100644 --- a/src/kernel/HALKit/AMD64/Storage/DMA+Generic.cc +++ b/src/kernel/HALKit/AMD64/Storage/DMA+Generic.cc @@ -92,7 +92,7 @@ Void drv_std_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorSz rt_out8(IO + ATA_REG_SEC_COUNT0, ((Size + SectorSz - 1) / 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); @@ -110,8 +110,7 @@ Void drv_std_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorSz rt_out8(kATADevice.Bar(0x20) + 0x00, 0x09); // Start DMA engine - while (rt_in8(kATADevice.Bar(0x20) + ATA_REG_STATUS) & 0x01) - ; + while (rt_in8(kATADevice.Bar(0x20) + ATA_REG_STATUS) & 0x01); rt_out8(kATADevice.Bar(0x20) + 0x00, 0x00); // Stop DMA engine @@ -134,7 +133,7 @@ Void drv_std_write(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorS rt_out8(IO + ATA_REG_SEC_COUNT0, ((Size + (SectorSz - 1)) / 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); @@ -150,8 +149,7 @@ Void drv_std_write(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorS rt_out8(IO + 0x00, 0x09); // Start DMA engine - while (rt_in8(kATADevice.Bar(0x20) + ATA_REG_STATUS) & 0x01) - ; + while (rt_in8(kATADevice.Bar(0x20) + ATA_REG_STATUS) & 0x01); rt_out8(kATADevice.Bar(0x20) + 0x00, 0x00); // Stop DMA engine diff --git a/src/kernel/HALKit/AMD64/Storage/PIO+Generic.cc b/src/kernel/HALKit/AMD64/Storage/PIO+Generic.cc index 6f5ebb66..19497b5f 100644 --- a/src/kernel/HALKit/AMD64/Storage/PIO+Generic.cc +++ b/src/kernel/HALKit/AMD64/Storage/PIO+Generic.cc @@ -70,8 +70,7 @@ 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... @@ -104,15 +103,14 @@ 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); @@ -136,15 +134,14 @@ 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); |
