summaryrefslogtreecommitdiffhomepage
path: root/Private/HALKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-04-06 14:52:33 +0200
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-04-06 14:52:33 +0200
commit32f75625830660468287de0f213baee760fc6384 (patch)
treeaaa8286ee13a4188d826d4efd59482c7b1aa0e73 /Private/HALKit
parent422b8029eba71b6fbb6b3dcb386b8e115bbd08ef (diff)
:boom: Breaking changes, disk API improvemenets and bringing support for
more drivers... Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/HALKit')
-rw-r--r--Private/HALKit/AMD64/HalACPIFactoryInterface.cxx8
-rw-r--r--Private/HALKit/AMD64/PCI/Device.cxx36
-rw-r--r--Private/HALKit/AMD64/PCI/Dma.cxx24
-rw-r--r--Private/HALKit/AMD64/PCI/Iterator.cxx4
-rw-r--r--Private/HALKit/AMD64/Processor.hpp1
-rw-r--r--Private/HALKit/AMD64/Storage/AHCI.cxx6
-rw-r--r--Private/HALKit/AMD64/Storage/ATA-DMA.cxx1
7 files changed, 39 insertions, 41 deletions
diff --git a/Private/HALKit/AMD64/HalACPIFactoryInterface.cxx b/Private/HALKit/AMD64/HalACPIFactoryInterface.cxx
index 4d1844d9..983c7219 100644
--- a/Private/HALKit/AMD64/HalACPIFactoryInterface.cxx
+++ b/Private/HALKit/AMD64/HalACPIFactoryInterface.cxx
@@ -21,8 +21,8 @@ void rt_shutdown_acpi_virtualbox(void) { HAL::Out16(0x4004, 0x3400); }
/// You have to parse the MADT!
ACPIFactoryInterface::ACPIFactoryInterface(voidPtr rsdPtr)
- : m_Rsdp(rsdPtr), m_Entries(0) {
- volatile RSDP *_rsdPtr = reinterpret_cast<volatile RSDP *>(this->m_Rsdp);
+ : fRsdp(rsdPtr), fEntries(0) {
+ volatile RSDP *_rsdPtr = reinterpret_cast<volatile RSDP *>(this->fRsdp);
MUST_PASS(_rsdPtr);
MUST_PASS(_rsdPtr->Revision >= 2);
@@ -48,13 +48,13 @@ Void ACPIFactoryInterface::Reboot() {
/// @brief Finds a descriptor table inside ACPI XSDT.
ErrorOr<voidPtr> ACPIFactoryInterface::Find(const char *signature) {
- MUST_PASS(m_Rsdp);
+ MUST_PASS(fRsdp);
if (!signature) return ErrorOr<voidPtr>{-2};
if (*signature == 0) return ErrorOr<voidPtr>{-3};
- RSDP *rsdPtr = reinterpret_cast<RSDP *>(this->m_Rsdp);
+ RSDP *rsdPtr = reinterpret_cast<RSDP *>(this->fRsdp);
if (rsdPtr->Revision <= 1) {
return ErrorOr<voidPtr>{-4};
diff --git a/Private/HALKit/AMD64/PCI/Device.cxx b/Private/HALKit/AMD64/PCI/Device.cxx
index f5f1d602..f6bf75da 100644
--- a/Private/HALKit/AMD64/PCI/Device.cxx
+++ b/Private/HALKit/AMD64/PCI/Device.cxx
@@ -31,59 +31,59 @@ void NewOSPCISetCfgTarget(NewOS::UInt bar, NewOS::UShort bus, NewOS::UShort dev,
namespace NewOS::PCI {
Device::Device(UShort bus, UShort device, UShort func, UShort bar)
- : m_Bus(bus), m_Device(device), m_Function(func), m_Bar(bar) {}
+ : fBus(bus), fDevice(device), fFunction(func), fBar(bar) {}
Device::~Device() {}
UInt Device::Read(UInt bar, Size sz) {
- NewOSPCISetCfgTarget(bar, m_Bus, m_Device, m_Function);
+ NewOSPCISetCfgTarget(bar, fBus, fDevice, fFunction);
if (sz == 4)
- return HAL::In32((UShort)PciConfigKind::ConfigData + (m_Bar & 3));
+ return HAL::In32((UShort)PciConfigKind::ConfigData + (fBar & 3));
if (sz == 2)
- return HAL::In16((UShort)PciConfigKind::ConfigData + (m_Bar & 3));
- if (sz == 1) return HAL::In8((UShort)PciConfigKind::ConfigData + (m_Bar & 3));
+ return HAL::In16((UShort)PciConfigKind::ConfigData + (fBar & 3));
+ if (sz == 1) return HAL::In8((UShort)PciConfigKind::ConfigData + (fBar & 3));
return 0xFFFF;
}
void Device::Write(UInt bar, UIntPtr data, Size sz) {
- NewOSPCISetCfgTarget(bar, m_Bus, m_Device, m_Function);
+ NewOSPCISetCfgTarget(bar, fBus, fDevice, fFunction);
if (sz == 4)
- HAL::Out32((UShort)PciConfigKind::ConfigData + (m_Bar & 3), (UInt)data);
+ HAL::Out32((UShort)PciConfigKind::ConfigData + (fBar & 3), (UInt)data);
if (sz == 2)
- HAL::Out16((UShort)PciConfigKind::ConfigData + (m_Bar & 3), (UShort)data);
+ HAL::Out16((UShort)PciConfigKind::ConfigData + (fBar & 3), (UShort)data);
if (sz == 1)
- HAL::Out8((UShort)PciConfigKind::ConfigData + (m_Bar & 3), (UChar)data);
+ HAL::Out8((UShort)PciConfigKind::ConfigData + (fBar & 3), (UChar)data);
}
UShort Device::DeviceId() {
- return (UShort)(NewOSPCIReadRaw(0x0 >> 16, m_Bus, m_Device, m_Function));
+ return (UShort)(NewOSPCIReadRaw(0x0 >> 16, fBus, fDevice, fFunction));
}
UShort Device::VendorId() {
- return (UShort)(NewOSPCIReadRaw(0x0, m_Bus, m_Device, m_Function) >> 16);
+ return (UShort)(NewOSPCIReadRaw(0x0, fBus, fDevice, fFunction) >> 16);
}
UShort Device::InterfaceId() {
- return (UShort)(NewOSPCIReadRaw(0x0, m_Bus, m_Device, m_Function) >> 16);
+ return (UShort)(NewOSPCIReadRaw(0x0, fBus, fDevice, fFunction) >> 16);
}
UChar Device::Class() {
- return (UChar)(NewOSPCIReadRaw(0x08, m_Bus, m_Device, m_Function) >> 24);
+ return (UChar)(NewOSPCIReadRaw(0x08, fBus, fDevice, fFunction) >> 24);
}
UChar Device::Subclass() {
- return (UChar)(NewOSPCIReadRaw(0x08, m_Bus, m_Device, m_Function) >> 16);
+ return (UChar)(NewOSPCIReadRaw(0x08, fBus, fDevice, fFunction) >> 16);
}
UChar Device::ProgIf() {
- return (UChar)(NewOSPCIReadRaw(0x08, m_Bus, m_Device, m_Function) >> 8);
+ return (UChar)(NewOSPCIReadRaw(0x08, fBus, fDevice, fFunction) >> 8);
}
UChar Device::HeaderType() {
- return (UChar)(NewOSPCIReadRaw(0xC, m_Bus, m_Device, m_Function) >> 16);
+ return (UChar)(NewOSPCIReadRaw(0xC, fBus, fDevice, fFunction) >> 16);
}
void Device::EnableMmio() {
@@ -100,9 +100,9 @@ UShort Device::Vendor() {
UShort vendor = VendorId();
if (vendor != (UShort)PciConfigKind::Invalid)
- m_Device = (UShort)Read(0x0, sizeof(UShort));
+ fDevice = (UShort)Read(0x0, sizeof(UShort));
- return m_Device;
+ return fDevice;
}
Device::operator bool() { return VendorId() != (UShort)PciConfigKind::Invalid; }
diff --git a/Private/HALKit/AMD64/PCI/Dma.cxx b/Private/HALKit/AMD64/PCI/Dma.cxx
index 1efef53b..f0a10eb9 100644
--- a/Private/HALKit/AMD64/PCI/Dma.cxx
+++ b/Private/HALKit/AMD64/PCI/Dma.cxx
@@ -7,36 +7,36 @@
#include <KernelKit/PCI/Dma.hpp>
namespace NewOS {
-DMAWrapper::operator bool() { return m_Address; }
+DMAWrapper::operator bool() { return fAddress; }
-bool DMAWrapper::operator!() { return !m_Address; }
+bool DMAWrapper::operator!() { return !fAddress; }
Boolean DMAWrapper::Check(UIntPtr offset) const {
- if (!m_Address) return false;
+ if (!fAddress) return false;
if (offset == 0) return true;
kcout << "[DMAWrapper::IsIn] Checking offset..\n";
- return reinterpret_cast<UIntPtr>(m_Address) >= offset;
+ return reinterpret_cast<UIntPtr>(fAddress) >= offset;
}
bool DMAWrapper::Write(const UIntPtr &bit, const UIntPtr &offset) {
- if (!m_Address) return false;
+ if (!fAddress) return false;
kcout << "[DMAWrapper::Write] Writing at address..\n";
auto addr =
- (volatile UIntPtr *)(reinterpret_cast<UIntPtr>(m_Address) + offset);
+ (volatile UIntPtr *)(reinterpret_cast<UIntPtr>(fAddress) + offset);
*addr = bit;
return true;
}
UIntPtr DMAWrapper::Read(const UIntPtr &offset) {
- kcout << "[DMAWrapper::Read] checking m_Address..\n";
- if (!m_Address) return 0;
+ kcout << "[DMAWrapper::Read] checking fAddress..\n";
+ if (!fAddress) return 0;
- kcout << "[DMAWrapper::Read] Reading m_Address..\n";
- return *(volatile UIntPtr *)(reinterpret_cast<UIntPtr>(m_Address) + offset);
+ kcout << "[DMAWrapper::Read] Reading fAddress..\n";
+ return *(volatile UIntPtr *)(reinterpret_cast<UIntPtr>(fAddress) + offset);
;
}
@@ -48,7 +48,7 @@ OwnPtr<IOBuf<Char *>> DMAFactory::Construct(OwnPtr<DMAWrapper> &dma) {
if (!dma) return {};
OwnPtr<IOBuf<Char *>> dmaOwnPtr =
- make_ptr<IOBuf<Char *>, char *>(reinterpret_cast<char *>(dma->m_Address));
+ make_ptr<IOBuf<Char *>, char *>(reinterpret_cast<char *>(dma->fAddress));
if (!dmaOwnPtr) return {};
@@ -57,7 +57,7 @@ OwnPtr<IOBuf<Char *>> DMAFactory::Construct(OwnPtr<DMAWrapper> &dma) {
}
DMAWrapper &DMAWrapper::operator=(voidPtr Ptr) {
- m_Address = Ptr;
+ fAddress = Ptr;
return *this;
}
} // namespace NewOS
diff --git a/Private/HALKit/AMD64/PCI/Iterator.cxx b/Private/HALKit/AMD64/PCI/Iterator.cxx
index 151d8780..25e83ada 100644
--- a/Private/HALKit/AMD64/PCI/Iterator.cxx
+++ b/Private/HALKit/AMD64/PCI/Iterator.cxx
@@ -18,7 +18,7 @@ Iterator::Iterator(const Types::PciDeviceKind &type) {
Device dev(bus, device, function, 0);
if (dev.Class() == (UChar)type) {
- m_Devices[bus].Leak().Leak() = dev;
+ fDevices[bus].Leak().Leak() = dev;
}
}
}
@@ -28,7 +28,7 @@ Iterator::Iterator(const Types::PciDeviceKind &type) {
Iterator::~Iterator() {}
Ref<PCI::Device> Iterator::operator[](const Size &sz) {
- PCI_ITERATOR_FIND_AND_UNWRAP(m_Devices[sz], sz);
+ PCI_ITERATOR_FIND_AND_UNWRAP(fDevices[sz], sz);
return {};
}
} // namespace NewOS::PCI
diff --git a/Private/HALKit/AMD64/Processor.hpp b/Private/HALKit/AMD64/Processor.hpp
index 472fd6df..a2aaf8f7 100644
--- a/Private/HALKit/AMD64/Processor.hpp
+++ b/Private/HALKit/AMD64/Processor.hpp
@@ -172,7 +172,6 @@ struct PACKED ALIGN(0x1000) NewOSGDT final {
} // namespace Detail
} // namespace NewOS::HAL
-EXTERN_C void idt_handle_system_call(NewOS::UIntPtr rsp);
EXTERN_C void idt_handle_generic(NewOS::UIntPtr rsp);
EXTERN_C void idt_handle_gpf(NewOS::UIntPtr rsp);
EXTERN_C void idt_handle_math(NewOS::UIntPtr rsp);
diff --git a/Private/HALKit/AMD64/Storage/AHCI.cxx b/Private/HALKit/AMD64/Storage/AHCI.cxx
index 35308582..2b58b744 100644
--- a/Private/HALKit/AMD64/Storage/AHCI.cxx
+++ b/Private/HALKit/AMD64/Storage/AHCI.cxx
@@ -49,11 +49,9 @@ NewOS::Boolean drv_std_detected(NewOS::Void) {
return kAhciDevice.DeviceId() != 0xFFFF;
}
-NewOS::Void drv_std_read(NewOS::UInt64 Lba, NewOS::UInt16 IO,
- NewOS::UInt8 Master, NewOS::Char* Buf,
+NewOS::Void drv_std_read(NewOS::UInt64 Lba, NewOS::Char* Buf,
NewOS::SizeT SectorSz, NewOS::SizeT Size) {}
-NewOS::Void drv_std_write(NewOS::UInt64 Lba, NewOS::UInt16 IO,
- NewOS::UInt8 Master, NewOS::Char* Buf,
+NewOS::Void drv_std_write(NewOS::UInt64 Lba, NewOS::Char* Buf,
NewOS::SizeT SectorSz, NewOS::SizeT Size) {}
#endif // __AHCI__ \ No newline at end of file
diff --git a/Private/HALKit/AMD64/Storage/ATA-DMA.cxx b/Private/HALKit/AMD64/Storage/ATA-DMA.cxx
index d3e90f67..523c7e17 100644
--- a/Private/HALKit/AMD64/Storage/ATA-DMA.cxx
+++ b/Private/HALKit/AMD64/Storage/ATA-DMA.cxx
@@ -23,6 +23,7 @@
using namespace NewOS;
EXTERN_C Int32 kPRDTTransferStatus;
+STATIC PRDT kPRDT;
#ifdef __ATA_DMA__