162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Driver for USB Mass Storage compliant devices 462306a36Sopenharmony_ci * Debugging Functions Header File 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * Current development and maintenance by: 762306a36Sopenharmony_ci * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * Initial work by: 1062306a36Sopenharmony_ci * (c) 1999 Michael Gee (michael@linuxspecific.com) 1162306a36Sopenharmony_ci * 1262306a36Sopenharmony_ci * This driver is based on the 'USB Mass Storage Class' document. This 1362306a36Sopenharmony_ci * describes in detail the protocol used to communicate with such 1462306a36Sopenharmony_ci * devices. Clearly, the designers had SCSI and ATAPI commands in 1562306a36Sopenharmony_ci * mind when they created this document. The commands are all very 1662306a36Sopenharmony_ci * similar to commands in the SCSI-II and ATAPI specifications. 1762306a36Sopenharmony_ci * 1862306a36Sopenharmony_ci * It is important to note that in a number of cases this class 1962306a36Sopenharmony_ci * exhibits class-specific exemptions from the USB specification. 2062306a36Sopenharmony_ci * Notably the usage of NAK, STALL and ACK differs from the norm, in 2162306a36Sopenharmony_ci * that they are used to communicate wait, failed and OK on commands. 2262306a36Sopenharmony_ci * 2362306a36Sopenharmony_ci * Also, for certain devices, the interrupt endpoint is used to convey 2462306a36Sopenharmony_ci * status of a command. 2562306a36Sopenharmony_ci */ 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci#ifndef _DEBUG_H_ 2862306a36Sopenharmony_ci#define _DEBUG_H_ 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci#include <linux/kernel.h> 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci#ifdef CONFIG_USB_STORAGE_DEBUG 3362306a36Sopenharmony_civoid usb_stor_show_command(const struct us_data *us, struct scsi_cmnd *srb); 3462306a36Sopenharmony_civoid usb_stor_show_sense(const struct us_data *us, unsigned char key, 3562306a36Sopenharmony_ci unsigned char asc, unsigned char ascq); 3662306a36Sopenharmony_ci__printf(2, 3) void usb_stor_dbg(const struct us_data *us, 3762306a36Sopenharmony_ci const char *fmt, ...); 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#define US_DEBUG(x) x 4062306a36Sopenharmony_ci#else 4162306a36Sopenharmony_ci__printf(2, 3) 4262306a36Sopenharmony_cistatic inline void _usb_stor_dbg(const struct us_data *us, 4362306a36Sopenharmony_ci const char *fmt, ...) 4462306a36Sopenharmony_ci{ 4562306a36Sopenharmony_ci} 4662306a36Sopenharmony_ci#define usb_stor_dbg(us, fmt, ...) \ 4762306a36Sopenharmony_ci do { if (0) _usb_stor_dbg(us, fmt, ##__VA_ARGS__); } while (0) 4862306a36Sopenharmony_ci#define US_DEBUG(x) 4962306a36Sopenharmony_ci#endif 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci#endif 52