debug.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * drivers/net/ethernet/ibm/emac/debug.h
  3. *
  4. * Driver for PowerPC 4xx on-chip ethernet controller, debug print routines.
  5. *
  6. * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
  7. * <benh@kernel.crashing.org>
  8. *
  9. * Based on the arch/ppc version of the driver:
  10. *
  11. * 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. #include <linux/init.h>
  23. #include "core.h"
  24. #if defined(CONFIG_IBM_EMAC_DEBUG)
  25. struct emac_instance;
  26. struct mal_instance;
  27. void emac_dbg_register(struct emac_instance *dev);
  28. void emac_dbg_unregister(struct emac_instance *dev);
  29. void mal_dbg_register(struct mal_instance *mal);
  30. void mal_dbg_unregister(struct mal_instance *mal);
  31. int emac_init_debug(void) __init;
  32. void emac_fini_debug(void) __exit;
  33. void emac_dbg_dump_all(void);
  34. # define DBG_LEVEL 1
  35. #else
  36. # define emac_dbg_register(x) do { } while(0)
  37. # define emac_dbg_unregister(x) do { } while(0)
  38. # define mal_dbg_register(x) do { } while(0)
  39. # define mal_dbg_unregister(x) do { } while(0)
  40. # define emac_init_debug() do { } while(0)
  41. # define emac_fini_debug() do { } while(0)
  42. # define emac_dbg_dump_all() do { } while(0)
  43. # define DBG_LEVEL 0
  44. #endif
  45. #define EMAC_DBG(d, name, fmt, arg...) \
  46. printk(KERN_DEBUG #name "%s: " fmt, d->ofdev->dev.of_node->full_name, ## arg)
  47. #if DBG_LEVEL > 0
  48. # define DBG(d,f,x...) EMAC_DBG(d, emac, f, ##x)
  49. # define MAL_DBG(d,f,x...) EMAC_DBG(d, mal, f, ##x)
  50. # define ZMII_DBG(d,f,x...) EMAC_DBG(d, zmii, f, ##x)
  51. # define RGMII_DBG(d,f,x...) EMAC_DBG(d, rgmii, f, ##x)
  52. # define NL "\n"
  53. #else
  54. # define DBG(f,x...) ((void)0)
  55. # define MAL_DBG(d,f,x...) ((void)0)
  56. # define ZMII_DBG(d,f,x...) ((void)0)
  57. # define RGMII_DBG(d,f,x...) ((void)0)
  58. #endif
  59. #if DBG_LEVEL > 1
  60. # define DBG2(d,f,x...) DBG(d,f, ##x)
  61. # define MAL_DBG2(d,f,x...) MAL_DBG(d,f, ##x)
  62. # define ZMII_DBG2(d,f,x...) ZMII_DBG(d,f, ##x)
  63. # define RGMII_DBG2(d,f,x...) RGMII_DBG(d,f, ##x)
  64. #else
  65. # define DBG2(f,x...) ((void)0)
  66. # define MAL_DBG2(d,f,x...) ((void)0)
  67. # define ZMII_DBG2(d,f,x...) ((void)0)
  68. # define RGMII_DBG2(d,f,x...) ((void)0)
  69. #endif
  70. #endif /* __IBM_NEWEMAC_DEBUG_H */