1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#include "hpi_internal.h"
24#include "hpidebug.h"
25
26
27int hpi_debug_level = HPI_DEBUG_LEVEL_DEFAULT;
28
29void hpi_debug_init(void)
30{
31 printk(KERN_INFO "debug start\n");
32}
33
34int hpi_debug_level_set(int level)
35{
36 int old_level;
37
38 old_level = hpi_debug_level;
39 hpi_debug_level = level;
40 return old_level;
41}
42
43int hpi_debug_level_get(void)
44{
45 return hpi_debug_level;
46}
47
48void hpi_debug_message(struct hpi_message *phm, char *sz_fileline)
49{
50 if (phm) {
51 printk(KERN_DEBUG "HPI_MSG%d,%d,%d,%d,%d\n", phm->version,
52 phm->adapter_index, phm->obj_index, phm->function,
53 phm->u.c.attribute);
54 }
55
56}
57
58void hpi_debug_data(u16 *pdata, u32 len)
59{
60 u32 i;
61 int j;
62 int k;
63 int lines;
64 int cols = 8;
65
66 lines = (len + cols - 1) / cols;
67 if (lines > 8)
68 lines = 8;
69
70 for (i = 0, j = 0; j < lines; j++) {
71 printk(KERN_DEBUG "%p:", (pdata + i));
72
73 for (k = 0; k < cols && i < len; i++, k++)
74 printk(KERN_CONT "%s%04x", k == 0 ? "" : " ", pdata[i]);
75
76 printk(KERN_CONT "\n");
77 }
78}
79