Kernel: Move DEBUG_* macros to centralized Debug.h

This makes toggling debug info much easier
This commit is contained in:
2024-09-20 11:00:07 +03:00
parent bc0acc6f44
commit 23d6205659
17 changed files with 49 additions and 57 deletions

View File

@@ -4,8 +4,6 @@
#include <kernel/Storage/DiskCache.h>
#include <kernel/Storage/StorageDevice.h>
#define DEBUG_SYNC 0
namespace Kernel
{
@@ -127,7 +125,7 @@ namespace Kernel
sector_start++;
else
{
dprintln_if(DEBUG_SYNC, "syncing {}->{}", cache.first_sector + sector_start, cache.first_sector + sector_start + sector_count);
dprintln_if(DEBUG_DISK_SYNC, "syncing {}->{}", cache.first_sector + sector_start, cache.first_sector + sector_start + sector_count);
auto data_slice = m_sync_cache.span().slice(sector_start * m_sector_size, sector_count * m_sector_size);
TRY(m_device.write_sectors_impl(cache.first_sector + sector_start, sector_count, data_slice));
sector_start += sector_count + 1;
@@ -137,7 +135,7 @@ namespace Kernel
if (sector_count > 0)
{
dprintln_if(DEBUG_SYNC, "syncing {}->{}", cache.first_sector + sector_start, cache.first_sector + sector_start + sector_count);
dprintln_if(DEBUG_DISK_SYNC, "syncing {}->{}", cache.first_sector + sector_start, cache.first_sector + sector_start + sector_count);
auto data_slice = m_sync_cache.span().slice(sector_start * m_sector_size, sector_count * m_sector_size);
TRY(m_device.write_sectors_impl(cache.first_sector + sector_start, sector_count, data_slice));
}

View File

@@ -7,8 +7,6 @@
#include <sys/sysmacros.h>
#define DEBUG_NVMe 1
namespace Kernel
{
@@ -65,8 +63,8 @@ namespace Kernel
return BAN::Error::from_errno(ENOTSUP);
}
dprintln_if(DEBUG_NVMe, "NVMe controller");
dprintln_if(DEBUG_NVMe, " version: {}.{}", (uint16_t)vs.major, (uint8_t)vs.minor);
dprintln("NVMe controller");
dprintln(" version: {}.{}", (uint16_t)vs.major, (uint8_t)vs.minor);
auto& cap = m_controller_registers->cap;
if (!(cap.css & NVMe::CAP_CSS_NVME))
@@ -160,7 +158,7 @@ namespace Kernel
return BAN::Error::from_errno(EFAULT);
}
dprintln_if(DEBUG_NVMe, " model: '{}'", BAN::StringView { (char*)dma_page->vaddr() + 24, 20 });
dprintln(" model: '{}'", BAN::StringView { (char*)dma_page->vaddr() + 24, 20 });
return {};
}