/*
* zfcp device driver
*
* Debug traces for zfcp.
*
* Copyright IBM Corporation 2002, 2008
*/
#include <linux/ctype.h>
#include <asm/debug.h>
#include "zfcp_ext.h"
static u32 dbfsize = 4;
module_param(dbfsize, uint, 0400);
MODULE_PARM_DESC(dbfsize,
"number of pages for each debug feature area (default 4)");
static void zfcp_dbf_hexdump(debug_info_t *dbf, void *to, int to_len,
int level, char *from, int from_len)
{
int offset;
struct zfcp_dbf_dump *dump = to;
int room = to_len - sizeof(*dump);
for (offset = 0; offset < from_len; offset += dump->size) {
memset(to, 0, to_len);
strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE);
dump->total_size = from_len;
dump->offset = offset;
dump->size = min(from_len - offset, room);
memcpy(dump->data, from + offset, dump->size);
debug_event(dbf, level, dump, dump->size + sizeof(*dump));
}
}
/* FIXME: this duplicate this code in s390 debug feature */
static void zfcp_dbf_timestamp(unsigned long long stck, struct timespec *time)
{
unsigned long long sec;
stck -= 0x8126d60e46000000LL - (0x3c26700LL * 1000000 * 4096);
sec = stck >> 12;
do_div(sec, 1000000);
time->tv_sec = sec;
stck -= (sec * 1000000) << 12;
time->tv_nsec = ((stck * 1000) >> 12);
}
static void zfcp_dbf_tag(char **p, const char *label, const char *tag)
{
int i;
*p += sprintf(*p, "%-24s", label);
for (i = 0; i < ZFCP_DBF_TAG_SIZE; i++