blob: b631842ec8d00a2cd861bde288cd7c768bc141d0 [file] [log] [blame]
David Gibson1d3bb992007-08-23 13:56:01 +10001/*
2 * drivers/net/ibm_newemac/debug.h
3 *
4 * Driver for PowerPC 4xx on-chip ethernet controller, debug print routines.
5 *
Benjamin Herrenschmidt17cf8032007-12-05 11:14:33 +11006 * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
7 * <benh@kernel.crashing.org>
8 *
9 * Based on the arch/ppc version of the driver:
10 *
David Gibson1d3bb992007-08-23 13:56:01 +100011 * Copyright (c) 2004, 2005 Zultys Technologies
12 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
13 *
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2 of the License, or (at your
17 * option) any later version.
18 *
19 */
20#ifndef __IBM_NEWEMAC_DEBUG_H
21#define __IBM_NEWEMAC_DEBUG_H
22
23#include <linux/init.h>
24
25#include "core.h"
26
27#if defined(CONFIG_IBM_NEW_EMAC_DEBUG)
28
29struct emac_instance;
30struct mal_instance;
31
32extern void emac_dbg_register(struct emac_instance *dev);
33extern void emac_dbg_unregister(struct emac_instance *dev);
34extern void mal_dbg_register(struct mal_instance *mal);
35extern void mal_dbg_unregister(struct mal_instance *mal);
36extern int emac_init_debug(void) __init;
37extern void emac_fini_debug(void) __exit;
38extern void emac_dbg_dump_all(void);
39
40# define DBG_LEVEL 1
41
42#else
43
44# define emac_dbg_register(x) do { } while(0)
45# define emac_dbg_unregister(x) do { } while(0)
46# define mal_dbg_register(x) do { } while(0)
47# define mal_dbg_unregister(x) do { } while(0)
48# define emac_init_debug() do { } while(0)
49# define emac_fini_debug() do { } while(0)
50# define emac_dbg_dump_all() do { } while(0)
51
52# define DBG_LEVEL 0
53
54#endif
55
56#define EMAC_DBG(dev, name, fmt, arg...) \
57 printk(KERN_DEBUG #name "%s: " fmt, dev->ofdev->node->full_name, ## arg)
58
59#if DBG_LEVEL > 0
60# define DBG(d,f,x...) EMAC_DBG(d, emac, f, ##x)
61# define MAL_DBG(d,f,x...) EMAC_DBG(d, mal, f, ##x)
62# define ZMII_DBG(d,f,x...) EMAC_DBG(d, zmii, f, ##x)
63# define RGMII_DBG(d,f,x...) EMAC_DBG(d, rgmii, f, ##x)
64# define NL "\n"
65#else
66# define DBG(f,x...) ((void)0)
67# define MAL_DBG(d,f,x...) ((void)0)
68# define ZMII_DBG(d,f,x...) ((void)0)
69# define RGMII_DBG(d,f,x...) ((void)0)
70#endif
71#if DBG_LEVEL > 1
72# define DBG2(d,f,x...) DBG(d,f, ##x)
73# define MAL_DBG2(d,f,x...) MAL_DBG(d,f, ##x)
74# define ZMII_DBG2(d,f,x...) ZMII_DBG(d,f, ##x)
75# define RGMII_DBG2(d,f,x...) RGMII_DBG(d,f, ##x)
76#else
77# define DBG2(f,x...) ((void)0)
78# define MAL_DBG2(d,f,x...) ((void)0)
79# define ZMII_DBG2(d,f,x...) ((void)0)
80# define RGMII_DBG2(d,f,x...) ((void)0)
81#endif
82
83#endif /* __IBM_NEWEMAC_DEBUG_H */