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.
This commit is contained in:
Drew Galbraith 2023-06-16 01:31:23 -07:00
parent ccfe1b15ab
commit e5da93757a
11 changed files with 171 additions and 84 deletions

33
sys/denali/ahci/command.h Normal file
View file

@ -0,0 +1,33 @@
#pragma once
#include <mammoth/memory_region.h>
#include <stdint.h>
#include "ahci/ahci.h"
class Command {
public:
virtual ~Command();
virtual void PopulateFis(uint8_t* command_fis) = 0;
virtual void PopulatePrdt(PhysicalRegionDescriptor* prdt) = 0;
virtual void Callback() = 0;
};
class DmaReadCommand : public Command {
public:
typedef void (*DmaCallback)(uint64_t, uint64_t, uint64_t);
DmaReadCommand(uint64_t lba, uint64_t sector_cnt, DmaCallback callback);
virtual ~DmaReadCommand() override;
void PopulateFis(uint8_t* command_fis) override;
void PopulatePrdt(PhysicalRegionDescriptor* prdt) override;
void Callback() override;
private:
uint64_t lba_;
uint64_t sector_cnt_;
DmaCallback callback_;
MappedMemoryRegion region_;
};