From 5aa5ce24e2adc2c1b0803e66ffba1748bc86de8f Mon Sep 17 00:00:00 2001 From: beveloper Date: Sat, 12 Jun 2004 21:47:14 +0000 Subject: [PATCH] Huge cleanup of debugging code. Also fixed a few warnings. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7935 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/drivers/network/ipro1000/debug.h | 65 +++-- .../kernel/drivers/network/ipro1000/device.c | 64 +++-- .../kernel/drivers/network/ipro1000/driver.c | 20 +- .../drivers/network/ipro1000/if_compat.c | 8 +- .../kernel/drivers/network/ipro1000/if_em.c | 59 +++-- .../kernel/drivers/network/ipro1000/if_em.h | 16 +- .../drivers/network/ipro1000/if_em_hw.c | 227 +++++++++--------- .../drivers/network/ipro1000/if_em_osdep.c | 10 +- .../drivers/network/ipro1000/if_em_osdep.h | 21 +- .../kernel/drivers/network/ipro1000/mempool.c | 10 +- .../kernel/drivers/network/ipro1000/setup.h | 8 +- .../kernel/drivers/network/ipro1000/util.c | 8 +- 12 files changed, 249 insertions(+), 267 deletions(-) diff --git a/src/add-ons/kernel/drivers/network/ipro1000/debug.h b/src/add-ons/kernel/drivers/network/ipro1000/debug.h index 9b558c5b0d..15abdabc3b 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/debug.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/debug.h @@ -23,31 +23,54 @@ #ifdef DEBUG - #define TRACE(a...) dprintf("ipro1000: " a) - #define ASSERT(a) if (a) ; else panic("ipro1000: ASSERT failed, " #a) - - /* used by if_em.h */ - #define DEBUG_INIT 1 - #define DEBUG_IOCTL 1 - #define DEBUG_HW 1 - #define DEBUG_TRACE_STATS 1 - #define DBG_STATS 1 + /* Set these to 1 to enable debugging */ + #define DEBUG_DEVICE 0 + #define DEBUG_INIT 0 + #define DEBUG_IOCTL 0 + #define DEBUG_HW 0 + #define DEBUG_FUNC_CALLS 0 + #define DEBUG_DISPLAY_STATS 1 + #define ASSERT(a) if (a) ; else panic("ipro1000: ASSERT failed, " #a) + #define DEBUGFUNC(S) if (DEBUG_FUNC_CALLS) dprintf("ipro1000: " S "\n") + #define DEVICE_DEBUGOUT(S) if (DEBUG_DEVICE) dprintf("ipro1000: " S "\n") + #define DEVICE_DEBUGOUT1(S,A) if (DEBUG_DEVICE) dprintf("ipro1000: " S "\n", A) + #define DEVICE_DEBUGOUT2(S,A,B) if (DEBUG_DEVICE) dprintf("ipro1000: " S "\n", A, B) + #define INIT_DEBUGOUT(S) if (DEBUG_INIT) dprintf("ipro1000: " S "\n") + #define INIT_DEBUGOUT1(S,A) if (DEBUG_INIT) dprintf("ipro1000: " S "\n", A) + #define INIT_DEBUGOUT2(S,A,B) if (DEBUG_INIT) dprintf("ipro1000: " S "\n", A, B) + #define INIT_DEBUGOUT3(S,A,B,C) if (DEBUG_INIT) dprintf("ipro1000: " S "\n", A, B, C) + #define INIT_DEBUGOUT7(S,A,B,C,D,E,F,G) if (DEBUG_INIT) dprintf("ipro1000: " S "\n", A,B,C,D,E,F,G) + #define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) dprintf("ipro1000: " S "\n") + #define IOCTL_DEBUGOUT1(S,A) if (DEBUG_IOCTL) dprintf("ipro1000: " S "\n", A) + #define IOCTL_DEBUGOUT2(S,A,B) if (DEBUG_IOCTL) dprintf("ipro1000: " S "\n", A, B) + #define HW_DEBUGOUT(S) if (DEBUG_HW) dprintf("ipro1000: " S "\n") + #define HW_DEBUGOUT1(S,A) if (DEBUG_HW) dprintf("ipro1000: " S "\n", A) + #define HW_DEBUGOUT2(S,A,B) if (DEBUG_HW) dprintf("ipro1000: " S "\n", A, B) + #define HW_DEBUGOUT7(S,A,B,C,D,E,F,G) if (DEBUG_HW) dprintf("ipro1000: " S "\n", A,B,C,D,E,F,G) #else - - #define TRACE(a...) + #define DEBUG_DISPLAY_STATS 0 + #define DEBUGFUNC(S) + #define DEVICE_DEBUGOUT(S) + #define DEVICE_DEBUGOUT1(S,A) + #define DEVICE_DEBUGOUT2(S,A,B) + #define INIT_DEBUGOUT(S) + #define INIT_DEBUGOUT1(S,A) + #define INIT_DEBUGOUT2(S,A,B) + #define INIT_DEBUGOUT3(S,A,B,C) + #define INIT_DEBUGOUT7(S,A,B,C,D,E,F,G) + #define IOCTL_DEBUGOUT(S) + #define IOCTL_DEBUGOUT1(S,A) + #define IOCTL_DEBUGOUT2(S,A,B) + #define HW_DEBUGOUT(S) + #define HW_DEBUGOUT1(S,A) + #define HW_DEBUGOUT2(S,A,B) + #define HW_DEBUGOUT7(S,A,B,C,D,E,F,G) #define ASSERT(a) - - /* used by if_em.h */ - #define DEBUG_INIT 0 - #define DEBUG_IOCTL 0 - #define DEBUG_HW 0 - #define DEBUG_TRACE_STATS 0 - #undef DBG_STATS - #endif -#define ERROR(a...) dprintf("ipro1000: ERROR " a) -#define PRINT(a...) dprintf("ipro1000: " a) +#define ERROROUT(S) dprintf("ipro1000: ERROR " S "\n") +#define ERROROUT1(S,A) dprintf("ipro1000: ERROR " S "\n", A) +#define ERROROUT3(S,A,B,C) dprintf("ipro1000: ERROR " S "\n", A,B,C) #endif diff --git a/src/add-ons/kernel/drivers/network/ipro1000/device.c b/src/add-ons/kernel/drivers/network/ipro1000/device.c index d41e487389..b0f07e0a01 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/device.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/device.c @@ -24,8 +24,6 @@ #include #include -//#define DEBUG - #include "debug.h" #include "device.h" #include "driver.h" @@ -72,14 +70,14 @@ ipro1000_open(const char *name, uint32 flags, void** cookie) int dev_id; int mask; - TRACE("ipro1000_open()\n"); + DEVICE_DEBUGOUT("ipro1000_open()"); for (dev_id = 0; (deviceName = gDevNameList[dev_id]) != NULL; dev_id++) { if (!strcmp(name, deviceName)) break; } if (deviceName == NULL) { - ERROR("invalid device name"); + ERROROUT("invalid device name"); return B_ERROR; } @@ -110,7 +108,7 @@ ipro1000_open(const char *name, uint32 flags, void** cookie) ipro1000_read_settings(device); if (em_attach(device) != 0) { - TRACE("em_attach failed\n"); + DEVICE_DEBUGOUT("em_attach failed"); goto err; } @@ -128,7 +126,7 @@ ipro1000_close(void* cookie) { ipro1000_device *device = (ipro1000_device *)cookie; struct ifnet *ifp = &device->adapter->interface_data.ac_if; - TRACE("ipro1000_close()\n"); + DEVICE_DEBUGOUT("ipro1000_close()"); device->closed = true; release_sem(ifp->if_rcv_sem); @@ -141,10 +139,10 @@ status_t ipro1000_free(void* cookie) { ipro1000_device *device = (ipro1000_device *)cookie; - TRACE("ipro1000_free()\n"); + DEVICE_DEBUGOUT("ipro1000_free()"); if (em_detach(device) != 0) { - TRACE("em_detach failed\n"); + DEVICE_DEBUGOUT("em_detach failed"); } free(device); @@ -162,31 +160,31 @@ ipro1000_read(void* cookie, off_t position, void *buf, size_t* num_bytes) status_t stat; int len; -// TRACE("ipro1000_read() enter\n"); +// DEVICE_DEBUGOUT("ipro1000_read() enter"); if (device->closed) { - TRACE("ipro1000_read() interrupted 1\n"); + DEVICE_DEBUGOUT("ipro1000_read() interrupted 1"); return B_INTERRUPTED; } retry: stat = acquire_sem_etc(ifp->if_rcv_sem, 1, B_CAN_INTERRUPT | (device->nonblocking ? B_TIMEOUT : 0), 0); if (device->closed) { - // TRACE("ipro1000_read() interrupted 2\n"); // net_server will crash if we print this (race condition in net_server?) + // DEVICE_DEBUGOUT("ipro1000_read() interrupted 2"); // net_server will crash if we print this (race condition in net_server?) return B_INTERRUPTED; } if (stat == B_WOULD_BLOCK) { - TRACE("ipro1000_read() would block (OK 0 bytes)\n"); + DEVICE_DEBUGOUT("ipro1000_read() would block (OK 0 bytes)"); *num_bytes = 0; return B_OK; } if (stat != B_OK) { - TRACE("ipro1000_read() error\n"); + DEVICE_DEBUGOUT("ipro1000_read() error"); return B_ERROR; } IF_DEQUEUE(&ifp->if_rcv, mb); if (!mb) { - ERROR("ipro1000_read() mbuf not ready\n"); + ERROROUT("ipro1000_read() mbuf not ready"); goto retry; } @@ -201,7 +199,7 @@ retry: m_freem(mb); -// TRACE("ipro1000_read() leave, %d bytes\n", len); +// DEVICE_DEBUGOUT1("ipro1000_read() leave, %d bytes", len); return B_OK; } @@ -214,7 +212,7 @@ ipro1000_write(void* cookie, off_t position, const void* buffer, size_t* num_byt struct ifnet *ifp = &device->adapter->interface_data.ac_if; struct mbuf *mb; -// TRACE("ipro1000_write() enter\n"); +// DEVICE_DEBUGOUT("ipro1000_write() enter"); // allocate mbuf for (;;) { @@ -226,7 +224,7 @@ ipro1000_write(void* cookie, off_t position, const void* buffer, size_t* num_byt return B_INTERRUPTED; } -// TRACE("ipro1000_write() 1\n"); +// DEVICE_DEBUGOUT("ipro1000_write() 1"); // allocate memory for (;;) { @@ -240,7 +238,7 @@ ipro1000_write(void* cookie, off_t position, const void* buffer, size_t* num_byt } } -// TRACE("ipro1000_write() 2\n"); +// DEVICE_DEBUGOUT("ipro1000_write() 2"); // copy data mb->m_len = *num_bytes; @@ -248,12 +246,12 @@ ipro1000_write(void* cookie, off_t position, const void* buffer, size_t* num_byt mb->m_len = MCLBYTES; memcpy(mtod(mb, uint8 *), buffer, mb->m_len); -// TRACE("ipro1000_write() 3\n"); +// DEVICE_DEBUGOUT("ipro1000_write() 3"); // add mbuf to send queue IF_APPEND(&ifp->if_snd, mb); -// TRACE("ipro1000_write() 4\n"); +// DEVICE_DEBUGOUT("ipro1000_write() 4"); // wait for output available while (ifp->if_flags & IFF_OACTIVE) { @@ -262,7 +260,7 @@ ipro1000_write(void* cookie, off_t position, const void* buffer, size_t* num_byt return B_INTERRUPTED; } -// TRACE("ipro1000_write() 5\n"); +// DEVICE_DEBUGOUT("ipro1000_write() 5"); // send everything (if still required) if (ifp->if_snd.ifq_head != NULL) @@ -280,9 +278,9 @@ ipro1000_write(void* cookie, off_t position, const void* buffer, size_t* num_byt // t = system_time() - t; // if (t > 20) -// TRACE("write %Ld\n", t); +// DEVICE_DEBUGOUT("write %Ld", t); -// TRACE("ipro1000_write() finished\n"); +// DEVICE_DEBUGOUT("ipro1000_write() finished"); return B_OK; } @@ -295,47 +293,47 @@ ipro1000_control(void *cookie, uint32 op, void *arg, size_t len) switch (op) { case ETHER_INIT: - TRACE("ipro1000_control() ETHER_INIT\n"); + DEVICE_DEBUGOUT("ipro1000_control() ETHER_INIT"); return B_OK; case ETHER_GETADDR: - TRACE("ipro1000_control() ETHER_GETADDR\n"); + DEVICE_DEBUGOUT("ipro1000_control() ETHER_GETADDR"); memcpy(arg, &device->macaddr, sizeof(device->macaddr)); return B_OK; case ETHER_NONBLOCK: if (*(int32 *)arg) { - TRACE("non blocking mode on\n"); + DEVICE_DEBUGOUT("non blocking mode on"); device->nonblocking = true; } else { - TRACE("non blocking mode off\n"); + DEVICE_DEBUGOUT("non blocking mode off"); device->nonblocking = false; } return B_OK; case ETHER_ADDMULTI: - TRACE("ipro1000_control() ETHER_ADDMULTI not supported\n"); + DEVICE_DEBUGOUT("ipro1000_control() ETHER_ADDMULTI not supported"); break; case ETHER_REMMULTI: - TRACE("ipro1000_control() ETHER_REMMULTI not supported\n"); + DEVICE_DEBUGOUT("ipro1000_control() ETHER_REMMULTI not supported"); return B_OK; case ETHER_SETPROMISC: if (*(int32 *)arg) { - TRACE("promiscuous mode on not supported\n"); + DEVICE_DEBUGOUT("promiscuous mode on not supported"); } else { - TRACE("promiscuous mode off\n"); + DEVICE_DEBUGOUT("promiscuous mode off"); } return B_OK; case ETHER_GETFRAMESIZE: - TRACE("ipro1000_control() ETHER_GETFRAMESIZE, framesize = %d (MTU = %d)\n", device->maxframesize, device->maxframesize - ENET_HEADER_SIZE); + DEVICE_DEBUGOUT2("ipro1000_control() ETHER_GETFRAMESIZE, framesize = %d (MTU = %d)", device->maxframesize, device->maxframesize - ENET_HEADER_SIZE); *(uint32*)arg = device->maxframesize; return B_OK; default: - TRACE("ipro1000_control() Invalid command\n"); + DEVICE_DEBUGOUT("ipro1000_control() Invalid command"); break; } diff --git a/src/add-ons/kernel/drivers/network/ipro1000/driver.c b/src/add-ons/kernel/drivers/network/ipro1000/driver.c index 068365d916..423e118829 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/driver.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/driver.c @@ -22,8 +22,6 @@ #include #include -//#define DEBUG - #include "debug.h" #include "timer.h" #include "device.h" @@ -87,7 +85,7 @@ init_hardware(void) status_t res; int i; - TRACE("init_hardware()\n"); + INIT_DEBUGOUT("init_hardware()"); if (get_module(B_PCI_MODULE_NAME, (module_info **)&pci) < B_OK) return B_ERROR; @@ -115,9 +113,9 @@ init_driver(void) load_driver_symbols("ipro1000"); #endif - dprintf(INFO1"\n"); - dprintf(INFO2"\n"); - dprintf(INFO3"\n"); + dprintf("ipro1000: " INFO1 "\n"); + dprintf("ipro1000: " INFO2 "\n"); + dprintf("ipro1000: " INFO3 "\n"); item = (pci_info *)malloc(sizeof(pci_info)); if (!item) @@ -133,7 +131,7 @@ init_driver(void) if (info) { char name[64]; sprintf(name, "net/ipro1000/%d", cards); - PRINT("/dev/%s is a %s\n", name, info); + dprintf("ipro1000: /dev/%s is a %s\n", name, info); gDevList[cards] = item; gDevNameList[cards] = strdup(name); gDevNameList[cards + 1] = NULL; @@ -145,8 +143,6 @@ init_driver(void) break; } } - - TRACE("found %d cards\n", cards); free(item); @@ -154,12 +150,12 @@ init_driver(void) goto err_cards; if (initialize_timer() != B_OK) { - ERROR("timer init failed\n"); + ERROROUT("timer init failed"); goto err_timer; } if (mempool_init(cards * 768) != B_OK) { - ERROR("mempool init failed\n"); + ERROROUT("mempool init failed"); goto err_mempool; } @@ -184,7 +180,7 @@ uninit_driver(void) { int32 i; - TRACE("uninit_driver()\n"); + INIT_DEBUGOUT("uninit_driver()"); terminate_timer(); diff --git a/src/add-ons/kernel/drivers/network/ipro1000/if_compat.c b/src/add-ons/kernel/drivers/network/ipro1000/if_compat.c index 99788e01c5..4db9272393 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/if_compat.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/if_compat.c @@ -94,7 +94,7 @@ ether_ifattach(struct ifnet *ifp, const uint8 *etheraddr) { ipro1000_device *dev = ifp->if_softc->dev; - TRACE("ether_ifattach\n"); + INIT_DEBUGOUT("ether_ifattach"); memcpy(dev->macaddr, etheraddr, 6); @@ -103,15 +103,15 @@ ether_ifattach(struct ifnet *ifp, const uint8 *etheraddr) ifp->if_rcv_sem = create_sem(0, "ifp->if_rcv_sem"); set_sem_owner(ifp->if_rcv_sem, B_SYSTEM_TEAM); - TRACE("calling if_init...\n"); + INIT_DEBUGOUT("calling if_init..."); ifp->if_init(ifp->if_softc); - TRACE("done calling if_init!\n"); + INIT_DEBUGOUT("done calling if_init!"); } void ether_ifdetach(struct ifnet *ifp) { - TRACE("ether_ifdetach\n"); + INIT_DEBUGOUT("ether_ifdetach"); delete_sem(ifp->if_rcv_sem); } diff --git a/src/add-ons/kernel/drivers/network/ipro1000/if_em.c b/src/add-ons/kernel/drivers/network/ipro1000/if_em.c index a5dd1a141a..76957077ba 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/if_em.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/if_em.c @@ -33,15 +33,11 @@ POSSIBILITY OF SUCH DAMAGE. /*$FreeBSD: /repoman/r/ncvs/src/sys/dev/em/if_em.c,v 1.2.2.19 2004/04/22 22:03:26 ru Exp $*/ +#include "debug.h" #include "if_em.h" #include "util.h" -/********************************************************************* - * Set this to one to display debug statistics - *********************************************************************/ -int em_display_debug_stats = DEBUG_TRACE_STATS; - /********************************************************************* * Function prototypes *********************************************************************/ @@ -56,8 +52,8 @@ static int em_ioctl(struct ifnet *, u_long, caddr_t); static void em_watchdog(struct ifnet *); static void em_init(void *); static void em_stop(void *); -static void em_media_status(struct ifnet *, struct ifmediareq *); -static int em_media_change(struct ifnet *); +//static void em_media_status(struct ifnet *, struct ifmediareq *); +//static int em_media_change(struct ifnet *); static void em_identify_hardware(struct adapter *); static int em_allocate_pci_resources(struct adapter *); static void em_free_pci_resources(struct adapter *); @@ -100,12 +96,12 @@ static int em_82547_tx_fifo_reset(struct adapter *); static void em_82547_move_tail(void *arg); static void em_print_debug_info(struct adapter *); static int em_is_valid_ether_addr(u_int8_t *); -static int em_sysctl_stats(SYSCTL_HANDLER_ARGS); -static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS); +//static int em_sysctl_stats(SYSCTL_HANDLER_ARGS); +//static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS); static u_int32_t em_fill_descriptors (u_int64_t address, u_int32_t length, PDESC_ARRAY desc_array); -static int em_sysctl_int_delay(SYSCTL_HANDLER_ARGS); +//static int em_sysctl_int_delay(SYSCTL_HANDLER_ARGS); static void em_add_int_delay_sysctl(struct adapter *, const char *, const char *, struct em_int_delay_info *, int, int); @@ -163,7 +159,7 @@ em_attach(device_t dev) /* Allocate, clear, and link in our adapter structure */ if (!(adapter = device_get_softc(dev))) { - dprintf("ipro1000: adapter structure allocation failed\n"); + ERROROUT("adapter structure allocation failed"); splx(s); return(ENOMEM); } @@ -452,7 +448,7 @@ em_detach(device_t dev) static int start_event_thread(struct adapter *adapter) { - TRACE("start_event_thread enter\n"); + INIT_DEBUGOUT("start_event_thread enter"); adapter->event_thread = spawn_kernel_thread(event_handler, "ipro1000 event", 80, adapter); adapter->event_flags = 0; @@ -461,16 +457,16 @@ start_event_thread(struct adapter *adapter) if (adapter->event_thread >= 0 && adapter->event_sem >= 0) { resume_thread(adapter->event_thread); - TRACE("start_event_thread leave\n"); + INIT_DEBUGOUT("start_event_thread leave"); return 0; } - TRACE("start_event_thread failed\n"); + ERROROUT("start_event_thread failed"); delete_sem(adapter->event_sem); kill_thread(adapter->event_thread); - TRACE("start_event_thread leave\n"); + INIT_DEBUGOUT("start_event_thread leave"); return -1; } @@ -479,14 +475,14 @@ stop_event_thread(struct adapter *adapter) { status_t thread_return_value; - TRACE("stop_event_thread enter\n"); + INIT_DEBUGOUT("stop_event_thread enter"); delete_sem(adapter->event_sem); wait_for_thread(adapter->event_thread, &thread_return_value); adapter->event_thread = -1; adapter->event_sem = -1; - TRACE("stop_event_thread leave\n"); + INIT_DEBUGOUT("stop_event_thread leave"); } @@ -617,7 +613,7 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } break; default: - IOCTL_DEBUGOUT1("ioctl received: UNKNOWN (0x%x)\n", (int)command); + IOCTL_DEBUGOUT1("ioctl received: UNKNOWN (0x%x)", (int)command); error = EINVAL; } @@ -808,7 +804,7 @@ event_handler(void *cookie) atomic_and(&adapter->event_flags, ~events); // and clear if (events & EVENT_LINK_CHANGED) { - TRACE("EVENT_LINK_CHANGED\n"); + INIT_DEBUGOUT("EVENT_LINK_CHANGED"); untimeout(em_local_timer, adapter, adapter->timer_handle); adapter->hw.get_link_status = 1; em_check_for_link(&adapter->hw); @@ -820,7 +816,7 @@ event_handler(void *cookie) } - +#if 0 /********************************************************************* * * Media Ioctl callback @@ -948,6 +944,7 @@ em_media_change(struct ifnet *ifp) return(0); } +#endif // #if 0 #define EM_FIFO_HDR 0x10 #define EM_82547_PKT_THRESH 0x3e0 @@ -1292,7 +1289,7 @@ em_set_multi(struct adapter * adapter) u_int8_t mta[MAX_NUM_MULTICAST_ADDRESSES * ETH_LENGTH_OF_ADDRESS]; struct ifmultiaddr *ifma; int mcnt = 0; - struct ifnet *ifp = &adapter->interface_data.ac_if; +// struct ifnet *ifp = &adapter->interface_data.ac_if; IOCTL_DEBUGOUT("em_set_multi: begin"); @@ -1362,7 +1359,7 @@ em_local_timer(void *arg) em_check_for_link(&adapter->hw); em_print_link_status(adapter); em_update_stats_counters(adapter); - if (em_display_debug_stats && ifp->if_flags & IFF_RUNNING) { + if (DEBUG_DISPLAY_STATS && ifp->if_flags & IFF_RUNNING) { em_print_hw_stats(adapter); em_print_debug_info(adapter); } @@ -1842,7 +1839,7 @@ em_initialize_transmit_unit(struct adapter * adapter) E1000_WRITE_REG(&adapter->hw, TDT, 0); - HW_DEBUGOUT2("Base = %lx, Length = %lx\n", + HW_DEBUGOUT2("Base = %lx, Length = %lx", E1000_READ_REG(&adapter->hw, TDBAL), E1000_READ_REG(&adapter->hw, TDLEN)); @@ -2022,7 +2019,7 @@ em_clean_transmit_interrupts(struct adapter * adapter) return; s = splimp(); -#ifdef DBG_STATS +#if DEBUG_DISPLAY_STATS adapter->clean_tx_interrupts++; #endif num_avail = adapter->num_tx_desc_avail; @@ -2315,7 +2312,7 @@ em_process_receive_interrupts(struct adapter * adapter, int count) current_desc = &adapter->rx_desc_base[i]; if (!((current_desc->status) & E1000_RXD_STAT_DD)) { -#ifdef DBG_STATS +#if DEBUG_DISPLAY_STATS adapter->no_pkts_avail++; #endif return; @@ -2762,7 +2759,7 @@ em_update_stats_counters(struct adapter *adapter) /********************************************************************** * - * This routine is called only when em_display_debug_stats is enabled. + * This routine is called only when DEBUG_DISPLAY_STATS is enabled. * This routine provides a way to take a look at important statistics * maintained by the driver and hardware. * @@ -2770,6 +2767,7 @@ em_update_stats_counters(struct adapter *adapter) static void em_print_debug_info(struct adapter *adapter) { +#if DEBUG_DISPLAY_STATS int unit = adapter->unit; uint8_t *hw_addr = adapter->hw.hw_addr; @@ -2780,12 +2778,10 @@ em_print_debug_info(struct adapter *adapter) dprintf("ipro1000/%d:rx_int_delay = %ld, rx_abs_int_delay = %ld\n", unit, E1000_READ_REG(&adapter->hw, RDTR), E1000_READ_REG(&adapter->hw, RADV)); -#ifdef DBG_STATS dprintf("ipro1000/%d: Packets not Avail = %ld\n", unit, adapter->no_pkts_avail); dprintf("ipro1000/%d: CleanTxInterrupts = %ld\n", unit, adapter->clean_tx_interrupts); -#endif snooze(10000); // give syslog reader some time to catchup dprintf("ipro1000/%d: fifo workaround = %Ld, fifo_reset = %Ld\n", unit, (long long)adapter->tx_fifo_wrk, @@ -2806,13 +2802,13 @@ em_print_debug_info(struct adapter *adapter) dprintf("ipro1000/%d: Driver dropped packets = %ld\n", unit, adapter->dropped_pkts); snooze(10000); // give syslog reader some time to catchup - - return; +#endif } static void em_print_hw_stats(struct adapter *adapter) { +#if DEBUG_DISPLAY_STATS int unit = adapter->unit; dprintf("ipro1000/%d: Excessive collisions = %Ld\n", unit, @@ -2855,8 +2851,7 @@ em_print_hw_stats(struct adapter *adapter) (long long)adapter->stats.gprc); dprintf("ipro1000/%d: Good Packets Xmtd = %Ld\n", unit, (long long)adapter->stats.gptc); - - return; +#endif } #if 0 diff --git a/src/add-ons/kernel/drivers/network/ipro1000/if_em.h b/src/add-ons/kernel/drivers/network/ipro1000/if_em.h index a360884340..e38965a849 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/if_em.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/if_em.h @@ -196,18 +196,6 @@ POSSIBILITY OF SUCH DAMAGE. #define PCI_ANY_ID (~0U) #define ETHER_ALIGN 2 -/* Defines for printing debug information */ - -#define INIT_DEBUGOUT(S) if (DEBUG_INIT) dprintf("ipro1000: " S "\n") -#define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) dprintf("ipro1000: " S "\n", A) -#define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) dprintf("ipro1000: " S "\n", A, B) -#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) dprintf("ipro1000: " S "\n") -#define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) dprintf("ipro1000: " S "\n", A) -#define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) dprintf("ipro1000: " S "\n", A, B) -#define HW_DEBUGOUT(S) if (DEBUG_HW) dprintf("ipro1000: " S "\n") -#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) dprintf("ipro1000: " S "\n", A) -#define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) dprintf("ipro1000: " S "\n", A, B) - /* Supported RX Buffer Sizes */ #define EM_RXBUFFER_2048 2048 @@ -341,11 +329,11 @@ struct adapter { boolean_t pcix_82544; boolean_t in_detach; -#ifdef DBG_STATS +#if DEBUG_DISPLAY_STATS unsigned long no_pkts_avail; unsigned long clean_tx_interrupts; - #endif + struct em_hw_stats stats; }; diff --git a/src/add-ons/kernel/drivers/network/ipro1000/if_em_hw.c b/src/add-ons/kernel/drivers/network/ipro1000/if_em_hw.c index f92213941b..35cba1ddf1 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/if_em_hw.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/if_em_hw.c @@ -36,6 +36,7 @@ * Shared functions for accessing and configuring the MAC */ +#include "debug.h" #include "if_em_hw.h" static int32_t em_set_phy_type(struct em_hw *hw); @@ -330,12 +331,12 @@ em_reset_hw(struct em_hw *hw) /* For 82542 (rev 2.0), disable MWI before issuing a device reset */ if(hw->mac_type == em_82542_rev2_0) { - DEBUGOUT("Disabling MWI on 82542 rev 2.0\n"); + HW_DEBUGOUT("Disabling MWI on 82542 rev 2.0"); em_pci_clear_mwi(hw); } /* Clear interrupt mask to stop board from generating interrupts */ - DEBUGOUT("Masking off all interrupts\n"); + HW_DEBUGOUT("Masking off all interrupts"); E1000_WRITE_REG(hw, IMC, 0xffffffff); /* Disable the Transmit and Receive units. Then delay to allow @@ -367,7 +368,7 @@ em_reset_hw(struct em_hw *hw) * the current PCI configuration. The global reset bit is self- * clearing, and should clear within a microsecond. */ - DEBUGOUT("Issuing a global reset to MAC\n"); + HW_DEBUGOUT("Issuing a global reset to MAC"); switch(hw->mac_type) { case em_82544: @@ -439,7 +440,7 @@ em_reset_hw(struct em_hw *hw) } /* Clear interrupt mask to stop board from generating interrupts */ - DEBUGOUT("Masking off all interrupts\n"); + HW_DEBUGOUT("Masking off all interrupts"); E1000_WRITE_REG(hw, IMC, 0xffffffff); /* Clear any pending interrupt events. */ @@ -480,7 +481,7 @@ em_init_hw(struct em_hw *hw) /* Initialize Identification LED */ if((ret_val = em_id_led_init(hw))) { - DEBUGOUT("Error Initializing Identification LED\n"); + HW_DEBUGOUT("Error Initializing Identification LED"); return ret_val; } @@ -488,14 +489,14 @@ em_init_hw(struct em_hw *hw) em_set_media_type(hw); /* Disabling VLAN filtering. */ - DEBUGOUT("Initializing the IEEE VLAN\n"); + HW_DEBUGOUT("Initializing the IEEE VLAN"); E1000_WRITE_REG(hw, VET, 0); em_clear_vfta(hw); /* For 82542 (rev 2.0), disable MWI and put the receiver into reset */ if(hw->mac_type == em_82542_rev2_0) { - DEBUGOUT("Disabling MWI on 82542 rev 2.0\n"); + HW_DEBUGOUT("Disabling MWI on 82542 rev 2.0"); em_pci_clear_mwi(hw); E1000_WRITE_REG(hw, RCTL, E1000_RCTL_RST); E1000_WRITE_FLUSH(hw); @@ -517,7 +518,7 @@ em_init_hw(struct em_hw *hw) } /* Zero out the Multicast HASH table */ - DEBUGOUT("Zeroing the MTA\n"); + HW_DEBUGOUT("Zeroing the MTA"); for(i = 0; i < E1000_MC_TBL_SIZE; i++) E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); @@ -645,7 +646,7 @@ em_setup_link(struct em_hw *hw) * be initialized based on a value in the EEPROM. */ if(em_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data) < 0) { - DEBUGOUT("EEPROM Read Error\n"); + HW_DEBUGOUT("EEPROM Read Error"); return -E1000_ERR_EEPROM; } @@ -671,7 +672,7 @@ em_setup_link(struct em_hw *hw) hw->original_fc = hw->fc; - DEBUGOUT1("After fix-ups FlowControl is now = %x\n", hw->fc); + HW_DEBUGOUT1("After fix-ups FlowControl is now = %x", hw->fc); /* Take the 4 bits from EEPROM word 0x0F that determine the initial * polarity value for the SW controlled pins, and setup the @@ -696,7 +697,7 @@ em_setup_link(struct em_hw *hw) * control is disabled, because it does not hurt anything to * initialize these registers. */ - DEBUGOUT("Initializing the Flow Control address, type and timer regs\n"); + HW_DEBUGOUT("Initializing the Flow Control address, type and timer regs"); E1000_WRITE_REG(hw, FCAL, FLOW_CONTROL_ADDRESS_LOW); E1000_WRITE_REG(hw, FCAH, FLOW_CONTROL_ADDRESS_HIGH); @@ -810,7 +811,7 @@ em_setup_fiber_serdes_link(struct em_hw *hw) txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK); break; default: - DEBUGOUT("Flow control param set incorrectly\n"); + HW_DEBUGOUT("Flow control param set incorrectly"); return -E1000_ERR_CONFIG; break; } @@ -821,7 +822,7 @@ em_setup_fiber_serdes_link(struct em_hw *hw) * link-up status bit will be set and the flow control enable bits (RFCE * and TFCE) will be set according to their negotiated value. */ - DEBUGOUT("Auto-negotiation enabled\n"); + HW_DEBUGOUT("Auto-negotiation enabled"); E1000_WRITE_REG(hw, TXCW, txcw); E1000_WRITE_REG(hw, CTRL, ctrl); @@ -838,14 +839,14 @@ em_setup_fiber_serdes_link(struct em_hw *hw) */ if(hw->media_type == em_media_type_internal_serdes || (E1000_READ_REG(hw, CTRL) & E1000_CTRL_SWDPIN1) == signal) { - DEBUGOUT("Looking for Link\n"); + HW_DEBUGOUT("Looking for Link"); for(i = 0; i < (LINK_UP_TIMEOUT / 10); i++) { msec_delay(10); status = E1000_READ_REG(hw, STATUS); if(status & E1000_STATUS_LU) break; } if(i == (LINK_UP_TIMEOUT / 10)) { - DEBUGOUT("Never got a valid link from auto-neg!!!\n"); + HW_DEBUGOUT("Never got a valid link from auto-neg!!!"); hw->autoneg_failed = 1; /* AutoNeg failed to achieve a link, so we'll call * em_check_for_link. This routine will force the link up if @@ -853,16 +854,16 @@ em_setup_fiber_serdes_link(struct em_hw *hw) * non-autonegotiating link partners. */ if((ret_val = em_check_for_link(hw))) { - DEBUGOUT("Error while checking for link\n"); + HW_DEBUGOUT("Error while checking for link"); return ret_val; } hw->autoneg_failed = 0; } else { hw->autoneg_failed = 0; - DEBUGOUT("Valid Link Found\n"); + HW_DEBUGOUT("Valid Link Found"); } } else { - DEBUGOUT("No Signal Detected\n"); + HW_DEBUGOUT("No Signal Detected"); } return E1000_SUCCESS; } @@ -900,10 +901,10 @@ em_setup_copper_link(struct em_hw *hw) /* Make sure we have a valid PHY */ if((ret_val = em_detect_gig_phy(hw))) { - DEBUGOUT("Error, did not detect valid phy.\n"); + HW_DEBUGOUT("Error, did not detect valid phy."); return ret_val; } - DEBUGOUT1("Phy ID = %x \n", hw->phy_id); + HW_DEBUGOUT1("Phy ID = %x ", hw->phy_id); if(hw->mac_type <= em_82543 || hw->mac_type == em_82541 || hw->mac_type == em_82547 || @@ -914,7 +915,7 @@ em_setup_copper_link(struct em_hw *hw) if (hw->phy_type == em_phy_igp) { if((ret_val = em_phy_reset(hw))) { - DEBUGOUT("Error Resetting the PHY\n"); + HW_DEBUGOUT("Error Resetting the PHY"); return ret_val; } @@ -929,7 +930,7 @@ em_setup_copper_link(struct em_hw *hw) /* disable lplu d3 during driver init */ if((ret_val = em_set_d3_lplu_state(hw, FALSE))) { - DEBUGOUT("Error Disabling LPLU D3\n"); + HW_DEBUGOUT("Error Disabling LPLU D3"); return ret_val; } @@ -1097,7 +1098,7 @@ em_setup_copper_link(struct em_hw *hw) /* SW Reset the PHY so all changes take effect */ if((ret_val = em_phy_reset(hw))) { - DEBUGOUT("Error Resetting the PHY\n"); + HW_DEBUGOUT("Error Resetting the PHY"); return ret_val; } } @@ -1129,12 +1130,12 @@ em_setup_copper_link(struct em_hw *hw) if(hw->autoneg_advertised == 0) hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; - DEBUGOUT("Reconfiguring auto-neg advertisement params\n"); + HW_DEBUGOUT("Reconfiguring auto-neg advertisement params"); if((ret_val = em_phy_setup_autoneg(hw))) { - DEBUGOUT("Error Setting up Auto-Negotiation\n"); + HW_DEBUGOUT("Error Setting up Auto-Negotiation"); return ret_val; } - DEBUGOUT("Restarting Auto-Neg\n"); + HW_DEBUGOUT("Restarting Auto-Neg"); /* Restart auto-negotiation by setting the Auto Neg Enable bit and * the Auto Neg Restart bit in the PHY control register. @@ -1151,15 +1152,15 @@ em_setup_copper_link(struct em_hw *hw) */ if(hw->wait_autoneg_complete) { if((ret_val = em_wait_autoneg(hw))) { - DEBUGOUT("Error while waiting for autoneg to complete\n"); + HW_DEBUGOUT("Error while waiting for autoneg to complete"); return ret_val; } } hw->get_link_status = TRUE; } else { - DEBUGOUT("Forcing speed and duplex\n"); + HW_DEBUGOUT("Forcing speed and duplex"); if((ret_val = em_phy_force_speed_duplex(hw))) { - DEBUGOUT("Error Forcing Speed and Duplex\n"); + HW_DEBUGOUT("Error Forcing Speed and Duplex"); return ret_val; } } @@ -1187,29 +1188,29 @@ em_setup_copper_link(struct em_hw *hw) em_config_collision_dist(hw); } else { if((ret_val = em_config_mac_to_phy(hw))) { - DEBUGOUT("Error configuring MAC to PHY settings\n"); + HW_DEBUGOUT("Error configuring MAC to PHY settings"); return ret_val; } } if((ret_val = em_config_fc_after_link_up(hw))) { - DEBUGOUT("Error Configuring Flow Control\n"); + HW_DEBUGOUT("Error Configuring Flow Control"); return ret_val; } - DEBUGOUT("Valid link established!!!\n"); + HW_DEBUGOUT("Valid link established!!!"); if(hw->phy_type == em_phy_igp) { if((ret_val = em_config_dsp_after_link_change(hw, TRUE))) { - DEBUGOUT("Error Configuring DSP after link up\n"); + HW_DEBUGOUT("Error Configuring DSP after link up"); return ret_val; } } - DEBUGOUT("Valid link established!!!\n"); + HW_DEBUGOUT("Valid link established!!!"); return E1000_SUCCESS; } usec_delay(10); } - DEBUGOUT("Unable to establish link!!!\n"); + HW_DEBUGOUT("Unable to establish link!!!"); return E1000_SUCCESS; } @@ -1250,40 +1251,40 @@ em_phy_setup_autoneg(struct em_hw *hw) mii_autoneg_adv_reg &= ~REG4_SPEED_MASK; mii_1000t_ctrl_reg &= ~REG9_SPEED_MASK; - DEBUGOUT1("autoneg_advertised %x\n", hw->autoneg_advertised); + HW_DEBUGOUT1("autoneg_advertised %x", hw->autoneg_advertised); /* Do we want to advertise 10 Mb Half Duplex? */ if(hw->autoneg_advertised & ADVERTISE_10_HALF) { - DEBUGOUT("Advertise 10mb Half duplex\n"); + HW_DEBUGOUT("Advertise 10mb Half duplex"); mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS; } /* Do we want to advertise 10 Mb Full Duplex? */ if(hw->autoneg_advertised & ADVERTISE_10_FULL) { - DEBUGOUT("Advertise 10mb Full duplex\n"); + HW_DEBUGOUT("Advertise 10mb Full duplex"); mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS; } /* Do we want to advertise 100 Mb Half Duplex? */ if(hw->autoneg_advertised & ADVERTISE_100_HALF) { - DEBUGOUT("Advertise 100mb Half duplex\n"); + HW_DEBUGOUT("Advertise 100mb Half duplex"); mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS; } /* Do we want to advertise 100 Mb Full Duplex? */ if(hw->autoneg_advertised & ADVERTISE_100_FULL) { - DEBUGOUT("Advertise 100mb Full duplex\n"); + HW_DEBUGOUT("Advertise 100mb Full duplex"); mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS; } /* We do not allow the Phy to advertise 1000 Mb Half Duplex */ if(hw->autoneg_advertised & ADVERTISE_1000_HALF) { - DEBUGOUT("Advertise 1000mb Half duplex requested, request denied!\n"); + HW_DEBUGOUT("Advertise 1000mb Half duplex requested, request denied!"); } /* Do we want to advertise 1000 Mb Full Duplex? */ if(hw->autoneg_advertised & ADVERTISE_1000_FULL) { - DEBUGOUT("Advertise 1000mb Full duplex\n"); + HW_DEBUGOUT("Advertise 1000mb Full duplex"); mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS; } @@ -1336,7 +1337,7 @@ em_phy_setup_autoneg(struct em_hw *hw) mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); break; default: - DEBUGOUT("Flow control param set incorrectly\n"); + HW_DEBUGOUT("Flow control param set incorrectly"); return -E1000_ERR_CONFIG; } @@ -1344,7 +1345,7 @@ em_phy_setup_autoneg(struct em_hw *hw) mii_autoneg_adv_reg))) return ret_val; - DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); + HW_DEBUGOUT1("Auto-Neg Advertising %x", mii_autoneg_adv_reg); if((ret_val = em_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg))) return ret_val; @@ -1372,7 +1373,7 @@ em_phy_force_speed_duplex(struct em_hw *hw) /* Turn off Flow control if we are forcing speed and duplex. */ hw->fc = em_fc_none; - DEBUGOUT1("hw->fc = %d\n", hw->fc); + HW_DEBUGOUT1("hw->fc = %d", hw->fc); /* Read the Device Control Register. */ ctrl = E1000_READ_REG(hw, CTRL); @@ -1400,14 +1401,14 @@ em_phy_force_speed_duplex(struct em_hw *hw) */ ctrl |= E1000_CTRL_FD; mii_ctrl_reg |= MII_CR_FULL_DUPLEX; - DEBUGOUT("Full Duplex\n"); + HW_DEBUGOUT("Full Duplex"); } else { /* We want to force half duplex so we CLEAR the full duplex bits in * the Device and MII Control Registers. */ ctrl &= ~E1000_CTRL_FD; mii_ctrl_reg &= ~MII_CR_FULL_DUPLEX; - DEBUGOUT("Half Duplex\n"); + HW_DEBUGOUT("Half Duplex"); } /* Are we forcing 100Mbps??? */ @@ -1417,13 +1418,13 @@ em_phy_force_speed_duplex(struct em_hw *hw) ctrl |= E1000_CTRL_SPD_100; mii_ctrl_reg |= MII_CR_SPEED_100; mii_ctrl_reg &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_10); - DEBUGOUT("Forcing 100mb "); + HW_DEBUGOUT("Forcing 100mb "); } else { /* Set the 10Mb bit and turn off the 1000Mb and 100Mb bits. */ ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100); mii_ctrl_reg |= MII_CR_SPEED_10; mii_ctrl_reg &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_100); - DEBUGOUT("Forcing 10mb "); + HW_DEBUGOUT("Forcing 10mb "); } em_config_collision_dist(hw); @@ -1444,7 +1445,7 @@ em_phy_force_speed_duplex(struct em_hw *hw) phy_data))) return ret_val; - DEBUGOUT1("M88E1000 PSCR: %x \n", phy_data); + HW_DEBUGOUT1("M88E1000 PSCR: %x", phy_data); /* Need to reset the PHY or these changes will be ignored */ mii_ctrl_reg |= MII_CR_RESET; @@ -1479,7 +1480,7 @@ em_phy_force_speed_duplex(struct em_hw *hw) */ if(hw->wait_autoneg_complete) { /* We will wait for autoneg to complete. */ - DEBUGOUT("Waiting for forced speed/duplex link.\n"); + HW_DEBUGOUT("Waiting for forced speed/duplex link."); mii_status_reg = 0; /* We will wait for autoneg to complete or 4.5 seconds to expire. */ @@ -1499,7 +1500,7 @@ em_phy_force_speed_duplex(struct em_hw *hw) if((i == 0) && (hw->phy_type == em_phy_m88)) { /* We didn't get link. Reset the DSP and wait again for link. */ if((ret_val = em_phy_reset_dsp(hw))) { - DEBUGOUT("Error Resetting PHY DSP\n"); + HW_DEBUGOUT("Error Resetting PHY DSP"); return ret_val; } } @@ -1716,7 +1717,7 @@ em_force_mac_fc(struct em_hw *hw) ctrl |= (E1000_CTRL_TFCE | E1000_CTRL_RFCE); break; default: - DEBUGOUT("Flow control param set incorrectly\n"); + HW_DEBUGOUT("Flow control param set incorrectly"); return -E1000_ERR_CONFIG; } @@ -1759,7 +1760,7 @@ em_config_fc_after_link_up(struct em_hw *hw) ((hw->media_type == em_media_type_internal_serdes) && (hw->autoneg_failed)) || ((hw->media_type == em_media_type_copper) && (!hw->autoneg))) { if((ret_val = em_force_mac_fc(hw))) { - DEBUGOUT("Error forcing flow control settings\n"); + HW_DEBUGOUT("Error forcing flow control settings"); return ret_val; } } @@ -1837,10 +1838,10 @@ em_config_fc_after_link_up(struct em_hw *hw) */ if(hw->original_fc == em_fc_full) { hw->fc = em_fc_full; - DEBUGOUT("Flow Control = FULL.\r\n"); + HW_DEBUGOUT("Flow Control = FULL."); } else { hw->fc = em_fc_rx_pause; - DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); + HW_DEBUGOUT("Flow Control = RX PAUSE frames only."); } } /* For receiving PAUSE frames ONLY. @@ -1856,7 +1857,7 @@ em_config_fc_after_link_up(struct em_hw *hw) (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { hw->fc = em_fc_tx_pause; - DEBUGOUT("Flow Control = TX PAUSE frames only.\r\n"); + HW_DEBUGOUT("Flow Control = TX PAUSE frames only."); } /* For transmitting PAUSE frames ONLY. * @@ -1871,7 +1872,7 @@ em_config_fc_after_link_up(struct em_hw *hw) !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { hw->fc = em_fc_rx_pause; - DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); + HW_DEBUGOUT("Flow Control = RX PAUSE frames only."); } /* Per the IEEE spec, at this point flow control should be * disabled. However, we want to consider that we could @@ -1897,10 +1898,10 @@ em_config_fc_after_link_up(struct em_hw *hw) hw->original_fc == em_fc_tx_pause) || hw->fc_strict_ieee) { hw->fc = em_fc_none; - DEBUGOUT("Flow Control = NONE.\r\n"); + HW_DEBUGOUT("Flow Control = NONE."); } else { hw->fc = em_fc_rx_pause; - DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); + HW_DEBUGOUT("Flow Control = RX PAUSE frames only."); } /* Now we need to do one last check... If we auto- @@ -1908,7 +1909,7 @@ em_config_fc_after_link_up(struct em_hw *hw) * enabled per IEEE 802.3 spec. */ if((ret_val = em_get_speed_and_duplex(hw, &speed, &duplex))) { - DEBUGOUT("Error getting link speed and duplex\n"); + HW_DEBUGOUT("Error getting link speed and duplex"); return ret_val; } @@ -1919,11 +1920,11 @@ em_config_fc_after_link_up(struct em_hw *hw) * controller to use the correct flow control settings. */ if((ret_val = em_force_mac_fc(hw))) { - DEBUGOUT("Error forcing flow control settings\n"); + HW_DEBUGOUT("Error forcing flow control settings"); return ret_val; } } else { - DEBUGOUT("Copper PHY and Auto Neg has not completed.\r\n"); + HW_DEBUGOUT("Copper PHY and Auto Neg has not completed."); } } return E1000_SUCCESS; @@ -2009,7 +2010,7 @@ em_check_for_link(struct em_hw *hw) em_config_collision_dist(hw); else { if((ret_val = em_config_mac_to_phy(hw))) { - DEBUGOUT("Error configuring MAC to PHY settings\n"); + HW_DEBUGOUT("Error configuring MAC to PHY settings"); return ret_val; } } @@ -2019,7 +2020,7 @@ em_check_for_link(struct em_hw *hw) * have had to re-autoneg with a different link partner. */ if((ret_val = em_config_fc_after_link_up(hw))) { - DEBUGOUT("Error configuring flow control\n"); + HW_DEBUGOUT("Error configuring flow control"); return ret_val; } @@ -2075,7 +2076,7 @@ em_check_for_link(struct em_hw *hw) hw->autoneg_failed = 1; return 0; } - DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\r\n"); + HW_DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link."); /* Disable auto-negotiation in the TXCW register */ E1000_WRITE_REG(hw, TXCW, (hw->txcw & ~E1000_TXCW_ANE)); @@ -2087,7 +2088,7 @@ em_check_for_link(struct em_hw *hw) /* Configure Flow Control after forcing link up. */ if((ret_val = em_config_fc_after_link_up(hw))) { - DEBUGOUT("Error configuring flow control\n"); + HW_DEBUGOUT("Error configuring flow control"); return ret_val; } } @@ -2100,7 +2101,7 @@ em_check_for_link(struct em_hw *hw) (hw->media_type == em_media_type_internal_serdes)) && (ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) { - DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\r\n"); + HW_DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link."); E1000_WRITE_REG(hw, TXCW, hw->txcw); E1000_WRITE_REG(hw, CTRL, (ctrl & ~E1000_CTRL_SLU)); @@ -2116,11 +2117,11 @@ em_check_for_link(struct em_hw *hw) if(E1000_RXCW_SYNCH & E1000_READ_REG(hw, RXCW)) { if(!(rxcw & E1000_RXCW_IV)) { hw->serdes_link_down = FALSE; - DEBUGOUT("SERDES: Link is up.\n"); + HW_DEBUGOUT("SERDES: Link is up."); } } else { hw->serdes_link_down = TRUE; - DEBUGOUT("SERDES: Link is down.\n"); + HW_DEBUGOUT("SERDES: Link is down."); } } if((hw->media_type == em_media_type_internal_serdes) && @@ -2152,24 +2153,24 @@ em_get_speed_and_duplex(struct em_hw *hw, status = E1000_READ_REG(hw, STATUS); if(status & E1000_STATUS_SPEED_1000) { *speed = SPEED_1000; - DEBUGOUT("1000 Mbs, "); + HW_DEBUGOUT("1000 Mbs"); } else if(status & E1000_STATUS_SPEED_100) { *speed = SPEED_100; - DEBUGOUT("100 Mbs, "); + HW_DEBUGOUT("100 Mbs"); } else { *speed = SPEED_10; - DEBUGOUT("10 Mbs, "); + HW_DEBUGOUT("10 Mbs"); } if(status & E1000_STATUS_FD) { *duplex = FULL_DUPLEX; - DEBUGOUT("Full Duplex\r\n"); + HW_DEBUGOUT("Full Duplex"); } else { *duplex = HALF_DUPLEX; - DEBUGOUT(" Half Duplex\r\n"); + HW_DEBUGOUT("Half Duplex"); } } else { - DEBUGOUT("1000 Mbs, Full Duplex\r\n"); + HW_DEBUGOUT("1000 Mbs, Full Duplex"); *speed = SPEED_1000; *duplex = FULL_DUPLEX; } @@ -2209,7 +2210,7 @@ em_wait_autoneg(struct em_hw *hw) uint16_t phy_data; DEBUGFUNC("em_wait_autoneg"); - DEBUGOUT("Waiting for Auto-Neg to complete.\n"); + HW_DEBUGOUT("Waiting for Auto-Neg to complete."); /* We will wait for autoneg to complete or 4.5 seconds to expire. */ for(i = PHY_AUTO_NEG_TIME; i > 0; i--) { @@ -2406,7 +2407,7 @@ em_read_phy_reg_ex(struct em_hw *hw, DEBUGFUNC("em_read_phy_reg_ex"); if(reg_addr > MAX_PHY_REG_ADDRESS) { - DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); + HW_DEBUGOUT1("PHY Address %d is out of range", reg_addr); return -E1000_ERR_PARAM; } @@ -2428,11 +2429,11 @@ em_read_phy_reg_ex(struct em_hw *hw, if(mdic & E1000_MDIC_READY) break; } if(!(mdic & E1000_MDIC_READY)) { - DEBUGOUT("MDI Read did not complete\n"); + HW_DEBUGOUT("MDI Read did not complete"); return -E1000_ERR_PHY; } if(mdic & E1000_MDIC_ERROR) { - DEBUGOUT("MDI Error\n"); + HW_DEBUGOUT("MDI Error"); return -E1000_ERR_PHY; } *phy_data = (uint16_t) mdic; @@ -2509,7 +2510,7 @@ em_write_phy_reg_ex(struct em_hw *hw, DEBUGFUNC("em_write_phy_reg_ex"); if(reg_addr > MAX_PHY_REG_ADDRESS) { - DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); + HW_DEBUGOUT1("PHY Address %d is out of range", reg_addr); return -E1000_ERR_PARAM; } @@ -2532,7 +2533,7 @@ em_write_phy_reg_ex(struct em_hw *hw, if(mdic & E1000_MDIC_READY) break; } if(!(mdic & E1000_MDIC_READY)) { - DEBUGOUT("MDI Write did not complete\n"); + HW_DEBUGOUT("MDI Write did not complete"); return -E1000_ERR_PHY; } } else { @@ -2573,7 +2574,7 @@ em_phy_hw_reset(struct em_hw *hw) DEBUGFUNC("em_phy_hw_reset"); - DEBUGOUT("Resetting Phy...\n"); + HW_DEBUGOUT("Resetting Phy..."); if(hw->mac_type > em_82543) { /* Read the device control register and assert the E1000_CTRL_PHY_RST @@ -2689,16 +2690,16 @@ em_detect_gig_phy(struct em_hw *hw) if(hw->phy_id == IGP01E1000_I_PHY_ID) match = TRUE; break; default: - DEBUGOUT1("Invalid MAC type %d\n", hw->mac_type); + HW_DEBUGOUT1("Invalid MAC type %d", hw->mac_type); return -E1000_ERR_CONFIG; } phy_init_status = em_set_phy_type(hw); if ((match) && (phy_init_status == E1000_SUCCESS)) { - DEBUGOUT1("PHY ID 0x%X detected\n", hw->phy_id); + HW_DEBUGOUT1("PHY ID 0x%X detected", hw->phy_id); return E1000_SUCCESS; } - DEBUGOUT1("Invalid PHY ID 0x%X\n", hw->phy_id); + HW_DEBUGOUT1("Invalid PHY ID 0x%X", hw->phy_id); return -E1000_ERR_PHY; } @@ -2880,7 +2881,7 @@ em_phy_get_info(struct em_hw *hw, phy_info->remote_rx = em_1000t_rx_status_undefined; if(hw->media_type != em_media_type_copper) { - DEBUGOUT("PHY info is only valid for copper media\n"); + HW_DEBUGOUT("PHY info is only valid for copper media"); return -E1000_ERR_CONFIG; } @@ -2891,7 +2892,7 @@ em_phy_get_info(struct em_hw *hw, return ret_val; if((phy_data & MII_SR_LINK_STATUS) != MII_SR_LINK_STATUS) { - DEBUGOUT("PHY info is only valid if link is up\n"); + HW_DEBUGOUT("PHY info is only valid if link is up"); return -E1000_ERR_CONFIG; } @@ -2907,7 +2908,7 @@ em_validate_mdi_setting(struct em_hw *hw) DEBUGFUNC("em_validate_mdi_settings"); if(!hw->autoneg && (hw->mdix == 0 || hw->mdix == 3)) { - DEBUGOUT("Invalid MDI setting detected\n"); + HW_DEBUGOUT("Invalid MDI setting detected"); hw->mdix = 1; return -E1000_ERR_CONFIG; } @@ -3198,7 +3199,7 @@ em_acquire_eeprom(struct em_hw *hw) if(!(eecd & E1000_EECD_GNT)) { eecd &= ~E1000_EECD_REQ; E1000_WRITE_REG(hw, EECD, eecd); - DEBUGOUT("Could not acquire EEPROM grant\n"); + HW_DEBUGOUT("Could not acquire EEPROM grant"); return -E1000_ERR_EEPROM; } } @@ -3356,7 +3357,7 @@ em_spi_eeprom_ready(struct em_hw *hw) * only 0-5mSec on 5V devices) */ if(retry_count >= EEPROM_MAX_RETRY_SPI) { - DEBUGOUT("SPI EEPROM Status error\n"); + HW_DEBUGOUT("SPI EEPROM Status error"); return -E1000_ERR_EEPROM; } @@ -3387,7 +3388,7 @@ em_read_eeprom(struct em_hw *hw, */ if((offset > eeprom->word_size) || (words > eeprom->word_size - offset) || (words == 0)) { - DEBUGOUT("\"words\" parameter out of bounds\n"); + HW_DEBUGOUT("\"words\" parameter out of bounds"); return -E1000_ERR_EEPROM; } @@ -3463,7 +3464,7 @@ em_validate_eeprom_checksum(struct em_hw *hw) for(i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) { if(em_read_eeprom(hw, i, 1, &eeprom_data) < 0) { - DEBUGOUT("EEPROM Read Error\n"); + HW_DEBUGOUT("EEPROM Read Error"); return -E1000_ERR_EEPROM; } checksum += eeprom_data; @@ -3472,7 +3473,7 @@ em_validate_eeprom_checksum(struct em_hw *hw) if(checksum == (uint16_t) EEPROM_SUM) return E1000_SUCCESS; else { - DEBUGOUT("EEPROM Checksum Invalid\n"); + HW_DEBUGOUT("EEPROM Checksum Invalid"); return -E1000_ERR_EEPROM; } } @@ -3495,14 +3496,14 @@ em_update_eeprom_checksum(struct em_hw *hw) for(i = 0; i < EEPROM_CHECKSUM_REG; i++) { if(em_read_eeprom(hw, i, 1, &eeprom_data) < 0) { - DEBUGOUT("EEPROM Read Error\n"); + HW_DEBUGOUT("EEPROM Read Error"); return -E1000_ERR_EEPROM; } checksum += eeprom_data; } checksum = (uint16_t) EEPROM_SUM - checksum; if(em_write_eeprom(hw, EEPROM_CHECKSUM_REG, 1, &checksum) < 0) { - DEBUGOUT("EEPROM Write Error\n"); + HW_DEBUGOUT("EEPROM Write Error"); return -E1000_ERR_EEPROM; } return E1000_SUCCESS; @@ -3535,7 +3536,7 @@ em_write_eeprom(struct em_hw *hw, */ if((offset > eeprom->word_size) || (words > eeprom->word_size - offset) || (words == 0)) { - DEBUGOUT("\"words\" parameter out of bounds\n"); + HW_DEBUGOUT("\"words\" parameter out of bounds"); return -E1000_ERR_EEPROM; } @@ -3684,7 +3685,7 @@ em_write_eeprom_microwire(struct em_hw *hw, usec_delay(50); } if(i == 200) { - DEBUGOUT("EEPROM Write did not complete\n"); + HW_DEBUGOUT("EEPROM Write did not complete"); return -E1000_ERR_EEPROM; } @@ -3725,7 +3726,7 @@ em_read_part_num(struct em_hw *hw, /* Get word 0 from EEPROM */ if(em_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { - DEBUGOUT("EEPROM Read Error\n"); + HW_DEBUGOUT("EEPROM Read Error"); return -E1000_ERR_EEPROM; } /* Save word 0 in upper half of part_num */ @@ -3733,7 +3734,7 @@ em_read_part_num(struct em_hw *hw, /* Get word 1 from EEPROM */ if(em_read_eeprom(hw, ++offset, 1, &eeprom_data) < 0) { - DEBUGOUT("EEPROM Read Error\n"); + HW_DEBUGOUT("EEPROM Read Error"); return -E1000_ERR_EEPROM; } /* Save word 1 in lower half of part_num */ @@ -3759,7 +3760,7 @@ em_read_mac_addr(struct em_hw * hw) for(i = 0; i < NODE_ADDRESS_SIZE; i += 2) { offset = i >> 1; if(em_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { - DEBUGOUT("EEPROM Read Error\n"); + HW_DEBUGOUT("EEPROM Read Error"); return -E1000_ERR_EEPROM; } hw->perm_mac_addr[i] = (uint8_t) (eeprom_data & 0x00FF); @@ -3791,12 +3792,12 @@ em_init_rx_addrs(struct em_hw *hw) DEBUGFUNC("em_init_rx_addrs"); /* Setup the receive address. */ - DEBUGOUT("Programming MAC Address into RAR[0]\n"); + HW_DEBUGOUT("Programming MAC Address into RAR[0]"); em_rar_set(hw, hw->mac_addr, 0); /* Zero out the other 15 receive addresses. */ - DEBUGOUT("Clearing RAR[1-15]\n"); + HW_DEBUGOUT("Clearing RAR[1-15]"); for(i = 1; i < E1000_RAR_ENTRIES; i++) { E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); @@ -3833,22 +3834,22 @@ em_mc_addr_list_update(struct em_hw *hw, hw->num_mc_addrs = mc_addr_count; /* Clear RAR[1-15] */ - DEBUGOUT(" Clearing RAR[1-15]\n"); + HW_DEBUGOUT(" Clearing RAR[1-15]"); for(i = rar_used_count; i < E1000_RAR_ENTRIES; i++) { E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); } /* Clear the MTA */ - DEBUGOUT(" Clearing MTA\n"); + HW_DEBUGOUT(" Clearing MTA"); for(i = 0; i < E1000_NUM_MTA_REGISTERS; i++) { E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); } /* Add the new addresses */ for(i = 0; i < mc_addr_count; i++) { - DEBUGOUT(" Adding the multicast addresses:\n"); - DEBUGOUT7(" MC Addr #%d =%.2X %.2X %.2X %.2X %.2X %.2X\n", i, + HW_DEBUGOUT(" Adding the multicast addresses:"); + HW_DEBUGOUT7(" MC Addr #%d =%.2X %.2X %.2X %.2X %.2X %.2X", i, mc_addr_list[i * (ETH_LENGTH_OF_ADDRESS + pad)], mc_addr_list[i * (ETH_LENGTH_OF_ADDRESS + pad) + 1], mc_addr_list[i * (ETH_LENGTH_OF_ADDRESS + pad) + 2], @@ -3860,7 +3861,7 @@ em_mc_addr_list_update(struct em_hw *hw, mc_addr_list + (i * (ETH_LENGTH_OF_ADDRESS + pad))); - DEBUGOUT1(" Hash value = 0x%03X\n", hash_value); + HW_DEBUGOUT1(" Hash value = 0x%03X", hash_value); /* Place this multicast address in the RAR if there is room, * * else put it in the MTA @@ -3874,7 +3875,7 @@ em_mc_addr_list_update(struct em_hw *hw, em_mta_set(hw, hash_value); } } - DEBUGOUT("MC Update Complete\n"); + HW_DEBUGOUT("MC Update Complete"); } /****************************************************************************** @@ -4048,7 +4049,7 @@ em_id_led_init(struct em_hw * hw) hw->ledctl_mode2 = hw->ledctl_default; if(em_read_eeprom(hw, EEPROM_ID_LED_SETTINGS, 1, &eeprom_data) < 0) { - DEBUGOUT("EEPROM Read Error\n"); + HW_DEBUGOUT("EEPROM Read Error"); return -E1000_ERR_EEPROM; } if((eeprom_data== ID_LED_RESERVED_0000) || @@ -4381,7 +4382,7 @@ em_reset_adaptive(struct em_hw *hw) hw->in_ifs_mode = FALSE; E1000_WRITE_REG(hw, AIT, 0); } else { - DEBUGOUT("Not in Adaptive IFS mode!\n"); + HW_DEBUGOUT("Not in Adaptive IFS mode!"); } } @@ -4418,7 +4419,7 @@ em_update_adaptive(struct em_hw *hw) } } } else { - DEBUGOUT("Not in Adaptive IFS mode!\n"); + HW_DEBUGOUT("Not in Adaptive IFS mode!"); } } @@ -4830,7 +4831,7 @@ em_config_dsp_after_link_change(struct em_hw *hw, if(link_up) { if((ret_val = em_get_speed_and_duplex(hw, &speed, &duplex))) { - DEBUGOUT("Error getting link speed and duplex\n"); + HW_DEBUGOUT("Error getting link speed and duplex"); return ret_val; } diff --git a/src/add-ons/kernel/drivers/network/ipro1000/if_em_osdep.c b/src/add-ons/kernel/drivers/network/ipro1000/if_em_osdep.c index 04ce9c994b..fe5b66a5df 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/if_em_osdep.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/if_em_osdep.c @@ -77,7 +77,7 @@ bus_alloc_resource(device_t dev, int type, int *rid, int d, int e, int f, int g) case SYS_RES_IOPORT: { uint32 v = pci_read_config(dev, *rid, 4) & PCI_address_io_mask; - TRACE("bus_alloc_resource SYS_RES_IOPORT, reg 0x%x, adr %p\n", *rid, (void *)v); + INIT_DEBUGOUT2("bus_alloc_resource SYS_RES_IOPORT, reg 0x%x, adr %p\n", *rid, (void *)v); return (struct resource *) v; } @@ -86,7 +86,7 @@ bus_alloc_resource(device_t dev, int type, int *rid, int d, int e, int f, int g) uint32 v = pci_read_config(dev, *rid, 4) & PCI_address_memory_32_mask; uint32 size = 128 * 1024; // XXX get size from BAR void *virt; - TRACE("bus_alloc_resource SYS_RES_MEMORY, reg 0x%x, adr %p\n", *rid, (void *)v); + INIT_DEBUGOUT2("bus_alloc_resource SYS_RES_MEMORY, reg 0x%x, adr %p\n", *rid, (void *)v); if (map_mem(&virt, (void *)v, size, 0, "SYS_RES_MEMORY") < 0) return 0; return (struct resource *) virt; @@ -96,14 +96,14 @@ bus_alloc_resource(device_t dev, int type, int *rid, int d, int e, int f, int g) { uint8 v = pci_read_config(dev, PCI_interrupt_line, 1); if (v == 0 || v == 0xff) { - ERROR("bus_alloc_resource SYS_RES_IRQ: no irq\n"); + ERROROUT("bus_alloc_resource SYS_RES_IRQ: no irq"); return 0; } return (struct resource *)(int)v; } default: - TRACE("bus_alloc_resource default!\n"); + INIT_DEBUGOUT("bus_alloc_resource default!\n"); return 0; } } @@ -121,7 +121,7 @@ bus_release_resource(device_t dev, int type, int reg, struct resource *res) return; default: - TRACE("bus_release_resource default!\n"); + INIT_DEBUGOUT("bus_release_resource default!\n"); return; } } diff --git a/src/add-ons/kernel/drivers/network/ipro1000/if_em_osdep.h b/src/add-ons/kernel/drivers/network/ipro1000/if_em_osdep.h index 1629f3797b..94d3b87905 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/if_em_osdep.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/if_em_osdep.h @@ -42,29 +42,12 @@ POSSIBILITY OF SUCH DAMAGE. #include #include "driver.h" #include "device.h" -#include "debug.h" #include "timer.h" +#include "debug.h" #define usec_delay(x) snooze(x) #define msec_delay(x) snooze(1000*(x)) -#define MSGOUT(S, A, B) dprintf("ipro1000: " S "\n", A, B) -#define DEBUGFUNC(F) DEBUGOUT(F); - -#if DEBUG_HW - #define DEBUGOUT(S) dprintf("ipro1000: " S "\n") - #define DEBUGOUT1(S,A) dprintf("ipro1000: " S "\n",A) - #define DEBUGOUT2(S,A,B) dprintf("ipro1000: " S "\n",A,B) - #define DEBUGOUT3(S,A,B,C) dprintf("ipro1000: " S "\n",A,B,C) - #define DEBUGOUT7(S,A,B,C,D,E,F,G) dprintf("ipro1000: " S "\n",A,B,C,D,E,F,G) -#else - #define DEBUGOUT(S) - #define DEBUGOUT1(S,A) - #define DEBUGOUT2(S,A,B) - #define DEBUGOUT3(S,A,B,C) - #define DEBUGOUT7(S,A,B,C,D,E,F,G) -#endif - // no longer used in FreeBSD #define splx(s) #define splimp() 0 @@ -144,7 +127,7 @@ static inline unsigned long vtophys(unsigned long virtual_addr) { physical_entry pe; if (get_memory_map((void *)virtual_addr, 2048, &pe, 1) < 0) { - TRACE("get_memory_map failed for %p\n", (void *)virtual_addr); + ERROROUT1("get_memory_map failed for %p\n", (void *)virtual_addr); return 0; } return (unsigned long) pe.address; diff --git a/src/add-ons/kernel/drivers/network/ipro1000/mempool.c b/src/add-ons/kernel/drivers/network/ipro1000/mempool.c index d3fa118a5a..f7fd1a04be 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/mempool.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/mempool.c @@ -46,17 +46,17 @@ mempool_init(int count) int i; - TRACE("chunk_size %d, mbuf_size %d\n", chunk_size, mbuf_size); - TRACE("chunk_alloc_size %d, mbuf_alloc_size %d\n", chunk_alloc_size, mbuf_alloc_size); + INIT_DEBUGOUT2("chunk_size %d, mbuf_size %d", chunk_size, mbuf_size); + INIT_DEBUGOUT2("chunk_alloc_size %d, mbuf_alloc_size %d", chunk_alloc_size, mbuf_alloc_size); chunk_pool = area_malloc(chunk_alloc_size); if (!chunk_pool) { - ERROR("failed to allocate chunk storage of %d bytes\n", chunk_alloc_size); + ERROROUT1("failed to allocate chunk storage of %d bytes\n", chunk_alloc_size); return -1; } mbuf_pool = area_malloc(mbuf_alloc_size); if (!mbuf_pool) { - ERROR("failed to allocate mbuf storage of %d bytes\n", mbuf_alloc_size); + ERROROUT1("failed to allocate mbuf storage of %d bytes\n", mbuf_alloc_size); area_free(chunk_pool); return -1; } @@ -69,7 +69,7 @@ mempool_init(int count) mbuf_pool_put(mbuf_base + i * mbuf_size); } - TRACE("mempool init success\n"); + INIT_DEBUGOUT("mempool init success"); return 0; } diff --git a/src/add-ons/kernel/drivers/network/ipro1000/setup.h b/src/add-ons/kernel/drivers/network/ipro1000/setup.h index 909606e673..ac2689e284 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/setup.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/setup.h @@ -19,10 +19,10 @@ #ifndef __SETUP_H #define __SETUP_H -#define VERSION "0.2" +#define VERSION "0.3" -#define INFO1 "ipro1000: Intel PRO/1000 Family Driver. Version " VERSION " Build " __DATE__ " "__TIME__ -#define INFO2 "ipro1000: Copyright (c) 2001-2003, Intel Corporation. All rights reserved." -#define INFO3 "ipro1000: Copyright (c) 2004 Marcus Overhagen. All rights reserved." +#define INFO1 "Intel PRO/1000 Family Driver. Version " VERSION " Build " __DATE__ " "__TIME__ +#define INFO2 "Copyright (c) 2001-2003, Intel Corporation. All rights reserved." +#define INFO3 "Copyright (c) 2004 Marcus Overhagen. All rights reserved." #endif diff --git a/src/add-ons/kernel/drivers/network/ipro1000/util.c b/src/add-ons/kernel/drivers/network/ipro1000/util.c index 2b44a5c0b0..0d05ce5366 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/util.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/util.c @@ -20,8 +20,6 @@ #include #include -//#define DEBUG - #include "debug.h" #include "util.h" @@ -33,20 +31,20 @@ map_mem(void **virt, void *phy, size_t size, uint32 protection, const char *name void *mapadr; area_id area; - TRACE("mapping physical address %p with %ld bytes for %s\n", phy, size, name); + INIT_DEBUGOUT3("mapping physical address %p with %ld bytes for %s\n", phy, size, name); offset = (uint32)phy & (B_PAGE_SIZE - 1); phyadr = (char *)phy - offset; size = ROUNDUP(size + offset, B_PAGE_SIZE); area = map_physical_memory(name, phyadr, size, B_ANY_KERNEL_BLOCK_ADDRESS, protection, &mapadr); if (area < B_OK) { - ERROR("mapping '%s' failed, error 0x%lx (%s)\n", name, area, strerror(area)); + ERROROUT3("mapping '%s' failed, error 0x%lx (%s)\n", name, area, strerror(area)); return area; } *virt = (char *)mapadr + offset; - TRACE("physical = %p, virtual = %p, offset = %ld, phyadr = %p, mapadr = %p, size = %ld, area = 0x%08lx\n", + INIT_DEBUGOUT7("physical = %p, virtual = %p, offset = %ld, phyadr = %p, mapadr = %p, size = %ld, area = 0x%08lx\n", phy, *virt, offset, phyadr, mapadr, size, area); return area;