3  * linux/drivers/s390/net/ctcdbug.h
 
   5  * CTC / ESCON network driver - s390 dbf exploit.
 
   7  * Copyright 2000,2003 IBM Corporation
 
   9  *    Author(s): Original Code written by
 
  10  *                        Peter Tiedemann (ptiedem@de.ibm.com)
 
  12  * This program is free software; you can redistribute it and/or modify
 
  13  * it under the terms of the GNU General Public License as published by
 
  14  * the Free Software Foundation; either version 2, or (at your option)
 
  17  * This program is distributed in the hope that it will be useful,
 
  18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
  19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
  20  * GNU General Public License for more details.
 
  22  * You should have received a copy of the GNU General Public License
 
  23  * along with this program; if not, write to the Free Software
 
  24  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
  29 #include <asm/debug.h>
 
  32  * Debug Facility stuff
 
  34 #define CTC_DBF_SETUP_NAME "ctc_setup"
 
  35 #define CTC_DBF_SETUP_LEN 16
 
  36 #define CTC_DBF_SETUP_PAGES 8
 
  37 #define CTC_DBF_SETUP_NR_AREAS 1
 
  38 #define CTC_DBF_SETUP_LEVEL 3
 
  40 #define CTC_DBF_DATA_NAME "ctc_data"
 
  41 #define CTC_DBF_DATA_LEN 128
 
  42 #define CTC_DBF_DATA_PAGES 8
 
  43 #define CTC_DBF_DATA_NR_AREAS 1
 
  44 #define CTC_DBF_DATA_LEVEL 3
 
  46 #define CTC_DBF_TRACE_NAME "ctc_trace"
 
  47 #define CTC_DBF_TRACE_LEN 16
 
  48 #define CTC_DBF_TRACE_PAGES 4
 
  49 #define CTC_DBF_TRACE_NR_AREAS 2
 
  50 #define CTC_DBF_TRACE_LEVEL 3
 
  52 #define DBF_TEXT(name,level,text) \
 
  54                 debug_text_event(ctc_dbf_##name,level,text); \
 
  57 #define DBF_HEX(name,level,addr,len) \
 
  59                 debug_event(ctc_dbf_##name,level,(void*)(addr),len); \
 
  62 DECLARE_PER_CPU(char[256], ctc_dbf_txt_buf);
 
  63 extern debug_info_t *ctc_dbf_setup;
 
  64 extern debug_info_t *ctc_dbf_data;
 
  65 extern debug_info_t *ctc_dbf_trace;
 
  68 #define DBF_TEXT_(name,level,text...)                           \
 
  70                 char* ctc_dbf_txt_buf = get_cpu_var(ctc_dbf_txt_buf);   \
 
  71                 sprintf(ctc_dbf_txt_buf, text);                         \
 
  72                 debug_text_event(ctc_dbf_##name,level,ctc_dbf_txt_buf); \
 
  73                 put_cpu_var(ctc_dbf_txt_buf);                           \
 
  76 #define DBF_SPRINTF(name,level,text...) \
 
  78                 debug_sprintf_event(ctc_dbf_trace, level, ##text ); \
 
  79                 debug_sprintf_event(ctc_dbf_trace, level, text ); \
 
  83 int ctc_register_dbf_views(void);
 
  85 void ctc_unregister_dbf_views(void);
 
  88  * some more debug stuff
 
  91 #define HEXDUMP16(importance,header,ptr) \
 
  92 PRINT_##importance(header "%02x %02x %02x %02x  %02x %02x %02x %02x  " \
 
  93                    "%02x %02x %02x %02x  %02x %02x %02x %02x\n", \
 
  94                    *(((char*)ptr)),*(((char*)ptr)+1),*(((char*)ptr)+2), \
 
  95                    *(((char*)ptr)+3),*(((char*)ptr)+4),*(((char*)ptr)+5), \
 
  96                    *(((char*)ptr)+6),*(((char*)ptr)+7),*(((char*)ptr)+8), \
 
  97                    *(((char*)ptr)+9),*(((char*)ptr)+10),*(((char*)ptr)+11), \
 
  98                    *(((char*)ptr)+12),*(((char*)ptr)+13), \
 
  99                    *(((char*)ptr)+14),*(((char*)ptr)+15)); \
 
 100 PRINT_##importance(header "%02x %02x %02x %02x  %02x %02x %02x %02x  " \
 
 101                    "%02x %02x %02x %02x  %02x %02x %02x %02x\n", \
 
 102                    *(((char*)ptr)+16),*(((char*)ptr)+17), \
 
 103                    *(((char*)ptr)+18),*(((char*)ptr)+19), \
 
 104                    *(((char*)ptr)+20),*(((char*)ptr)+21), \
 
 105                    *(((char*)ptr)+22),*(((char*)ptr)+23), \
 
 106                    *(((char*)ptr)+24),*(((char*)ptr)+25), \
 
 107                    *(((char*)ptr)+26),*(((char*)ptr)+27), \
 
 108                    *(((char*)ptr)+28),*(((char*)ptr)+29), \
 
 109                    *(((char*)ptr)+30),*(((char*)ptr)+31));
 
 112 hex_dump(unsigned char *buf, size_t len)
 
 116         for (i = 0; i < len; i++) {
 
 119                 printk("%02x ", *(buf + i));