/scsipi/scsipi_debug.h

http://rtems-atapi.googlecode.com/ · C++ Header · 87 lines · 36 code · 10 blank · 41 comment · 4 complexity · eda08fb003febbddeff71d5c663523f4 MD5 · raw file

  1. /* $NetBSD: scsipi_debug.h,v 1.17 2008/04/28 20:23:58 martin Exp $ */
  2. /*-
  3. * Copyright (c) 1999 The NetBSD Foundation, Inc.
  4. * All rights reserved.
  5. *
  6. * This code is derived from software contributed to The NetBSD Foundation
  7. * by by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
  8. * NASA Ames Research Center.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in the
  17. * documentation and/or other materials provided with the distribution.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  20. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  21. * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  22. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
  23. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  24. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  25. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  26. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  27. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  28. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  29. * POSSIBILITY OF SUCH DAMAGE.
  30. */
  31. #if defined(_KERNEL_OPT)
  32. #include "opt_scsipi_debug.h"
  33. #endif
  34. /*
  35. * Originally written by Julian Elischer (julian@tfs.com)
  36. */
  37. #define SCSIPI_DB1 0x0001 /* scsi commands, errors, data */
  38. #define SCSIPI_DB2 0x0002 /* routine flow tracking */
  39. #define SCSIPI_DB3 0x0004 /* internal to routine flows */
  40. #define SCSIPI_DB4 0x0008 /* level 4 debugging for this dev */
  41. /*
  42. * The following options allow us to build a kernel with debugging on
  43. * by default for a certain type of device. We can always enable
  44. * debugging on a specific device using an ioctl.
  45. */
  46. #ifndef SCSIPI_DEBUG_TYPE
  47. #define SCSIPI_DEBUG_TYPE SCSIPI_BUSTYPE_ATAPI
  48. #endif
  49. #ifndef SCSIPI_DEBUG_TARGET
  50. #define SCSIPI_DEBUG_TARGET -1 /* disabled */
  51. #endif
  52. #ifndef SCSIPI_DEBUG_LUN
  53. #define SCSIPI_DEBUG_LUN 0
  54. #endif
  55. /*
  56. * Default debugging flags for above.
  57. */
  58. #ifndef SCSIPI_DEBUG_FLAGS
  59. #define SCSIPI_DEBUG_FLAGS (SCSIPI_DB1|SCSIPI_DB2|SCSIPI_DB3)
  60. #endif
  61. #ifdef SCSIPI_DEBUG
  62. #define SC_DEBUG(periph, flags, x) \
  63. do { \
  64. if ((periph)->periph_dbflags & (flags)) { \
  65. scsipi_printaddr((periph)); \
  66. printf x ; \
  67. } \
  68. } while (0)
  69. #define SC_DEBUGN(periph, flags, x) \
  70. do { \
  71. if ((periph)->periph_dbflags & (flags)) \
  72. printf x ; \
  73. } while (0)
  74. #else
  75. #define SC_DEBUG(periph, flags, x) /* nothing */
  76. #define SC_DEBUGN(periph, flags, x) /* nothing */
  77. #endif