xref: /linux/drivers/net/ethernet/ibm/emac/debug.h (revision 3396c782)
19aa32835SJeff Kirsher /*
2*3396c782SPaul Gortmaker  * drivers/net/ethernet/ibm/emac/debug.h
39aa32835SJeff Kirsher  *
49aa32835SJeff Kirsher  * Driver for PowerPC 4xx on-chip ethernet controller, debug print routines.
59aa32835SJeff Kirsher  *
69aa32835SJeff Kirsher  * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
79aa32835SJeff Kirsher  *                <benh@kernel.crashing.org>
89aa32835SJeff Kirsher  *
99aa32835SJeff Kirsher  * Based on the arch/ppc version of the driver:
109aa32835SJeff Kirsher  *
119aa32835SJeff Kirsher  * Copyright (c) 2004, 2005 Zultys Technologies
129aa32835SJeff Kirsher  * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
139aa32835SJeff Kirsher  *
149aa32835SJeff Kirsher  * This program is free software; you can redistribute  it and/or modify it
159aa32835SJeff Kirsher  * under  the terms of  the GNU General  Public License as published by the
169aa32835SJeff Kirsher  * Free Software Foundation;  either version 2 of the  License, or (at your
179aa32835SJeff Kirsher  * option) any later version.
189aa32835SJeff Kirsher  *
199aa32835SJeff Kirsher  */
209aa32835SJeff Kirsher #ifndef __IBM_NEWEMAC_DEBUG_H
219aa32835SJeff Kirsher #define __IBM_NEWEMAC_DEBUG_H
229aa32835SJeff Kirsher 
239aa32835SJeff Kirsher #include <linux/init.h>
249aa32835SJeff Kirsher 
259aa32835SJeff Kirsher #include "core.h"
269aa32835SJeff Kirsher 
273b3bceefSTony Breeds #if defined(CONFIG_IBM_EMAC_DEBUG)
289aa32835SJeff Kirsher 
299aa32835SJeff Kirsher struct emac_instance;
309aa32835SJeff Kirsher struct mal_instance;
319aa32835SJeff Kirsher 
329aa32835SJeff Kirsher extern void emac_dbg_register(struct emac_instance *dev);
339aa32835SJeff Kirsher extern void emac_dbg_unregister(struct emac_instance *dev);
349aa32835SJeff Kirsher extern void mal_dbg_register(struct mal_instance *mal);
359aa32835SJeff Kirsher extern void mal_dbg_unregister(struct mal_instance *mal);
369aa32835SJeff Kirsher extern int emac_init_debug(void) __init;
379aa32835SJeff Kirsher extern void emac_fini_debug(void) __exit;
389aa32835SJeff Kirsher extern void emac_dbg_dump_all(void);
399aa32835SJeff Kirsher 
409aa32835SJeff Kirsher # define DBG_LEVEL		1
419aa32835SJeff Kirsher 
429aa32835SJeff Kirsher #else
439aa32835SJeff Kirsher 
449aa32835SJeff Kirsher # define emac_dbg_register(x)	do { } while(0)
459aa32835SJeff Kirsher # define emac_dbg_unregister(x)	do { } while(0)
469aa32835SJeff Kirsher # define mal_dbg_register(x)	do { } while(0)
479aa32835SJeff Kirsher # define mal_dbg_unregister(x)	do { } while(0)
489aa32835SJeff Kirsher # define emac_init_debug()	do { } while(0)
499aa32835SJeff Kirsher # define emac_fini_debug()	do { } while(0)
509aa32835SJeff Kirsher # define emac_dbg_dump_all()	do { } while(0)
519aa32835SJeff Kirsher 
529aa32835SJeff Kirsher # define DBG_LEVEL		0
539aa32835SJeff Kirsher 
549aa32835SJeff Kirsher #endif
559aa32835SJeff Kirsher 
569aa32835SJeff Kirsher #define EMAC_DBG(d, name, fmt, arg...) \
579aa32835SJeff Kirsher 	printk(KERN_DEBUG #name "%s: " fmt, d->ofdev->dev.of_node->full_name, ## arg)
589aa32835SJeff Kirsher 
599aa32835SJeff Kirsher #if DBG_LEVEL > 0
609aa32835SJeff Kirsher #  define DBG(d,f,x...)		EMAC_DBG(d, emac, f, ##x)
619aa32835SJeff Kirsher #  define MAL_DBG(d,f,x...)	EMAC_DBG(d, mal, f, ##x)
629aa32835SJeff Kirsher #  define ZMII_DBG(d,f,x...)	EMAC_DBG(d, zmii, f, ##x)
639aa32835SJeff Kirsher #  define RGMII_DBG(d,f,x...)	EMAC_DBG(d, rgmii, f, ##x)
649aa32835SJeff Kirsher #  define NL			"\n"
659aa32835SJeff Kirsher #else
669aa32835SJeff Kirsher #  define DBG(f,x...)		((void)0)
679aa32835SJeff Kirsher #  define MAL_DBG(d,f,x...)	((void)0)
689aa32835SJeff Kirsher #  define ZMII_DBG(d,f,x...)	((void)0)
699aa32835SJeff Kirsher #  define RGMII_DBG(d,f,x...)	((void)0)
709aa32835SJeff Kirsher #endif
719aa32835SJeff Kirsher #if DBG_LEVEL > 1
729aa32835SJeff Kirsher #  define DBG2(d,f,x...) 	DBG(d,f, ##x)
739aa32835SJeff Kirsher #  define MAL_DBG2(d,f,x...) 	MAL_DBG(d,f, ##x)
749aa32835SJeff Kirsher #  define ZMII_DBG2(d,f,x...) 	ZMII_DBG(d,f, ##x)
759aa32835SJeff Kirsher #  define RGMII_DBG2(d,f,x...) 	RGMII_DBG(d,f, ##x)
769aa32835SJeff Kirsher #else
779aa32835SJeff Kirsher #  define DBG2(f,x...) 		((void)0)
789aa32835SJeff Kirsher #  define MAL_DBG2(d,f,x...) 	((void)0)
799aa32835SJeff Kirsher #  define ZMII_DBG2(d,f,x...) 	((void)0)
809aa32835SJeff Kirsher #  define RGMII_DBG2(d,f,x...) 	((void)0)
819aa32835SJeff Kirsher #endif
829aa32835SJeff Kirsher 
839aa32835SJeff Kirsher #endif /* __IBM_NEWEMAC_DEBUG_H */
84