summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/HALKit/AMD64/Storage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-04-13 08:27:07 +0200
committerGitHub <noreply@github.com>2025-04-13 08:27:07 +0200
commit126cc73bb933cd1b550c8c5b97d8621717fb1e6b (patch)
treef67922ba36b8a4847b0f1854f77da4466e64f7e6 /dev/kernel/HALKit/AMD64/Storage
parent799327413742309ab5def75d310df28576aefc7e (diff)
parentf30470c40229806a33c914ebdd1dbdf037c9698d (diff)
Merge pull request #17 from amlel-el-mahrouss/dev
dev, scheduler, ahci, dev: Refactor scheduler, and fix minor mistakes.
Diffstat (limited to 'dev/kernel/HALKit/AMD64/Storage')
-rw-r--r--dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc20
1 files changed, 2 insertions, 18 deletions
diff --git a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
index f0893e2d..728b20ed 100644
--- a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
+++ b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
@@ -66,22 +66,6 @@ STATIC Int32 drv_find_cmd_slot_ahci(HbaPort* port) noexcept;
STATIC Void drv_compute_disk_ahci() noexcept;
-namespace AHCI::Detail
-{
- template <typename RetType>
- STATIC RetType* ahci_align_address(RetType* address, Int32 alignement)
- {
- if (!address)
- return nullptr;
-
- UIntPtr addr = (UIntPtr)address;
-
- UIntPtr aligned_addr = (addr + alignement - 1) & (~alignement - 1);
-
- return (RetType*)aligned_addr;
- }
-} // namespace AHCI::Detail
-
STATIC Void drv_compute_disk_ahci() noexcept
{
kSATASectorCount = 0UL;
@@ -90,18 +74,18 @@ STATIC Void drv_compute_disk_ahci() noexcept
const UInt16 kSzIdent = 512;
/// Push it to the stack
- UInt16* identify_data = AHCI::Detail::ahci_align_address<UInt16>(new UInt16[kSzIdent], kib_cast(1));
+ UInt16* identify_data = new UInt16[kSzIdent];
/// Send AHCI command for identification.
drv_std_input_output_ahci<NO, YES, YES>(0, (UInt8*)identify_data, kAHCISectorSize, kSzIdent);
/// Extract 48-bit LBA.
-
UInt64 lba48_sectors = 0;
lba48_sectors |= (UInt64)identify_data[100];
lba48_sectors |= (UInt64)identify_data[101] << 16;
lba48_sectors |= (UInt64)identify_data[102] << 32;
+ /// Now verify if lba48
if (lba48_sectors == 0)
kSATASectorCount = (identify_data[61] << 16) | identify_data[60];
else