First iteration of denali server
This commit is contained in:
parent
82b1a5c4db
commit
ffa2d97a64
18 changed files with 273 additions and 39 deletions
|
|
@ -74,7 +74,7 @@ z_err_t AhciDevice::SendIdentify() {
|
|||
memcpy(command_table_->command_fis, &fis, sizeof(fis));
|
||||
|
||||
commands_[0].region = MappedMemoryRegion::ContiguousPhysical(512);
|
||||
commands_[0].callback = HandleIdent;
|
||||
// commands_[0].callback = HandleIdent;
|
||||
|
||||
command_table_->prds[0].region_address = commands_[0].region.paddr();
|
||||
command_table_->prds[0].byte_count = 512;
|
||||
|
|
@ -119,7 +119,7 @@ void AhciDevice::HandleIrq() {
|
|||
|
||||
for (uint64_t i = 0; i < 32; i++) {
|
||||
if (commands_finished & (1 << i)) {
|
||||
commands_[i].callback(this);
|
||||
// commands_[i].callback(this);
|
||||
commands_issued_ &= ~(1 << i);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,9 +29,8 @@ class AhciDevice {
|
|||
CommandTable* command_table_ = nullptr;
|
||||
|
||||
struct Command {
|
||||
typedef void (*Callback)(AhciDevice*);
|
||||
MappedMemoryRegion region;
|
||||
Callback callback;
|
||||
// std::function<void(MappedMemoryRegion)> callback;
|
||||
};
|
||||
Command commands_[32];
|
||||
uint32_t commands_issued_ = 0;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,19 @@ z_err_t AhciDriver::Init() {
|
|||
return Z_OK;
|
||||
}
|
||||
|
||||
z_err_t AhciDriver::GetDevice(uint64_t id, AhciDevice& device) {
|
||||
if (id >= 32) {
|
||||
return Z_ERR_INVALID;
|
||||
}
|
||||
|
||||
if (!devices_[id].IsInit()) {
|
||||
return Z_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
device = devices_[id];
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
void AhciDriver::DumpCapabilities() {
|
||||
dbgln("AHCI Capabilities:");
|
||||
uint32_t caps = ahci_hba_->capabilities;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ class AhciDriver {
|
|||
|
||||
void InterruptLoop();
|
||||
|
||||
z_err_t GetDevice(uint64_t id, AhciDevice& device);
|
||||
|
||||
void DumpCapabilities();
|
||||
void DumpPorts();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue