These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / unisys / include / guestlinuxdebug.h
1 /* Copyright (C) 2010 - 2013 UNISYS CORPORATION
2  * All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or (at
7  * your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
12  * NON INFRINGEMENT.  See the GNU General Public License for more
13  * details.
14  */
15
16 #ifndef __GUESTLINUXDEBUG_H__
17 #define __GUESTLINUXDEBUG_H__
18
19 /*
20 * This file contains supporting interface for "vmcallinterface.h", particularly
21 * regarding adding additional structure and functionality to linux
22 * ISSUE_IO_VMCALL_POSTCODE_SEVERITY */
23
24 /******* INFO ON ISSUE_POSTCODE_LINUX() BELOW *******/
25 enum driver_pc {                /* POSTCODE driver identifier tuples */
26         /* visorchipset driver files */
27         VISOR_CHIPSET_PC = 0xA0,
28         VISOR_CHIPSET_PC_controlvm_c = 0xA1,
29         VISOR_CHIPSET_PC_controlvm_cm2 = 0xA2,
30         VISOR_CHIPSET_PC_controlvm_direct_c = 0xA3,
31         VISOR_CHIPSET_PC_file_c = 0xA4,
32         VISOR_CHIPSET_PC_parser_c = 0xA5,
33         VISOR_CHIPSET_PC_testing_c = 0xA6,
34         VISOR_CHIPSET_PC_visorchipset_main_c = 0xA7,
35         VISOR_CHIPSET_PC_visorswitchbus_c = 0xA8,
36         /* visorbus driver files */
37         VISOR_BUS_PC = 0xB0,
38         VISOR_BUS_PC_businst_attr_c = 0xB1,
39         VISOR_BUS_PC_channel_attr_c = 0xB2,
40         VISOR_BUS_PC_devmajorminor_attr_c = 0xB3,
41         VISOR_BUS_PC_visorbus_main_c = 0xB4,
42         /* visorclientbus driver files */
43         VISOR_CLIENT_BUS_PC = 0xC0,
44         VISOR_CLIENT_BUS_PC_visorclientbus_main_c = 0xC1,
45         /* virt hba driver files */
46         VIRT_HBA_PC = 0xC2,
47         VIRT_HBA_PC_virthba_c = 0xC3,
48         /* virtpci driver files */
49         VIRT_PCI_PC = 0xC4,
50         VIRT_PCI_PC_virtpci_c = 0xC5,
51         /* virtnic driver files */
52         VIRT_NIC_PC = 0xC6,
53         VIRT_NIC_P_virtnic_c = 0xC7,
54         /* uislib driver files */
55         UISLIB_PC = 0xD0,
56         UISLIB_PC_uislib_c = 0xD1,
57         UISLIB_PC_uisqueue_c = 0xD2,
58         UISLIB_PC_uisthread_c = 0xD3,
59         UISLIB_PC_uisutils_c = 0xD4,
60 };
61
62 enum event_pc {                 /* POSTCODE event identifier tuples */
63         ATTACH_PORT_ENTRY_PC = 0x001,
64         ATTACH_PORT_FAILURE_PC = 0x002,
65         ATTACH_PORT_SUCCESS_PC = 0x003,
66         BUS_FAILURE_PC = 0x004,
67         BUS_CREATE_ENTRY_PC = 0x005,
68         BUS_CREATE_FAILURE_PC = 0x006,
69         BUS_CREATE_EXIT_PC = 0x007,
70         BUS_CONFIGURE_ENTRY_PC = 0x008,
71         BUS_CONFIGURE_FAILURE_PC = 0x009,
72         BUS_CONFIGURE_EXIT_PC = 0x00A,
73         CHIPSET_INIT_ENTRY_PC = 0x00B,
74         CHIPSET_INIT_SUCCESS_PC = 0x00C,
75         CHIPSET_INIT_FAILURE_PC = 0x00D,
76         CHIPSET_INIT_EXIT_PC = 0x00E,
77         CREATE_WORKQUEUE_PC = 0x00F,
78         CREATE_WORKQUEUE_FAILED_PC = 0x0A0,
79         CONTROLVM_INIT_FAILURE_PC = 0x0A1,
80         DEVICE_CREATE_ENTRY_PC = 0x0A2,
81         DEVICE_CREATE_FAILURE_PC = 0x0A3,
82         DEVICE_CREATE_SUCCESS_PC = 0x0A4,
83         DEVICE_CREATE_EXIT_PC = 0x0A5,
84         DEVICE_ADD_PC = 0x0A6,
85         DEVICE_REGISTER_FAILURE_PC = 0x0A7,
86         DEVICE_CHANGESTATE_ENTRY_PC = 0x0A8,
87         DEVICE_CHANGESTATE_FAILURE_PC = 0x0A9,
88         DEVICE_CHANGESTATE_EXIT_PC = 0x0AA,
89         DRIVER_ENTRY_PC = 0x0AB,
90         DRIVER_EXIT_PC = 0x0AC,
91         MALLOC_FAILURE_PC = 0x0AD,
92         QUEUE_DELAYED_WORK_PC = 0x0AE,
93         UISLIB_THREAD_FAILURE_PC = 0x0B7,
94         VBUS_CHANNEL_ENTRY_PC = 0x0B8,
95         VBUS_CHANNEL_FAILURE_PC = 0x0B9,
96         VBUS_CHANNEL_EXIT_PC = 0x0BA,
97         VHBA_CREATE_ENTRY_PC = 0x0BB,
98         VHBA_CREATE_FAILURE_PC = 0x0BC,
99         VHBA_CREATE_EXIT_PC = 0x0BD,
100         VHBA_CREATE_SUCCESS_PC = 0x0BE,
101         VHBA_COMMAND_HANDLER_PC = 0x0BF,
102         VHBA_PROBE_ENTRY_PC = 0x0C0,
103         VHBA_PROBE_FAILURE_PC = 0x0C1,
104         VHBA_PROBE_EXIT_PC = 0x0C2,
105         VNIC_CREATE_ENTRY_PC = 0x0C3,
106         VNIC_CREATE_FAILURE_PC = 0x0C4,
107         VNIC_CREATE_SUCCESS_PC = 0x0C5,
108         VNIC_PROBE_ENTRY_PC = 0x0C6,
109         VNIC_PROBE_FAILURE_PC = 0x0C7,
110         VNIC_PROBE_EXIT_PC = 0x0C8,
111         VPCI_CREATE_ENTRY_PC = 0x0C9,
112         VPCI_CREATE_FAILURE_PC = 0x0CA,
113         VPCI_CREATE_EXIT_PC = 0x0CB,
114         VPCI_PROBE_ENTRY_PC = 0x0CC,
115         VPCI_PROBE_FAILURE_PC = 0x0CD,
116         VPCI_PROBE_EXIT_PC = 0x0CE,
117         CRASH_DEV_ENTRY_PC = 0x0CF,
118         CRASH_DEV_EXIT_PC = 0x0D0,
119         CRASH_DEV_HADDR_NULL = 0x0D1,
120         CRASH_DEV_CONTROLVM_NULL = 0x0D2,
121         CRASH_DEV_RD_BUS_FAIULRE_PC = 0x0D3,
122         CRASH_DEV_RD_DEV_FAIULRE_PC = 0x0D4,
123         CRASH_DEV_BUS_NULL_FAILURE_PC = 0x0D5,
124         CRASH_DEV_DEV_NULL_FAILURE_PC = 0x0D6,
125         CRASH_DEV_CTRL_RD_FAILURE_PC = 0x0D7,
126         CRASH_DEV_COUNT_FAILURE_PC = 0x0D8,
127         SAVE_MSG_BUS_FAILURE_PC = 0x0D9,
128         SAVE_MSG_DEV_FAILURE_PC = 0x0DA,
129         CALLHOME_INIT_FAILURE_PC = 0x0DB
130 };
131
132 #ifdef __GNUC__
133
134 #define POSTCODE_SEVERITY_ERR DIAG_SEVERITY_ERR
135 #define POSTCODE_SEVERITY_WARNING DIAG_SEVERITY_WARNING
136 #define POSTCODE_SEVERITY_INFO DIAG_SEVERITY_PRINT      /* TODO-> Info currently
137                                                          * doesn't show, so we
138                                                          * set info=warning */
139 /* example call of POSTCODE_LINUX_2(VISOR_CHIPSET_PC, POSTCODE_SEVERITY_ERR);
140  * Please also note that the resulting postcode is in hex, so if you are
141  * searching for the __LINE__ number, convert it first to decimal.  The line
142  * number combined with driver and type of call, will allow you to track down
143  * exactly what line an error occurred on, or where the last driver
144  * entered/exited from.
145  */
146
147 /* BASE FUNCTIONS */
148 #define POSTCODE_LINUX_A(DRIVER_PC, EVENT_PC, pc32bit, severity)        \
149 do {                                                                    \
150         unsigned long long post_code_temp;                              \
151         post_code_temp = (((u64)DRIVER_PC) << 56) | (((u64)EVENT_PC) << 44) | \
152                 ((((u64)__LINE__) & 0xFFF) << 32) |                     \
153                 (((u64)pc32bit) & 0xFFFFFFFF);                          \
154         ISSUE_IO_VMCALL_POSTCODE_SEVERITY(post_code_temp, severity);    \
155 } while (0)
156
157 #define POSTCODE_LINUX_B(DRIVER_PC, EVENT_PC, pc16bit1, pc16bit2, severity) \
158 do {                                                                    \
159         unsigned long long post_code_temp;                              \
160         post_code_temp = (((u64)DRIVER_PC) << 56) | (((u64)EVENT_PC) << 44) | \
161                 ((((u64)__LINE__) & 0xFFF) << 32) |                     \
162                 ((((u64)pc16bit1) & 0xFFFF) << 16) |                    \
163                 (((u64)pc16bit2) & 0xFFFF);                             \
164         ISSUE_IO_VMCALL_POSTCODE_SEVERITY(post_code_temp, severity);    \
165 } while (0)
166
167 /* MOST COMMON */
168 #define POSTCODE_LINUX_2(EVENT_PC, severity)                            \
169         POSTCODE_LINUX_A(CURRENT_FILE_PC, EVENT_PC, 0x0000, severity)
170
171 #define POSTCODE_LINUX_3(EVENT_PC, pc32bit, severity)                   \
172         POSTCODE_LINUX_A(CURRENT_FILE_PC, EVENT_PC, pc32bit, severity)
173
174 #define POSTCODE_LINUX_4(EVENT_PC, pc16bit1, pc16bit2, severity)        \
175         POSTCODE_LINUX_B(CURRENT_FILE_PC, EVENT_PC, pc16bit1,           \
176                          pc16bit2, severity)
177
178 #endif
179 #endif