[Mammoth] Move most classes to the mmth namespace.

This commit is contained in:
Drew Galbraith 2023-11-22 14:59:41 -08:00
parent 5f8d577948
commit 8d730c67c1
42 changed files with 130 additions and 60 deletions

View file

@ -14,7 +14,8 @@ AhciDevice::AhciDevice(AhciPort* port) : port_struct_(port) {
// 0x400-0x500 -> Received FIS
// 0x500-0x2500 -> Command Tables (0x100 each) (Max PRDT Length is 8 for now)
uint64_t paddr;
command_structures_ = OwnedMemoryRegion::ContiguousPhysical(0x2500, &paddr);
command_structures_ =
mmth::OwnedMemoryRegion::ContiguousPhysical(0x2500, &paddr);
command_list_ = reinterpret_cast<CommandList*>(command_structures_.vaddr());
port_struct_->command_list_base = paddr;

View file

@ -26,7 +26,7 @@ class AhciDevice {
private:
AhciPort* port_struct_ = nullptr;
OwnedMemoryRegion command_structures_;
mmth::OwnedMemoryRegion command_structures_;
CommandList* command_list_ = nullptr;
ReceivedFis* received_fis_ = nullptr;

View file

@ -21,7 +21,7 @@ void interrupt_thread(void* void_driver) {
} // namespace
glcr::ErrorOr<glcr::UniquePtr<AhciDriver>> AhciDriver::Init(
OwnedMemoryRegion&& pci_region) {
mmth::OwnedMemoryRegion&& pci_region) {
glcr::UniquePtr<AhciDriver> driver(new AhciDriver(glcr::Move(pci_region)));
// RET_ERR(driver->LoadCapabilities());
RET_ERR(driver->LoadHbaRegisters());
@ -191,8 +191,8 @@ glcr::ErrorCode AhciDriver::RegisterIrq() {
}
glcr::ErrorCode AhciDriver::LoadHbaRegisters() {
ahci_region_ =
OwnedMemoryRegion ::DirectPhysical(pci_device_header_->abar, 0x1100);
ahci_region_ = mmth::OwnedMemoryRegion ::DirectPhysical(
pci_device_header_->abar, 0x1100);
ahci_hba_ = reinterpret_cast<AhciHba*>(ahci_region_.vaddr());
num_ports_ = (ahci_hba_->capabilities & 0x1F) + 1;
num_commands_ = ((ahci_hba_->capabilities & 0x1F00) >> 8) + 1;

View file

@ -11,7 +11,7 @@
class AhciDriver {
public:
static glcr::ErrorOr<glcr::UniquePtr<AhciDriver>> Init(
OwnedMemoryRegion&& ahci_phys);
mmth::OwnedMemoryRegion&& ahci_phys);
glcr::ErrorCode RegisterIrq();
void InterruptLoop();
@ -22,9 +22,9 @@ class AhciDriver {
void DumpPorts();
private:
OwnedMemoryRegion pci_region_;
mmth::OwnedMemoryRegion pci_region_;
PciDeviceHeader* pci_device_header_ = nullptr;
OwnedMemoryRegion ahci_region_;
mmth::OwnedMemoryRegion ahci_region_;
AhciHba* ahci_hba_ = nullptr;
// TODO: Allocate these dynamically.
@ -40,7 +40,7 @@ class AhciDriver {
glcr::ErrorCode LoadHbaRegisters();
glcr::ErrorCode LoadDevices();
AhciDriver(OwnedMemoryRegion&& pci_region)
AhciDriver(mmth::OwnedMemoryRegion&& pci_region)
: pci_region_(glcr::Move(pci_region)),
pci_device_header_(
reinterpret_cast<PciDeviceHeader*>(pci_region_.vaddr())) {}

View file

@ -32,5 +32,5 @@ class DmaReadCommand : public Command {
uint64_t paddr_;
// TODO: Make this owned by the device so that we don't have to create a new
// one with the kernel every time a command is issued.
Semaphore callback_semaphore_;
mmth::Semaphore callback_semaphore_;
};