From eddb029b924d8ddf930667071878b4553c193492 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 4 Feb 2024 21:12:23 +0100 Subject: HCR-11 : Kernel: Update kDeviceType enum. Signed-off-by: Amlal El Mahrouss --- Private/Source/Storage/ATA.cxx | 15 ++++++++------- Private/Source/Storage/Storage.cxx | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'Private/Source') diff --git a/Private/Source/Storage/ATA.cxx b/Private/Source/Storage/ATA.cxx index 47c05ac8..6027e6f9 100644 --- a/Private/Source/Storage/ATA.cxx +++ b/Private/Source/Storage/ATA.cxx @@ -10,8 +10,10 @@ #include #include +#define kBufferLen 512 + //! @brief ATA DMA Driver -//! @todo: Rework into a proper ATA DMA. +//! The idea is to let a driver do the transfer. /// bugs 0 @@ -42,25 +44,24 @@ enum { const char* ata_read_28(ULong lba) { if (!kPrdt) return nullptr; - static char buffer[512]; + char* buffer = reinterpret_cast(Alloca(sizeof(char) * kBufferLen)); + rt_set_memory(buffer, 0, kBufferLen); - UIntPtr* packet = (UIntPtr*)kPrdt.Leak()->PhysicalAddress(); + UIntPtr* packet = reinterpret_cast(kPrdt.Leak()->PhysicalAddress()); packet[0] = k28BitRead; packet[1] = (UIntPtr)&buffer; - packet[2] = lba; + packet[4] = lba; rt_wait_for_io(); return buffer; } -#define kBufferLen 512 - const char* ata_read_48(ULong lba) { if (!kPrdt) return nullptr; - static char buffer[kBufferLen]; + char* buffer = reinterpret_cast(Alloca(sizeof(char) * kBufferLen)); rt_set_memory(buffer, 0, kBufferLen); UIntPtr* packet = reinterpret_cast(kPrdt.Leak()->PhysicalAddress()); diff --git a/Private/Source/Storage/Storage.cxx b/Private/Source/Storage/Storage.cxx index 7d4ba70a..2fd5b29b 100644 --- a/Private/Source/Storage/Storage.cxx +++ b/Private/Source/Storage/Storage.cxx @@ -9,5 +9,6 @@ #include +///! @brief ATAPI SCSI packet. const SKScsiPacket kCDRomPacketTemplate = {0x43, 0, 1, 0, 0, 0, 0, 12, 0x40, 0, 0}; -- cgit v1.2.3