acadia/sys/denali/ahci/ahci_device.h
Drew Galbraith e5da93757a Working AHCI DMA IPC from yellowstone to denali.
We have a weird bug in context switching where a process's rsp0 ends up
pointing at the wrong value sometimes which crashes the OS.
2023-06-16 01:31:23 -07:00

36 lines
790 B
C++

#pragma once
#include <mammoth/memory_region.h>
#include <zerrors.h>
#include "ahci/ahci.h"
#include "ahci/command.h"
class AhciDevice {
public:
AhciDevice() {}
// Caller retains ownership of the pointer.
AhciDevice(AhciPort* port_struct);
void DumpInfo();
bool IsInit() { return port_struct_ != nullptr && command_structures_; }
z_err_t IssueCommand(Command* command);
void HandleIrq();
AhciDevice(const AhciDevice&) = delete;
AhciDevice& operator=(const AhciDevice&) = delete;
private:
AhciPort* port_struct_ = nullptr;
MappedMemoryRegion command_structures_;
CommandList* command_list_ = nullptr;
ReceivedFis* received_fis_ = nullptr;
CommandTable* command_table_ = nullptr;
Command* commands_[32];
volatile uint32_t commands_issued_ = 0;
};