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

@@ -2,8 +2,6 @@
#include <kernel/Scheduler.h>
#include <kernel/Timer/Timer.h>
#define DEBUG_ARP 0
namespace Kernel
{

View File

@@ -6,8 +6,6 @@
#include <kernel/Networking/E1000/E1000.h>
#include <kernel/Networking/NetworkManager.h>
#define DEBUG_E1000 1
namespace Kernel
{
@@ -68,10 +66,8 @@ namespace Kernel
detect_eeprom();
TRY(read_mac_address());
#if DEBUG_E1000
dprintln("E1000 at PCI {}:{}.{}", m_pci_device.bus(), m_pci_device.dev(), m_pci_device.func());
dprintln(" MAC: {}", m_mac_address);
#endif
TRY(initialize_rx());
TRY(initialize_tx());
@@ -81,14 +77,12 @@ namespace Kernel
m_link_up = !!(read32(REG_STATUS) & STATUS_LU);
#if DEBUG_E1000
dprintln(" link up: {}", link_up());
if (link_up())
{
int speed = link_speed();
dprintln(" link speed: {} Mbps", speed);
}
#endif
return {};
}
@@ -285,6 +279,8 @@ namespace Kernel
while (descriptor.status == 0)
continue;
dprintln_if(DEBUG_E1000, "sent {} bytes", sizeof(EthernetHeader) + buffer.size());
return {};
}
@@ -303,6 +299,8 @@ namespace Kernel
break;
ASSERT(descriptor.length <= E1000_RX_BUFFER_SIZE);
dprintln_if(DEBUG_E1000, "got {} bytes", (uint16_t)descriptor.length);
NetworkManager::get().on_receive(*this, BAN::ConstByteSpan {
reinterpret_cast<const uint8_t*>(m_rx_buffer_region->vaddr() + rx_current * E1000_RX_BUFFER_SIZE),
descriptor.length

View File

@@ -9,8 +9,6 @@
#include <netinet/in.h>
#define DEBUG_IPV4 0
namespace Kernel
{

View File

@@ -10,8 +10,6 @@
#include <kernel/Networking/UDPSocket.h>
#include <kernel/Networking/UNIX/Socket.h>
#define DEBUG_ETHERTYPE 0
namespace Kernel
{

View File

@@ -7,8 +7,6 @@
#include <fcntl.h>
#include <netinet/in.h>
#define DEBUG_TCP 0
namespace Kernel
{