diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-26 20:42:54 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-26 20:42:54 +0200 |
| commit | d10241467cc3f77988927a48a4384f63297465dd (patch) | |
| tree | 53ad5822367ce5b53ec03220a0b9839936d1f93e /Private/HALKit | |
| parent | 3210d2e3f38a73090bcdbdd68623c676868529ce (diff) | |
MHR-18: Test and improve filesystem.
- Disk driver for PIO divide by sector size by default.
- Breaking changes in NewFS as well, no more mess in forks! Either a
data or resource fork.
- Also implemented disk size and sector count better for disk drivers as
a mandatory function.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/HALKit')
| -rw-r--r-- | Private/HALKit/AMD64/Storage/ATA-PIO.cxx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Private/HALKit/AMD64/Storage/ATA-PIO.cxx b/Private/HALKit/AMD64/Storage/ATA-PIO.cxx index beb113d3..7f1cc11a 100644 --- a/Private/HALKit/AMD64/Storage/ATA-PIO.cxx +++ b/Private/HALKit/AMD64/Storage/ATA-PIO.cxx @@ -134,6 +134,8 @@ Void drv_std_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorSz, SizeT Size) { UInt8 Command = ((!Master )? 0xE0 : 0xF0); + Lba /= SectorSz; + Out8(IO + ATA_REG_HDDEVSEL, (Command) | (((Lba) >> 24) & 0x0F)); Out8(IO + ATA_REG_SEC_COUNT0, 1); @@ -157,6 +159,8 @@ Void drv_std_write(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorSz, SizeT Size) { UInt8 Command = ((!Master) ? 0xE0 : 0xF0); + Lba /= SectorSz; + Out8(IO + ATA_REG_HDDEVSEL, (Command) | (((Lba) >> 24) & 0x0F)); Out8(IO + ATA_REG_SEC_COUNT0, 1); @@ -175,7 +179,19 @@ Void drv_std_write(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, } } -/// @check is ATA detected? +/// @brief is ATA detected? Boolean drv_std_detected(Void) { return kATADetected; } +/*** + @brief Getter, gets the number of sectors inside the drive. +*/ +NewOS::SizeT drv_std_get_sector_count() { + return (kATAData[61] << 16)| kATAData[60]; +} + +/// @brief Get the drive size. +NewOS::SizeT drv_std_get_drv_size() { + return drv_std_get_sector_count() * kATASectorSize; +} + #endif /* ifdef __ATA_PIO__ */ |
