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 #include "vmcallinterface.h" 26 enum driver_pc { /* POSTCODE driver identifier tuples */ 27 /* visorchipset driver files */ 28 VISOR_CHIPSET_PC = 0xA0, 29 VISOR_CHIPSET_PC_controlvm_c = 0xA1, 30 VISOR_CHIPSET_PC_controlvm_cm2 = 0xA2, 31 VISOR_CHIPSET_PC_controlvm_direct_c = 0xA3, 32 VISOR_CHIPSET_PC_file_c = 0xA4, 33 VISOR_CHIPSET_PC_parser_c = 0xA5, 34 VISOR_CHIPSET_PC_testing_c = 0xA6, 35 VISOR_CHIPSET_PC_visorchipset_main_c = 0xA7, 36 VISOR_CHIPSET_PC_visorswitchbus_c = 0xA8, 37 /* visorbus driver files */ 38 VISOR_BUS_PC = 0xB0, 39 VISOR_BUS_PC_businst_attr_c = 0xB1, 40 VISOR_BUS_PC_channel_attr_c = 0xB2, 41 VISOR_BUS_PC_devmajorminor_attr_c = 0xB3, 42 VISOR_BUS_PC_visorbus_main_c = 0xB4, 43 /* visorclientbus driver files */ 44 VISOR_CLIENT_BUS_PC = 0xC0, 45 VISOR_CLIENT_BUS_PC_visorclientbus_main_c = 0xC1, 46 /* virt hba driver files */ 47 VIRT_HBA_PC = 0xC2, 48 VIRT_HBA_PC_virthba_c = 0xC3, 49 /* virtpci driver files */ 50 VIRT_PCI_PC = 0xC4, 51 VIRT_PCI_PC_virtpci_c = 0xC5, 52 /* virtnic driver files */ 53 VIRT_NIC_PC = 0xC6, 54 VIRT_NIC_P_virtnic_c = 0xC7, 55 /* uislib driver files */ 56 UISLIB_PC = 0xD0, 57 UISLIB_PC_uislib_c = 0xD1, 58 UISLIB_PC_uisqueue_c = 0xD2, 59 UISLIB_PC_uisthread_c = 0xD3, 60 UISLIB_PC_uisutils_c = 0xD4, 61 }; 62 63 enum event_pc { /* POSTCODE event identifier tuples */ 64 ATTACH_PORT_ENTRY_PC = 0x001, 65 ATTACH_PORT_FAILURE_PC = 0x002, 66 ATTACH_PORT_SUCCESS_PC = 0x003, 67 BUS_FAILURE_PC = 0x004, 68 BUS_CREATE_ENTRY_PC = 0x005, 69 BUS_CREATE_FAILURE_PC = 0x006, 70 BUS_CREATE_EXIT_PC = 0x007, 71 BUS_CONFIGURE_ENTRY_PC = 0x008, 72 BUS_CONFIGURE_FAILURE_PC = 0x009, 73 BUS_CONFIGURE_EXIT_PC = 0x00A, 74 CHIPSET_INIT_ENTRY_PC = 0x00B, 75 CHIPSET_INIT_SUCCESS_PC = 0x00C, 76 CHIPSET_INIT_FAILURE_PC = 0x00D, 77 CHIPSET_INIT_EXIT_PC = 0x00E, 78 CREATE_WORKQUEUE_PC = 0x00F, 79 CREATE_WORKQUEUE_FAILED_PC = 0x0A0, 80 CONTROLVM_INIT_FAILURE_PC = 0x0A1, 81 DEVICE_CREATE_ENTRY_PC = 0x0A2, 82 DEVICE_CREATE_FAILURE_PC = 0x0A3, 83 DEVICE_CREATE_SUCCESS_PC = 0x0A4, 84 DEVICE_CREATE_EXIT_PC = 0x0A5, 85 DEVICE_ADD_PC = 0x0A6, 86 DEVICE_REGISTER_FAILURE_PC = 0x0A7, 87 DEVICE_CHANGESTATE_ENTRY_PC = 0x0A8, 88 DEVICE_CHANGESTATE_FAILURE_PC = 0x0A9, 89 DEVICE_CHANGESTATE_EXIT_PC = 0x0AA, 90 DRIVER_ENTRY_PC = 0x0AB, 91 DRIVER_EXIT_PC = 0x0AC, 92 MALLOC_FAILURE_PC = 0x0AD, 93 QUEUE_DELAYED_WORK_PC = 0x0AE, 94 UISLIB_THREAD_FAILURE_PC = 0x0B7, 95 VBUS_CHANNEL_ENTRY_PC = 0x0B8, 96 VBUS_CHANNEL_FAILURE_PC = 0x0B9, 97 VBUS_CHANNEL_EXIT_PC = 0x0BA, 98 VHBA_CREATE_ENTRY_PC = 0x0BB, 99 VHBA_CREATE_FAILURE_PC = 0x0BC, 100 VHBA_CREATE_EXIT_PC = 0x0BD, 101 VHBA_CREATE_SUCCESS_PC = 0x0BE, 102 VHBA_COMMAND_HANDLER_PC = 0x0BF, 103 VHBA_PROBE_ENTRY_PC = 0x0C0, 104 VHBA_PROBE_FAILURE_PC = 0x0C1, 105 VHBA_PROBE_EXIT_PC = 0x0C2, 106 VNIC_CREATE_ENTRY_PC = 0x0C3, 107 VNIC_CREATE_FAILURE_PC = 0x0C4, 108 VNIC_CREATE_SUCCESS_PC = 0x0C5, 109 VNIC_PROBE_ENTRY_PC = 0x0C6, 110 VNIC_PROBE_FAILURE_PC = 0x0C7, 111 VNIC_PROBE_EXIT_PC = 0x0C8, 112 VPCI_CREATE_ENTRY_PC = 0x0C9, 113 VPCI_CREATE_FAILURE_PC = 0x0CA, 114 VPCI_CREATE_EXIT_PC = 0x0CB, 115 VPCI_PROBE_ENTRY_PC = 0x0CC, 116 VPCI_PROBE_FAILURE_PC = 0x0CD, 117 VPCI_PROBE_EXIT_PC = 0x0CE, 118 CRASH_DEV_ENTRY_PC = 0x0CF, 119 CRASH_DEV_EXIT_PC = 0x0D0, 120 CRASH_DEV_HADDR_NULL = 0x0D1, 121 CRASH_DEV_CONTROLVM_NULL = 0x0D2, 122 CRASH_DEV_RD_BUS_FAIULRE_PC = 0x0D3, 123 CRASH_DEV_RD_DEV_FAIULRE_PC = 0x0D4, 124 CRASH_DEV_BUS_NULL_FAILURE_PC = 0x0D5, 125 CRASH_DEV_DEV_NULL_FAILURE_PC = 0x0D6, 126 CRASH_DEV_CTRL_RD_FAILURE_PC = 0x0D7, 127 CRASH_DEV_COUNT_FAILURE_PC = 0x0D8, 128 SAVE_MSG_BUS_FAILURE_PC = 0x0D9, 129 SAVE_MSG_DEV_FAILURE_PC = 0x0DA, 130 CALLHOME_INIT_FAILURE_PC = 0x0DB 131 }; 132 133 #ifdef __GNUC__ 134 135 #define POSTCODE_SEVERITY_ERR DIAG_SEVERITY_ERR 136 #define POSTCODE_SEVERITY_WARNING DIAG_SEVERITY_WARNING 137 #define POSTCODE_SEVERITY_INFO DIAG_SEVERITY_PRINT /* TODO-> Info currently 138 * doesnt show, so we 139 * set info=warning */ 140 /* example call of POSTCODE_LINUX_2(VISOR_CHIPSET_PC, POSTCODE_SEVERITY_ERR); 141 * Please also note that the resulting postcode is in hex, so if you are 142 * searching for the __LINE__ number, convert it first to decimal. The line 143 * number combined with driver and type of call, will allow you to track down 144 * exactly what line an error occurred on, or where the last driver 145 * entered/exited from. 146 */ 147 148 /* BASE FUNCTIONS */ 149 #define POSTCODE_LINUX_A(DRIVER_PC, EVENT_PC, pc32bit, severity) \ 150 do { \ 151 unsigned long long post_code_temp; \ 152 post_code_temp = (((u64)DRIVER_PC) << 56) | (((u64)EVENT_PC) << 44) | \ 153 ((((u64)__LINE__) & 0xFFF) << 32) | \ 154 (((u64)pc32bit) & 0xFFFFFFFF); \ 155 ISSUE_IO_VMCALL_POSTCODE_SEVERITY(post_code_temp, severity); \ 156 } while (0) 157 158 #define POSTCODE_LINUX_B(DRIVER_PC, EVENT_PC, pc16bit1, pc16bit2, severity) \ 159 do { \ 160 unsigned long long post_code_temp; \ 161 post_code_temp = (((u64)DRIVER_PC) << 56) | (((u64)EVENT_PC) << 44) | \ 162 ((((u64)__LINE__) & 0xFFF) << 32) | \ 163 ((((u64)pc16bit1) & 0xFFFF) << 16) | \ 164 (((u64)pc16bit2) & 0xFFFF); \ 165 ISSUE_IO_VMCALL_POSTCODE_SEVERITY(post_code_temp, severity); \ 166 } while (0) 167 168 /* MOST COMMON */ 169 #define POSTCODE_LINUX_2(EVENT_PC, severity) \ 170 POSTCODE_LINUX_A(CURRENT_FILE_PC, EVENT_PC, 0x0000, severity) 171 172 #define POSTCODE_LINUX_3(EVENT_PC, pc32bit, severity) \ 173 POSTCODE_LINUX_A(CURRENT_FILE_PC, EVENT_PC, pc32bit, severity) 174 175 #define POSTCODE_LINUX_4(EVENT_PC, pc16bit1, pc16bit2, severity) \ 176 POSTCODE_LINUX_B(CURRENT_FILE_PC, EVENT_PC, pc16bit1, \ 177 pc16bit2, severity) 178 179 #endif 180 #endif 181