mirror of
https://github.com/justinian/jsix.git
synced 2025-12-12 09:24:31 -08:00
Add some AHCI debugging dumps
This commit is contained in:
@@ -62,6 +62,8 @@ hba::hba(pci_device *device)
|
||||
device_manager &dm = device_manager::get();
|
||||
|
||||
uint32_t bar5 = device->get_bar(5);
|
||||
log::debug(logs::driver, "HBA raw BAR5 is %08lx", bar5);
|
||||
|
||||
m_data = reinterpret_cast<hba_data *>(bar5 & ~0xfffull);
|
||||
pm->map_offset_pointer(reinterpret_cast<void **>(&m_data), 0x2000);
|
||||
|
||||
@@ -93,6 +95,7 @@ hba::hba(pci_device *device)
|
||||
m_data->host_control |= 0x02; // enable interrupts
|
||||
}
|
||||
|
||||
dump();
|
||||
for (auto &p : m_ports) {
|
||||
if (!p.active()) continue;
|
||||
|
||||
|
||||
@@ -301,11 +301,17 @@ port::read_async(uint64_t offset, size_t length, void *dest)
|
||||
size_t
|
||||
port::read(uint64_t offset, size_t length, void *dest)
|
||||
{
|
||||
dump();
|
||||
int slot = read_async(offset, length, dest);
|
||||
dump();
|
||||
|
||||
int timeout = 0;
|
||||
while (m_pending[slot].type == command_type::read) {
|
||||
if (timeout++ > 10) return 0;
|
||||
if (timeout++ > 5) {
|
||||
m_hba->dump();
|
||||
dump();
|
||||
return 0;
|
||||
}
|
||||
asm("hlt");
|
||||
}
|
||||
kassert(m_pending[slot].type == command_type::finished,
|
||||
|
||||
Reference in New Issue
Block a user