From 28d79ed03fcec2d31da42c70923741973e7ce916 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Wed, 31 Jul 2013 20:06:05 +0000 Subject: [PATCH] Network drivers now print driver name on debug output. git-svn-id: svn://kolibrios.org@3845 a494cfbc-eb01-0410-851d-a64ba20cac60 --- drivers/ethernet/i8255x.asm | 37 +++++++++++++++++-------------------- drivers/netdrv.inc | 11 +++++++++++ 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/ethernet/i8255x.asm b/drivers/ethernet/i8255x.asm index c607d188fa..56ac437ef9 100644 --- a/drivers/ethernet/i8255x.asm +++ b/drivers/ethernet/i8255x.asm @@ -30,7 +30,7 @@ format MS COFF DEBUG = 1 __DEBUG__ = 1 - __DEBUG_LEVEL__ = 2 + __DEBUG_LEVEL__ = 2 ; 1 = verbose, 2 = errors only include '../proc32.inc' include '../imports.inc' @@ -194,7 +194,7 @@ proc START stdcall, state:dword .entry: - DEBUGF 1,"Loading %s driver\n", my_service + DEBUGF 1,"Loading driver\n" stdcall RegService, my_service, service_proc ret @@ -294,7 +294,7 @@ proc service_proc stdcall, ioctl:dword PCI_find_irq - DEBUGF 2,"Hooking into device, dev:%x, bus:%x, irq:%x, addr:%x\n",\ + DEBUGF 1,"Hooking into device, dev:%x, bus:%x, irq:%x, addr:%x\n",\ [device.pci_dev]:1,[device.pci_bus]:1,[device.irq_line]:1,[device.io_addr]:4 ; Ok, the eth_device structure is ready, let's probe the device @@ -376,7 +376,7 @@ ret align 4 probe: - DEBUGF 1,"Probing i8255x\n" + DEBUGF 1,"Probing\n" PCI_make_bus_master @@ -400,7 +400,7 @@ probe: jmp .found .notfound: - DEBUGF 1,"ERROR: Unsupported device!\n" + DEBUGF 2,"Unsupported device!\n" or eax, -1 ret @@ -427,12 +427,12 @@ reset: stdcall AttachIntHandler, eax, int_handler, dword 0 test eax, eax jnz @f - DEBUGF 1,"\nCould not attach int handler!\n" + DEBUGF 2,"Could not attach int handler!\n" ; or eax, -1 ; ret @@: - DEBUGF 1,"Resetting %s\n", my_service + DEBUGF 1,"Resetting\n" ;--------------- ; reset the card @@ -558,7 +558,7 @@ reset: ; Indicate that we have successfully reset the card - DEBUGF 1,"Resetting %s complete\n", my_service + DEBUGF 1,"Reset complete\n" mov [device.mtu], 1514 @@ -693,7 +693,7 @@ int_handler: push ebx esi edi - DEBUGF 1,"\n%s int\n", my_service + DEBUGF 1,"INT\n" ; find pointer of device wich made IRQ occur @@ -861,7 +861,7 @@ cmd_wait: align 4 ee_read: ; esi = address to read - DEBUGF 1,"Eeprom read from 0x%x", esi + DEBUGF 1,"Eeprom read from 0x%x\n", esi set_io 0 set_io reg_eeprom @@ -931,7 +931,7 @@ ee_read: ; esi = address to read out dx, ax - DEBUGF 1,"=0x%x\n", esi:4 + DEBUGF 1,"0x%x\n", esi:4 ret @@ -1011,8 +1011,6 @@ ee_write: ; esi = address to write to, di = data align 4 ee_get_width: -; DEBUGF 1,"Eeprom get width\n" - set_io 0 set_io reg_eeprom @@ -1044,21 +1042,20 @@ ee_get_width: test al, EE_DO jnz .loop - .give_up: xor al, al out dx, al ; de-activate eeprom sub cl, 3 ; dont count the opcode bits - mov [device.ee_bus_width], cl - DEBUGF 1,"Eeprom width=%u bit\n", ecx + DEBUGF 1, "Eeprom width=%u bit\n", ecx + ret -;----------------------- -; de-activate the eeprom + .give_up: + DEBUGF 2, "Eeprom not found!\n" - xor eax, eax - out dx, eax + xor al, al + out dx, al ; de-activate eeprom ret diff --git a/drivers/netdrv.inc b/drivers/netdrv.inc index 222bf1ebe1..9ca268d15b 100644 --- a/drivers/netdrv.inc +++ b/drivers/netdrv.inc @@ -11,6 +11,17 @@ include 'pci.inc' include 'mii.inc' +; This macro will prepend driver name to all debug output through DEBUGF macro +; The driver name is taken from my_service label + +if defined my_service + + macro DEBUGF _level,_format, [args] { + common DEBUGF _level, "%s: " # _format, my_service, args + } + +end if + ; Kernel variables PAGESIZE = 4096