mirror of
https://github.com/justinian/jsix.git
synced 2025-12-12 09:24:31 -08:00
Add GPT partition handling as virtual block devices
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "ahci/hba.h"
|
||||
#include "console.h"
|
||||
#include "device_manager.h"
|
||||
#include "fs/gpt.h"
|
||||
#include "log.h"
|
||||
#include "page_manager.h"
|
||||
#include "pci.h"
|
||||
@@ -85,15 +86,20 @@ hba::hba(pci_device *device)
|
||||
port &p = m_ports.emplace(this, i, kutil::offset_pointer(pd, 0x80 * i), impl);
|
||||
if (p.get_state() == port::state::active)
|
||||
needs_interrupt = true;
|
||||
|
||||
if (p.get_type() == sata_signature::sata_drive)
|
||||
dm.register_block_device(&p);
|
||||
}
|
||||
|
||||
if (needs_interrupt) {
|
||||
device_manager::get().allocate_msi("AHCI Device", *device, irq_cb, this);
|
||||
m_data->host_control |= 0x02; // enable interrupts
|
||||
}
|
||||
|
||||
for (auto &p : m_ports) {
|
||||
if (p.get_state() == port::state::active &&
|
||||
p.get_type() == sata_signature::sata_drive) {
|
||||
if (fs::partition::load(&p) == 0)
|
||||
dm.register_block_device(&p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -387,6 +387,9 @@ port::finish_read(int slot)
|
||||
static_cast<addr_t>(cmdt.entries[i].data_base_high) << 32;
|
||||
|
||||
void *mem = kutil::offset_pointer(pm->offset_virt(phys), offset);
|
||||
|
||||
log::debug(logs::driver, "Reading PRD %2d: %016lx->%016lx [%lxb]", i, mem, p, prd_len);
|
||||
|
||||
kutil::memcpy(p, mem, prd_len);
|
||||
p = kutil::offset_pointer(p, prd_len - offset);
|
||||
count += (prd_len - offset);
|
||||
|
||||
Reference in New Issue
Block a user