qdio_debug.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * drivers/s390/cio/qdio_debug.h
  3. *
  4. * Copyright IBM Corp. 2008
  5. *
  6. * Author: Jan Glauber (jang@linux.vnet.ibm.com)
  7. */
  8. #ifndef QDIO_DEBUG_H
  9. #define QDIO_DEBUG_H
  10. #include <asm/debug.h>
  11. #include <asm/qdio.h>
  12. #include "qdio.h"
  13. /* that gives us 15 characters in the text event views */
  14. #define QDIO_DBF_LEN 16
  15. extern debug_info_t *qdio_dbf_setup;
  16. extern debug_info_t *qdio_dbf_error;
  17. /* sort out low debug levels early to avoid wasted sprints */
  18. static inline int qdio_dbf_passes(debug_info_t *dbf_grp, int level)
  19. {
  20. return (level <= dbf_grp->level);
  21. }
  22. #define DBF_ERR 3 /* error conditions */
  23. #define DBF_WARN 4 /* warning conditions */
  24. #define DBF_INFO 6 /* informational */
  25. #undef DBF_EVENT
  26. #undef DBF_ERROR
  27. #undef DBF_DEV_EVENT
  28. #define DBF_EVENT(text...) \
  29. do { \
  30. char debug_buffer[QDIO_DBF_LEN]; \
  31. snprintf(debug_buffer, QDIO_DBF_LEN, text); \
  32. debug_text_event(qdio_dbf_setup, DBF_ERR, debug_buffer); \
  33. } while (0)
  34. #define DBF_HEX(addr, len) \
  35. do { \
  36. debug_event(qdio_dbf_setup, DBF_ERR, (void*)(addr), len); \
  37. } while (0)
  38. #define DBF_ERROR(text...) \
  39. do { \
  40. char debug_buffer[QDIO_DBF_LEN]; \
  41. snprintf(debug_buffer, QDIO_DBF_LEN, text); \
  42. debug_text_event(qdio_dbf_error, DBF_ERR, debug_buffer); \
  43. } while (0)
  44. #define DBF_ERROR_HEX(addr, len) \
  45. do { \
  46. debug_event(qdio_dbf_error, DBF_ERR, (void*)(addr), len); \
  47. } while (0)
  48. #define DBF_DEV_EVENT(level, device, text...) \
  49. do { \
  50. char debug_buffer[QDIO_DBF_LEN]; \
  51. if (qdio_dbf_passes(device->debug_area, level)) { \
  52. snprintf(debug_buffer, QDIO_DBF_LEN, text); \
  53. debug_text_event(device->debug_area, level, debug_buffer); \
  54. } \
  55. } while (0)
  56. #define DBF_DEV_HEX(level, device, addr, len) \
  57. do { \
  58. debug_event(device->debug_area, level, (void*)(addr), len); \
  59. } while (0)
  60. void qdio_allocate_dbf(struct qdio_initialize *init_data,
  61. struct qdio_irq *irq_ptr);
  62. void qdio_setup_debug_entries(struct qdio_irq *irq_ptr,
  63. struct ccw_device *cdev);
  64. void qdio_shutdown_debug_entries(struct qdio_irq *irq_ptr,
  65. struct ccw_device *cdev);
  66. int qdio_debug_init(void);
  67. void qdio_debug_exit(void);
  68. #endif