summaryrefslogtreecommitdiffhomepage
path: root/dev
diff options
context:
space:
mode:
authorAmlal <amlal.elmahrouss@icloud.com>2025-02-17 20:35:53 +0100
committerAmlal <amlal.elmahrouss@icloud.com>2025-02-17 20:35:53 +0100
commitbea589553fa9d33168e42bb83b77591fa8a0cad1 (patch)
treec59858647c4cfe94d4c3aff1dde105599d80f52e /dev
parentd3b39ca5bebf73804eae60e021e9083250195dc0 (diff)
ADD: Patch CountL and CountH in AHCI driver.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev')
-rw-r--r--dev/Boot/amd64-desktop.make22
-rw-r--r--dev/Boot/arm64-desktop.make2
-rw-r--r--dev/Boot/arm64-mobile.make2
-rw-r--r--dev/Boot/src/HEL/AMD64/BootEFI.cc5
-rw-r--r--dev/Kernel/HALKit/AMD64/Storage/AHCI.cc (renamed from dev/Kernel/HALKit/AMD64/Storage/SATA.cc)17
5 files changed, 27 insertions, 21 deletions
diff --git a/dev/Boot/amd64-desktop.make b/dev/Boot/amd64-desktop.make
index bb5deb71..208d6ff6 100644
--- a/dev/Boot/amd64-desktop.make
+++ b/dev/Boot/amd64-desktop.make
@@ -20,7 +20,7 @@ else
EMU=qemu-system-x86_64 -net none
endif
-ifeq ($(NEWS_MODEL), )
+ifeq ($(NEOS_MODEL), )
NE_MODEL=-DkMachineModel="\"NeOS\""
endif
@@ -28,6 +28,8 @@ BIOS=OVMF.fd
IMG=epm-master-1.img
IMG_2=epm-master-2.img
+BOOT=neos.iso
+
DISK_DRV =
ifneq ($(ATA_PIO_SUPPORT), )
@@ -48,14 +50,12 @@ endif
ifeq ($(shell uname), Darwin)
EMU_FLAGS=-net none -smp 4 -m 8G \
- -bios $(BIOS) -drive \
- file=fat:rw:src/Root/,index=3,format=raw
+ -bios $(BIOS) -cdrom $(BOOT) -boot d
endif
ifneq ($(shell uname), Darwin)
EMU_FLAGS=-net none -smp 4 -m 8G \
- -bios $(BIOS) -drive \
- file=fat:rw:src/Root/,index=3,format=raw -accel kvm
+ -bios $(BIOS) -M q35 -cdrom $(BOOT) -boot d -accel kvm
endif
LD_FLAGS=-e Main --subsystem=10
@@ -92,6 +92,12 @@ all: compile-amd64
$(COPY) ./Mod/SysChk/$(SYSCHK) src/Root/$(SYSCHK)
$(COPY) ../LibSCI/$(SCIKIT) src/Root/$(SCIKIT)
$(COPY) src/$(BOOTLOADER) src/Root/$(BOOTLOADER)
+ xorriso -as mkisofs -R -r -J \
+ -no-emul-boot -boot-load-size 4 -boot-info-table -hfsplus \
+ -apm-block-size 2048 --efi-boot EFI/BOOT/BOOTX64.EFI \
+ -efi-boot-part --efi-boot-image --protective-msdos-label \
+ src/Root -o $(BOOT)
+
ifneq ($(DEBUG_SUPPORT), )
DEBUG = -D__DEBUG__
@@ -107,15 +113,15 @@ compile-amd64:
.PHONY: run-efi-amd64-ahci
run-efi-amd64-ahci:
- $(EMU) $(EMU_FLAGS) -M q35 -hdc $(IMG) -s -S -trace ahci_*
+ $(EMU) $(EMU_FLAGS) -hda $(IMG) -s -S -trace ahci_* -boot menu=on
.PHONY: run-efi-amd64-ata-pio
run-efi-amd64-ata-pio:
- $(EMU) $(EMU_FLAGS) -M q35 -device piix3-ide,id=ide -drive id=disk,file=$(IMG),format=raw,if=none -device ide-hd,drive=disk,bus=ide.0 -s -S
+ $(EMU) $(EMU_FLAGS) -device piix3-ide,id=ide -drive id=disk,file=$(IMG),format=raw,if=none -device ide-hd,drive=disk,bus=ide.0 -s -S
.PHONY: run-efi-amd64-ata-dma
run-efi-amd64-ata-dma:
- $(EMU) $(EMU_FLAGS) -M q35 -device piix4-ide,id=ide -drive id=disk,file=$(IMG),format=raw,if=none -device ide-hd,drive=disk,bus=ide.0 -s -S
+ $(EMU) $(EMU_FLAGS) -device piix4-ide,id=ide -drive id=disk,file=$(IMG),format=raw,if=none -device ide-hd,drive=disk,bus=ide.0 -s -S
.PHONY: run-efi-amd64-ata
run-efi-amd64-ata: run-efi-amd64-ata-dma
diff --git a/dev/Boot/arm64-desktop.make b/dev/Boot/arm64-desktop.make
index 42aa1f57..5e78868f 100644
--- a/dev/Boot/arm64-desktop.make
+++ b/dev/Boot/arm64-desktop.make
@@ -18,7 +18,7 @@ else
EMU=qemu-system-aarch64
endif
-ifeq ($(NEWS_MODEL), )
+ifeq ($(NEOS_MODEL), )
NE_MODEL=-DkMachineModel="\"NeKernel\""
endif
diff --git a/dev/Boot/arm64-mobile.make b/dev/Boot/arm64-mobile.make
index 853d984a..809ad313 100644
--- a/dev/Boot/arm64-mobile.make
+++ b/dev/Boot/arm64-mobile.make
@@ -18,7 +18,7 @@ else
EMU=qemu-system-aarch64
endif
-ifeq ($(NEWS_MODEL), )
+ifeq ($(NEOS_MODEL), )
NE_MODEL=-DkMachineModel="\"NeKernel\""
endif
diff --git a/dev/Boot/src/HEL/AMD64/BootEFI.cc b/dev/Boot/src/HEL/AMD64/BootEFI.cc
index a8dc5561..b3e03f01 100644
--- a/dev/Boot/src/HEL/AMD64/BootEFI.cc
+++ b/dev/Boot/src/HEL/AMD64/BootEFI.cc
@@ -201,6 +201,11 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle,
while (BS->AllocatePool(EfiLoaderData, handover_hdr->f_BitMapSize, &handover_hdr->f_BitMapStart) != kEfiOk)
{
+ if (handover_hdr->f_BitMapStart)
+ {
+ BS->FreePool(handover_hdr->f_BitMapStart);
+ handover_hdr->f_BitMapStart = nullptr;
+ }
}
handover_hdr->f_FirmwareCustomTables[0] = (VoidPtr)BS;
diff --git a/dev/Kernel/HALKit/AMD64/Storage/SATA.cc b/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc
index 6651db8c..49025023 100644
--- a/dev/Kernel/HALKit/AMD64/Storage/SATA.cc
+++ b/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc
@@ -15,7 +15,6 @@
*
*/
-#include "HALKit/AMD64/Processor.h"
#include <KernelKit/UserProcessScheduler.h>
#include <KernelKit/LPC.h>
@@ -240,30 +239,26 @@ static Kernel::Void drv_std_input_output(Kernel::UInt64 lba, Kernel::UInt8* buff
command_header->Cfl = sizeof(FisRegH2D) / sizeof(Kernel::UInt32);
command_header->Write = Write;
- command_header->Prdtl = (size_buffer / kib_cast(8)) / sizeof(HbaPrdtEntry) + 1;
+ command_header->Prdtl = (size_buffer / 16) + 1;
volatile HbaCmdTbl* command_table = (volatile HbaCmdTbl*)((Kernel::UInt64)command_header->Ctba + command_header->Ctbau);
MUST_PASS(command_table);
- auto buffer_phys = Kernel::HAL::hal_get_phys_address(buffer);
+ auto buffer_phys = buffer;
- for (Kernel::SizeT i = 0; i < (command_header->Prdtl - 1); i++)
+ for (Kernel::SizeT i = 0; i < (command_header->Prdtl); ++i)
{
command_table->Prdt[i].Dba = ((Kernel::UInt32)(Kernel::UInt64)buffer_phys + (i * 16) & 0xFFFFFFFF);
command_table->Prdt[i].Dbau = (((Kernel::UInt64)(buffer_phys + (i * 16)) >> 32) & 0xFFFFFFFF);
command_table->Prdt[i].Dbc = (16 - 1);
command_table->Prdt[i].Ie = YES;
-
- buffer += 16;
}
volatile FisRegH2D* h2d_fis = (volatile FisRegH2D*)((Kernel::UInt64)&command_table->Cfis);
h2d_fis->FisType = kFISTypeRegH2D;
-
- h2d_fis->CmdOrCtrl = YES;
-
+ h2d_fis->CmdOrCtrl = CommandOrCTRL;
h2d_fis->Command = Write ? kAHCICmdWriteDmaEx : kAHCICmdReadDmaEx;
if (Identify)
@@ -278,8 +273,8 @@ static Kernel::Void drv_std_input_output(Kernel::UInt64 lba, Kernel::UInt8* buff
h2d_fis->Device = kSataLBAMode;
- h2d_fis->CountLow = sector_sz & 0xFF;
- h2d_fis->CountHigh = (sector_sz >> 8) & 0xFF;
+ h2d_fis->CountLow = (size_buffer) & 0xFF;
+ h2d_fis->CountHigh = (size_buffer >> 8) & 0xFF;
while ((kSATA->Ports[kSATAPortIdx].Tfd & (kAhciSRBsy | kAhciSRDrq)))
{