Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

debug.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1997 Microsoft Corporation 00004 00005 Module Name: 00006 00007 debug.c 00008 00009 Abstract: 00010 00011 This module contains support routines for the Pnp resource arbiters. 00012 00013 Author: 00014 00015 Andrew Thornton (andrewth) 19-June-1998 00016 00017 00018 Environment: 00019 00020 Kernel mode 00021 00022 Revision History: 00023 00024 --*/ 00025 00026 #include "arbp.h" 00027 00028 00029 // 00030 // Debugging support 00031 // 00032 00033 #if ARB_DBG 00034 00035 // 00036 // Debug print level: 00037 // -1 = no messages 00038 // 0 = vital messages only 00039 // 1 = call trace 00040 // 2 = verbose messages 00041 // 00042 00043 LONG ArbDebugLevel = -1; 00044 00045 // 00046 // ArbStopOnError works just like a debug level variable except 00047 // instead of controlling whether a message is printed, it controls 00048 // whether we breakpoint on an error or not. Likewise ArbReplayOnError 00049 // controls if we replay fail arbitrations so we can debug them. 00050 // 00051 00052 ULONG ArbStopOnError; 00053 ULONG ArbReplayOnError; 00054 00055 PCHAR ArbpActionStrings[] = { 00056 "ArbiterActionTestAllocation", 00057 "ArbiterActionRetestAllocation", 00058 "ArbiterActionCommitAllocation", 00059 "ArbiterActionRollbackAllocation", 00060 "ArbiterActionQueryAllocatedResources", 00061 "ArbiterActionWriteReservedResources", 00062 "ArbiterActionQueryConflict", 00063 "ArbiterActionQueryArbitrate", 00064 "ArbiterActionAddReserved", 00065 "ArbiterActionBootAllocation" 00066 }; 00067 00068 VOID 00069 ArbDumpArbiterRange( 00070 LONG Level, 00071 PRTL_RANGE_LIST List, 00072 PUCHAR RangeText 00073 ) 00074 00075 /*++ 00076 00077 Routine Description: 00078 00079 This dumps the contents of a range list to the debugger. 00080 00081 Parameters: 00082 00083 Level - The debug level at or above which the data should be displayed. 00084 List - The range list to be displayed. 00085 RangeText - Informative text to go with the display. 00086 00087 Return Value: 00088 00089 None 00090 00091 --*/ 00092 00093 { 00094 PRTL_RANGE current; 00095 RTL_RANGE_LIST_ITERATOR iterator; 00096 BOOLEAN headerDisplayed = FALSE; 00097 00098 PAGED_CODE(); 00099 00100 FOR_ALL_RANGES(List, &iterator, current) { 00101 00102 if (headerDisplayed == FALSE) { 00103 headerDisplayed = TRUE; 00104 ARB_PRINT(Level, (" %s:\n", RangeText)); 00105 } 00106 00107 ARB_PRINT(Level, 00108 (" %I64x-%I64x %s%s O=0x%08x U=0x%08x\n", 00109 current->Start, 00110 current->End, 00111 current->Flags & RTL_RANGE_SHARED ? "S" : " ", 00112 current->Flags & RTL_RANGE_CONFLICT ? "C" : " ", 00113 current->Owner, 00114 current->UserData 00115 )); 00116 } 00117 if (headerDisplayed == FALSE) { 00118 ARB_PRINT(Level, (" %s: <None>\n", RangeText)); 00119 } 00120 } 00121 00122 VOID 00123 ArbDumpArbiterInstance( 00124 LONG Level, 00125 PARBITER_INSTANCE Arbiter 00126 ) 00127 00128 /*++ 00129 00130 Routine Description: 00131 00132 This dumps the state of the arbiter to the debugger. 00133 00134 Parameters: 00135 00136 Level - The debug level at or above which the data should be displayed. 00137 00138 Arbiter - The arbiter instance to display 00139 00140 Return Value: 00141 00142 None 00143 00144 --*/ 00145 00146 { 00147 00148 PAGED_CODE(); 00149 00150 ARB_PRINT(Level, 00151 ("---%S Arbiter State---\n", 00152 Arbiter->Name 00153 )); 00154 00155 ArbDumpArbiterRange( 00156 Level, 00157 Arbiter->Allocation, 00158 "Allocation" 00159 ); 00160 00161 ArbDumpArbiterRange( 00162 Level, 00163 Arbiter->PossibleAllocation, 00164 "PossibleAllocation" 00165 ); 00166 } 00167 00168 VOID 00169 ArbDumpArbitrationList( 00170 LONG Level, 00171 PLIST_ENTRY ArbitrationList 00172 ) 00173 00174 /*++ 00175 00176 Routine Description: 00177 00178 Display the contents of an arbitration list. That is, the 00179 set of resources (possibilities) we are trying to get. 00180 00181 Parameters: 00182 00183 Level - The debug level at or above which the data 00184 should be displayed. 00185 ArbitrationList - The arbitration list to be displayed. 00186 00187 Return Value: 00188 00189 None 00190 00191 --*/ 00192 00193 { 00194 PARBITER_LIST_ENTRY current; 00195 PIO_RESOURCE_DESCRIPTOR alternative; 00196 PDEVICE_OBJECT previousOwner = NULL; 00197 UCHAR andOr = ' '; 00198 00199 PAGED_CODE(); 00200 00201 ARB_PRINT(Level, ("Arbitration List\n")); 00202 00203 FOR_ALL_IN_LIST(ARBITER_LIST_ENTRY, ArbitrationList, current) { 00204 00205 if (previousOwner != current->PhysicalDeviceObject) { 00206 00207 previousOwner = current->PhysicalDeviceObject; 00208 00209 ARB_PRINT( 00210 Level, 00211 (" Owning object 0x%08x\n", 00212 current->PhysicalDeviceObject 00213 )); 00214 ARB_PRINT( 00215 Level, 00216 (" Length Alignment Minimum Address - Maximum Address\n" 00217 )); 00218 00219 } 00220 00221 FOR_ALL_IN_ARRAY(current->Alternatives, 00222 current->AlternativeCount, 00223 alternative) { 00224 00225 ARB_PRINT( 00226 Level, 00227 ("%c %8x %8x %08x%08x - %08x%08x %s\n", 00228 andOr, 00229 alternative->u.Generic.Length, 00230 alternative->u.Generic.Alignment, 00231 alternative->u.Generic.MinimumAddress.HighPart, 00232 alternative->u.Generic.MinimumAddress.LowPart, 00233 alternative->u.Generic.MaximumAddress.HighPart, 00234 alternative->u.Generic.MaximumAddress.LowPart, 00235 alternative->Type == CmResourceTypeMemory ? 00236 "Memory" 00237 : "Port" 00238 )); 00239 andOr = '|'; 00240 } 00241 andOr = '&'; 00242 } 00243 } 00244 00245 #endif // ARB_DBG

Generated on Sat May 15 19:39:39 2004 for test by doxygen 1.3.7