Linux Audio

Check our new training course

Loading...
v6.8
  1// SPDX-License-Identifier: GPL-2.0-or-later
  2/*
  3 * libata-trace.c - trace functions for libata
  4 *
  5 * Copyright 2015 Hannes Reinecke
  6 * Copyright 2015 SUSE Linux GmbH
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  7 */
  8
  9#include <linux/kernel.h>
 10#include <linux/trace_seq.h>
 11#include <trace/events/libata.h>
 12
 13const char *
 14libata_trace_parse_status(struct trace_seq *p, unsigned char status)
 15{
 16	const char *ret = trace_seq_buffer_ptr(p);
 17
 18	trace_seq_printf(p, "{ ");
 19	if (status & ATA_BUSY)
 20		trace_seq_printf(p, "BUSY ");
 21	if (status & ATA_DRDY)
 22		trace_seq_printf(p, "DRDY ");
 23	if (status & ATA_DF)
 24		trace_seq_printf(p, "DF ");
 25	if (status & ATA_DSC)
 26		trace_seq_printf(p, "DSC ");
 27	if (status & ATA_DRQ)
 28		trace_seq_printf(p, "DRQ ");
 29	if (status & ATA_CORR)
 30		trace_seq_printf(p, "CORR ");
 31	if (status & ATA_SENSE)
 32		trace_seq_printf(p, "SENSE ");
 33	if (status & ATA_ERR)
 34		trace_seq_printf(p, "ERR ");
 35	trace_seq_putc(p, '}');
 36	trace_seq_putc(p, 0);
 37
 38	return ret;
 39}
 40
 41const char *
 42libata_trace_parse_host_stat(struct trace_seq *p, unsigned char host_stat)
 43{
 44	const char *ret = trace_seq_buffer_ptr(p);
 45
 46	trace_seq_printf(p, "{ ");
 47	if (host_stat & ATA_DMA_INTR)
 48		trace_seq_printf(p, "INTR ");
 49	if (host_stat & ATA_DMA_ERR)
 50		trace_seq_printf(p, "ERR ");
 51	if (host_stat & ATA_DMA_ACTIVE)
 52		trace_seq_printf(p, "ACTIVE ");
 53	trace_seq_putc(p, '}');
 54	trace_seq_putc(p, 0);
 55
 56	return ret;
 57}
 58
 59const char *
 60libata_trace_parse_eh_action(struct trace_seq *p, unsigned int eh_action)
 61{
 62	const char *ret = trace_seq_buffer_ptr(p);
 63
 64	trace_seq_printf(p, "%x", eh_action);
 65	if (eh_action) {
 66		trace_seq_printf(p, "{ ");
 67		if (eh_action & ATA_EH_REVALIDATE)
 68			trace_seq_printf(p, "REVALIDATE ");
 69		if (eh_action & (ATA_EH_SOFTRESET | ATA_EH_HARDRESET))
 70			trace_seq_printf(p, "RESET ");
 71		else if (eh_action & ATA_EH_SOFTRESET)
 72			trace_seq_printf(p, "SOFTRESET ");
 73		else if (eh_action & ATA_EH_HARDRESET)
 74			trace_seq_printf(p, "HARDRESET ");
 75		if (eh_action & ATA_EH_ENABLE_LINK)
 76			trace_seq_printf(p, "ENABLE_LINK ");
 77		if (eh_action & ATA_EH_PARK)
 78			trace_seq_printf(p, "PARK ");
 79		trace_seq_putc(p, '}');
 80	}
 81	trace_seq_putc(p, 0);
 82
 83	return ret;
 84}
 85
 86const char *
 87libata_trace_parse_eh_err_mask(struct trace_seq *p, unsigned int eh_err_mask)
 88{
 89	const char *ret = trace_seq_buffer_ptr(p);
 90
 91	trace_seq_printf(p, "%x", eh_err_mask);
 92	if (eh_err_mask) {
 93		trace_seq_printf(p, "{ ");
 94		if (eh_err_mask & AC_ERR_DEV)
 95			trace_seq_printf(p, "DEV ");
 96		if (eh_err_mask & AC_ERR_HSM)
 97			trace_seq_printf(p, "HSM ");
 98		if (eh_err_mask & AC_ERR_TIMEOUT)
 99			trace_seq_printf(p, "TIMEOUT ");
100		if (eh_err_mask & AC_ERR_MEDIA)
101			trace_seq_printf(p, "MEDIA ");
102		if (eh_err_mask & AC_ERR_ATA_BUS)
103			trace_seq_printf(p, "ATA_BUS ");
104		if (eh_err_mask & AC_ERR_HOST_BUS)
105			trace_seq_printf(p, "HOST_BUS ");
106		if (eh_err_mask & AC_ERR_SYSTEM)
107			trace_seq_printf(p, "SYSTEM ");
108		if (eh_err_mask & AC_ERR_INVALID)
109			trace_seq_printf(p, "INVALID ");
110		if (eh_err_mask & AC_ERR_OTHER)
111			trace_seq_printf(p, "OTHER ");
112		if (eh_err_mask & AC_ERR_NODEV_HINT)
113			trace_seq_printf(p, "NODEV_HINT ");
114		if (eh_err_mask & AC_ERR_NCQ)
115			trace_seq_printf(p, "NCQ ");
116		trace_seq_putc(p, '}');
117	}
118	trace_seq_putc(p, 0);
119
120	return ret;
121}
122
123const char *
124libata_trace_parse_qc_flags(struct trace_seq *p, unsigned int qc_flags)
125{
126	const char *ret = trace_seq_buffer_ptr(p);
127
128	trace_seq_printf(p, "%x", qc_flags);
129	if (qc_flags) {
130		trace_seq_printf(p, "{ ");
131		if (qc_flags & ATA_QCFLAG_ACTIVE)
132			trace_seq_printf(p, "ACTIVE ");
133		if (qc_flags & ATA_QCFLAG_DMAMAP)
134			trace_seq_printf(p, "DMAMAP ");
135		if (qc_flags & ATA_QCFLAG_IO)
136			trace_seq_printf(p, "IO ");
137		if (qc_flags & ATA_QCFLAG_RESULT_TF)
138			trace_seq_printf(p, "RESULT_TF ");
139		if (qc_flags & ATA_QCFLAG_CLEAR_EXCL)
140			trace_seq_printf(p, "CLEAR_EXCL ");
141		if (qc_flags & ATA_QCFLAG_QUIET)
142			trace_seq_printf(p, "QUIET ");
143		if (qc_flags & ATA_QCFLAG_RETRY)
144			trace_seq_printf(p, "RETRY ");
145		if (qc_flags & ATA_QCFLAG_EH)
146			trace_seq_printf(p, "FAILED ");
147		if (qc_flags & ATA_QCFLAG_SENSE_VALID)
148			trace_seq_printf(p, "SENSE_VALID ");
149		if (qc_flags & ATA_QCFLAG_EH_SCHEDULED)
150			trace_seq_printf(p, "EH_SCHEDULED ");
151		trace_seq_putc(p, '}');
152	}
153	trace_seq_putc(p, 0);
154
155	return ret;
156}
157
158const char *
159libata_trace_parse_tf_flags(struct trace_seq *p, unsigned int tf_flags)
160{
161	const char *ret = trace_seq_buffer_ptr(p);
162
163	trace_seq_printf(p, "%x", tf_flags);
164	if (tf_flags) {
165		trace_seq_printf(p, "{ ");
166		if (tf_flags & ATA_TFLAG_LBA48)
167			trace_seq_printf(p, "LBA48 ");
168		if (tf_flags & ATA_TFLAG_ISADDR)
169			trace_seq_printf(p, "ISADDR ");
170		if (tf_flags & ATA_TFLAG_DEVICE)
171			trace_seq_printf(p, "DEV ");
172		if (tf_flags & ATA_TFLAG_WRITE)
173			trace_seq_printf(p, "WRITE ");
174		if (tf_flags & ATA_TFLAG_LBA)
175			trace_seq_printf(p, "LBA ");
176		if (tf_flags & ATA_TFLAG_FUA)
177			trace_seq_printf(p, "FUA ");
178		if (tf_flags & ATA_TFLAG_POLLING)
179			trace_seq_printf(p, "POLL ");
180		trace_seq_putc(p, '}');
181	}
182	trace_seq_putc(p, 0);
183
184	return ret;
185}
186
187const char *
188libata_trace_parse_subcmd(struct trace_seq *p, unsigned char cmd,
189			  unsigned char feature, unsigned char hob_nsect)
190{
191	const char *ret = trace_seq_buffer_ptr(p);
192
193	switch (cmd) {
194	case ATA_CMD_FPDMA_RECV:
195		switch (hob_nsect & 0x5f) {
196		case ATA_SUBCMD_FPDMA_RECV_RD_LOG_DMA_EXT:
197			trace_seq_printf(p, " READ_LOG_DMA_EXT");
198			break;
199		case ATA_SUBCMD_FPDMA_RECV_ZAC_MGMT_IN:
200			trace_seq_printf(p, " ZAC_MGMT_IN");
201			break;
202		}
203		break;
204	case ATA_CMD_FPDMA_SEND:
205		switch (hob_nsect & 0x5f) {
206		case ATA_SUBCMD_FPDMA_SEND_WR_LOG_DMA_EXT:
207			trace_seq_printf(p, " WRITE_LOG_DMA_EXT");
208			break;
209		case ATA_SUBCMD_FPDMA_SEND_DSM:
210			trace_seq_printf(p, " DATASET_MANAGEMENT");
211			break;
212		}
213		break;
214	case ATA_CMD_NCQ_NON_DATA:
215		switch (feature) {
216		case ATA_SUBCMD_NCQ_NON_DATA_ABORT_QUEUE:
217			trace_seq_printf(p, " ABORT_QUEUE");
218			break;
219		case ATA_SUBCMD_NCQ_NON_DATA_SET_FEATURES:
220			trace_seq_printf(p, " SET_FEATURES");
221			break;
222		case ATA_SUBCMD_NCQ_NON_DATA_ZERO_EXT:
223			trace_seq_printf(p, " ZERO_EXT");
224			break;
225		case ATA_SUBCMD_NCQ_NON_DATA_ZAC_MGMT_OUT:
226			trace_seq_printf(p, " ZAC_MGMT_OUT");
227			break;
228		}
229		break;
230	case ATA_CMD_ZAC_MGMT_IN:
231		switch (feature) {
232		case ATA_SUBCMD_ZAC_MGMT_IN_REPORT_ZONES:
233			trace_seq_printf(p, " REPORT_ZONES");
234			break;
235		}
236		break;
237	case ATA_CMD_ZAC_MGMT_OUT:
238		switch (feature) {
239		case ATA_SUBCMD_ZAC_MGMT_OUT_CLOSE_ZONE:
240			trace_seq_printf(p, " CLOSE_ZONE");
241			break;
242		case ATA_SUBCMD_ZAC_MGMT_OUT_FINISH_ZONE:
243			trace_seq_printf(p, " FINISH_ZONE");
244			break;
245		case ATA_SUBCMD_ZAC_MGMT_OUT_OPEN_ZONE:
246			trace_seq_printf(p, " OPEN_ZONE");
247			break;
248		case ATA_SUBCMD_ZAC_MGMT_OUT_RESET_WRITE_POINTER:
249			trace_seq_printf(p, " RESET_WRITE_POINTER");
250			break;
251		}
252		break;
253	}
254	trace_seq_putc(p, 0);
255
256	return ret;
257}
v4.6
 
  1/*
  2 * libata-trace.c - trace functions for libata
  3 *
  4 * Copyright 2015 Hannes Reinecke
  5 * Copyright 2015 SUSE Linux GmbH
  6 *
  7 *  This program is free software; you can redistribute it and/or modify
  8 *  it under the terms of the GNU General Public License as published by
  9 *  the Free Software Foundation; either version 2, or (at your option)
 10 *  any later version.
 11 *
 12 *  This program is distributed in the hope that it will be useful,
 13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15 *  GNU General Public License for more details.
 16 *
 17 *  You should have received a copy of the GNU General Public License
 18 *  along with this program; see the file COPYING.  If not, write to
 19 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 20 */
 21
 22#include <linux/kernel.h>
 23#include <linux/trace_seq.h>
 24#include <trace/events/libata.h>
 25
 26const char *
 27libata_trace_parse_status(struct trace_seq *p, unsigned char status)
 28{
 29	const char *ret = trace_seq_buffer_ptr(p);
 30
 31	trace_seq_printf(p, "{ ");
 32	if (status & ATA_BUSY)
 33		trace_seq_printf(p, "BUSY ");
 34	if (status & ATA_DRDY)
 35		trace_seq_printf(p, "DRDY ");
 36	if (status & ATA_DF)
 37		trace_seq_printf(p, "DF ");
 38	if (status & ATA_DSC)
 39		trace_seq_printf(p, "DSC ");
 40	if (status & ATA_DRQ)
 41		trace_seq_printf(p, "DRQ ");
 42	if (status & ATA_CORR)
 43		trace_seq_printf(p, "CORR ");
 44	if (status & ATA_SENSE)
 45		trace_seq_printf(p, "SENSE ");
 46	if (status & ATA_ERR)
 47		trace_seq_printf(p, "ERR ");
 48	trace_seq_putc(p, '}');
 49	trace_seq_putc(p, 0);
 50
 51	return ret;
 52}
 53
 54const char *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 55libata_trace_parse_eh_action(struct trace_seq *p, unsigned int eh_action)
 56{
 57	const char *ret = trace_seq_buffer_ptr(p);
 58
 59	trace_seq_printf(p, "%x", eh_action);
 60	if (eh_action) {
 61		trace_seq_printf(p, "{ ");
 62		if (eh_action & ATA_EH_REVALIDATE)
 63			trace_seq_printf(p, "REVALIDATE ");
 64		if (eh_action & (ATA_EH_SOFTRESET | ATA_EH_HARDRESET))
 65			trace_seq_printf(p, "RESET ");
 66		else if (eh_action & ATA_EH_SOFTRESET)
 67			trace_seq_printf(p, "SOFTRESET ");
 68		else if (eh_action & ATA_EH_HARDRESET)
 69			trace_seq_printf(p, "HARDRESET ");
 70		if (eh_action & ATA_EH_ENABLE_LINK)
 71			trace_seq_printf(p, "ENABLE_LINK ");
 72		if (eh_action & ATA_EH_PARK)
 73			trace_seq_printf(p, "PARK ");
 74		trace_seq_putc(p, '}');
 75	}
 76	trace_seq_putc(p, 0);
 77
 78	return ret;
 79}
 80
 81const char *
 82libata_trace_parse_eh_err_mask(struct trace_seq *p, unsigned int eh_err_mask)
 83{
 84	const char *ret = trace_seq_buffer_ptr(p);
 85
 86	trace_seq_printf(p, "%x", eh_err_mask);
 87	if (eh_err_mask) {
 88		trace_seq_printf(p, "{ ");
 89		if (eh_err_mask & AC_ERR_DEV)
 90			trace_seq_printf(p, "DEV ");
 91		if (eh_err_mask & AC_ERR_HSM)
 92			trace_seq_printf(p, "HSM ");
 93		if (eh_err_mask & AC_ERR_TIMEOUT)
 94			trace_seq_printf(p, "TIMEOUT ");
 95		if (eh_err_mask & AC_ERR_MEDIA)
 96			trace_seq_printf(p, "MEDIA ");
 97		if (eh_err_mask & AC_ERR_ATA_BUS)
 98			trace_seq_printf(p, "ATA_BUS ");
 99		if (eh_err_mask & AC_ERR_HOST_BUS)
100			trace_seq_printf(p, "HOST_BUS ");
101		if (eh_err_mask & AC_ERR_SYSTEM)
102			trace_seq_printf(p, "SYSTEM ");
103		if (eh_err_mask & AC_ERR_INVALID)
104			trace_seq_printf(p, "INVALID ");
105		if (eh_err_mask & AC_ERR_OTHER)
106			trace_seq_printf(p, "OTHER ");
107		if (eh_err_mask & AC_ERR_NODEV_HINT)
108			trace_seq_printf(p, "NODEV_HINT ");
109		if (eh_err_mask & AC_ERR_NCQ)
110			trace_seq_printf(p, "NCQ ");
111		trace_seq_putc(p, '}');
112	}
113	trace_seq_putc(p, 0);
114
115	return ret;
116}
117
118const char *
119libata_trace_parse_qc_flags(struct trace_seq *p, unsigned int qc_flags)
120{
121	const char *ret = trace_seq_buffer_ptr(p);
122
123	trace_seq_printf(p, "%x", qc_flags);
124	if (qc_flags) {
125		trace_seq_printf(p, "{ ");
126		if (qc_flags & ATA_QCFLAG_ACTIVE)
127			trace_seq_printf(p, "ACTIVE ");
128		if (qc_flags & ATA_QCFLAG_DMAMAP)
129			trace_seq_printf(p, "DMAMAP ");
130		if (qc_flags & ATA_QCFLAG_IO)
131			trace_seq_printf(p, "IO ");
132		if (qc_flags & ATA_QCFLAG_RESULT_TF)
133			trace_seq_printf(p, "RESULT_TF ");
134		if (qc_flags & ATA_QCFLAG_CLEAR_EXCL)
135			trace_seq_printf(p, "CLEAR_EXCL ");
136		if (qc_flags & ATA_QCFLAG_QUIET)
137			trace_seq_printf(p, "QUIET ");
138		if (qc_flags & ATA_QCFLAG_RETRY)
139			trace_seq_printf(p, "RETRY ");
140		if (qc_flags & ATA_QCFLAG_FAILED)
141			trace_seq_printf(p, "FAILED ");
142		if (qc_flags & ATA_QCFLAG_SENSE_VALID)
143			trace_seq_printf(p, "SENSE_VALID ");
144		if (qc_flags & ATA_QCFLAG_EH_SCHEDULED)
145			trace_seq_printf(p, "EH_SCHEDULED ");
146		trace_seq_putc(p, '}');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147	}
148	trace_seq_putc(p, 0);
149
150	return ret;
151}