]> git.proxmox.com Git - mirror_edk2.git/blame - SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c
SourceLevelDebugPkg: Change OPTIONAL keyword usage style
[mirror_edk2.git] / SourceLevelDebugPkg / Library / DebugAgent / DxeDebugAgent / DxeDebugAgentLib.c
CommitLineData
18b144ea 1/** @file\r
a302263e 2 Debug Agent library implementation for Dxe Core and Dxr modules.\r
18b144ea 3\r
77695f4d 4 Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
85f7e110 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
18b144ea 6\r
7**/\r
8\r
9#include "DxeDebugAgentLib.h"\r
10\r
11DEBUG_AGENT_MAILBOX mMailbox;\r
b422b62c 12DEBUG_AGENT_MAILBOX *mMailboxPointer = NULL;\r
18b144ea 13IA32_IDT_GATE_DESCRIPTOR mIdtEntryTable[33];\r
b422b62c 14BOOLEAN mDxeCoreFlag = FALSE;\r
15BOOLEAN mMultiProcessorDebugSupport = FALSE;\r
16VOID *mSavedIdtTable = NULL;\r
17UINTN mSaveIdtTableSize = 0;\r
18BOOLEAN mDebugAgentInitialized = FALSE;\r
19BOOLEAN mSkipBreakpoint = FALSE;\r
18b144ea 20\r
21/**\r
b422b62c 22 Check if debug agent support multi-processor.\r
18b144ea 23\r
b422b62c 24 @retval TRUE Multi-processor is supported.\r
25 @retval FALSE Multi-processor is not supported.\r
26\r
27**/\r
28BOOLEAN\r
29MultiProcessorDebugSupport (\r
30 VOID\r
31 )\r
32{\r
33 return mMultiProcessorDebugSupport;\r
34}\r
18b144ea 35\r
b422b62c 36/**\r
37 Internal constructor worker function.\r
38\r
39 It will register one callback function on EFI PCD Protocol.\r
40 It will allocate the NVS memory to store Mailbox and install configuration table\r
41 in system table to store its pointer.\r
18b144ea 42\r
43**/\r
b422b62c 44VOID\r
45InternalConstructorWorker (\r
46 VOID\r
18b144ea 47 )\r
48{\r
49 EFI_STATUS Status;\r
50 EFI_PHYSICAL_ADDRESS Address;\r
b422b62c 51 BOOLEAN DebugTimerInterruptState;\r
0a488765 52 DEBUG_AGENT_MAILBOX *Mailbox;\r
53 DEBUG_AGENT_MAILBOX *NewMailbox;\r
8cc26df4
JF
54 EFI_HOB_GUID_TYPE *GuidHob;\r
55 EFI_VECTOR_HANDOFF_INFO *VectorHandoffInfo;\r
56\r
57 //\r
58 // Check persisted vector handoff info\r
59 //\r
60 Status = EFI_SUCCESS;\r
61 GuidHob = GetFirstGuidHob (&gEfiVectorHandoffInfoPpiGuid);\r
62 if (GuidHob != NULL && !mDxeCoreFlag) {\r
63 //\r
64 // Check if configuration table is installed or not if GUIDed HOB existed,\r
65 // only when Debug Agent is not linked by DXE Core\r
66 //\r
67 Status = EfiGetSystemConfigurationTable (&gEfiVectorHandoffTableGuid, (VOID **) &VectorHandoffInfo);\r
68 }\r
69 if (GuidHob == NULL || Status != EFI_SUCCESS) {\r
70 //\r
71 // Install configuration table for persisted vector handoff info if GUIDed HOB cannot be found or\r
72 // configuration table does not exist\r
73 //\r
74 Status = gBS->InstallConfigurationTable (&gEfiVectorHandoffTableGuid, (VOID *) &mVectorHandoffInfoDebugAgent[0]);\r
75 if (EFI_ERROR (Status)) {\r
586fda48 76 DEBUG ((DEBUG_ERROR, "DebugAgent: Cannot install configuration table for persisted vector handoff info!\n"));\r
8cc26df4
JF
77 CpuDeadLoop ();\r
78 }\r
79 }\r
93c0bdec 80\r
81 //\r
b422b62c 82 // Install EFI Serial IO protocol on debug port\r
93c0bdec 83 //\r
b422b62c 84 InstallSerialIo ();\r
93c0bdec 85\r
18b144ea 86 Address = 0;\r
87 Status = gBS->AllocatePages (\r
88 AllocateAnyPages,\r
89 EfiACPIMemoryNVS,\r
0a488765 90 EFI_SIZE_TO_PAGES (sizeof(DEBUG_AGENT_MAILBOX) + PcdGet16(PcdDebugPortHandleBufferSize)),\r
18b144ea 91 &Address\r
92 );\r
8cc26df4 93 if (EFI_ERROR (Status)) {\r
586fda48 94 DEBUG ((DEBUG_ERROR, "DebugAgent: Cannot install configuration table for mailbox!\n"));\r
8cc26df4
JF
95 CpuDeadLoop ();\r
96 }\r
18b144ea 97\r
b422b62c 98 DebugTimerInterruptState = SaveAndSetDebugTimerInterrupt (FALSE);\r
18b144ea 99\r
0a488765 100 NewMailbox = (DEBUG_AGENT_MAILBOX *) (UINTN) Address;\r
101 //\r
102 // Copy Mailbox and Debug Port Handle buffer to new location in ACPI NVS memory, because original Mailbox\r
103 // and Debug Port Handle buffer may be free at runtime, SMM debug agent needs to access them\r
104 //\r
105 Mailbox = GetMailboxPointer ();\r
106 CopyMem (NewMailbox, Mailbox, sizeof (DEBUG_AGENT_MAILBOX));\r
107 CopyMem (NewMailbox + 1, (VOID *)(UINTN)Mailbox->DebugPortHandle, PcdGet16(PcdDebugPortHandleBufferSize));\r
108 //\r
109 // Update Debug Port Handle in new Mailbox\r
110 //\r
111 UpdateMailboxContent (NewMailbox, DEBUG_MAILBOX_DEBUG_PORT_HANDLE_INDEX, (UINT64)(UINTN)(NewMailbox + 1));\r
112 mMailboxPointer = NewMailbox;\r
113\r
114 DebugTimerInterruptState = SaveAndSetDebugTimerInterrupt (DebugTimerInterruptState);\r
18b144ea 115\r
93c0bdec 116 Status = gBS->InstallConfigurationTable (&gEfiDebugAgentGuid, (VOID *) mMailboxPointer);\r
8cc26df4 117 if (EFI_ERROR (Status)) {\r
586fda48 118 DEBUG ((DEBUG_ERROR, "DebugAgent: Failed to install configuration for mailbox!\n"));\r
8cc26df4
JF
119 CpuDeadLoop ();\r
120 }\r
b422b62c 121}\r
122\r
123/**\r
124 Debug Agent constructor function.\r
125\r
126 @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
127 @param[in] SystemTable A pointer to the EFI System Table.\r
128\r
129 @retval RETURN_SUCCESS When this function completed.\r
130\r
131**/\r
132RETURN_STATUS\r
133EFIAPI\r
134DxeDebugAgentLibConstructor (\r
135 IN EFI_HANDLE ImageHandle,\r
136 IN EFI_SYSTEM_TABLE *SystemTable\r
137 )\r
138{\r
139 if (mDxeCoreFlag) {\r
140 //\r
141 // Invoke internal constructor function only when DXE core links this library instance\r
142 //\r
143 InternalConstructorWorker ();\r
144 }\r
145\r
146 return RETURN_SUCCESS;\r
147}\r
148\r
149/**\r
150 Get the pointer to Mailbox from the configuration table.\r
151\r
152 @return Pointer to Mailbox.\r
153\r
154**/\r
155DEBUG_AGENT_MAILBOX *\r
156GetMailboxFromConfigurationTable (\r
157 VOID\r
158 )\r
159{\r
160 EFI_STATUS Status;\r
161 DEBUG_AGENT_MAILBOX *Mailbox;\r
4fe43eb3 162\r
b422b62c 163 Status = EfiGetSystemConfigurationTable (&gEfiDebugAgentGuid, (VOID **) &Mailbox);\r
164 if (Status == EFI_SUCCESS && Mailbox != NULL) {\r
165 VerifyMailboxChecksum (Mailbox);\r
166 return Mailbox;\r
167 } else {\r
168 return NULL;\r
169 }\r
18b144ea 170}\r
171\r
172/**\r
173 Get the pointer to Mailbox from the GUIDed HOB.\r
174\r
175 @param[in] HobStart The starting HOB pointer to search from.\r
176\r
177 @return Pointer to Mailbox.\r
178\r
179**/\r
180DEBUG_AGENT_MAILBOX *\r
181GetMailboxFromHob (\r
182 IN VOID *HobStart\r
183 )\r
184{\r
185 EFI_HOB_GUID_TYPE *GuidHob;\r
b422b62c 186 UINT64 *MailboxLocation;\r
187 DEBUG_AGENT_MAILBOX *Mailbox;\r
18b144ea 188\r
189 GuidHob = GetNextGuidHob (&gEfiDebugAgentGuid, HobStart);\r
190 if (GuidHob == NULL) {\r
191 return NULL;\r
192 }\r
b422b62c 193 MailboxLocation = (UINT64 *) (GET_GUID_HOB_DATA(GuidHob));\r
194 Mailbox = (DEBUG_AGENT_MAILBOX *)(UINTN)(*MailboxLocation);\r
195 VerifyMailboxChecksum (Mailbox);\r
18b144ea 196\r
b422b62c 197 return Mailbox;\r
18b144ea 198}\r
199\r
200/**\r
201 Get Debug Agent Mailbox pointer.\r
202\r
203 @return Mailbox pointer.\r
204\r
205**/\r
206DEBUG_AGENT_MAILBOX *\r
207GetMailboxPointer (\r
208 VOID\r
209 )\r
210{\r
b422b62c 211 AcquireMpSpinLock (&mDebugMpContext.MailboxSpinLock);\r
212 VerifyMailboxChecksum (mMailboxPointer);\r
213 ReleaseMpSpinLock (&mDebugMpContext.MailboxSpinLock);\r
18b144ea 214 return mMailboxPointer;\r
215}\r
216\r
217/**\r
218 Get debug port handle.\r
219\r
220 @return Debug port handle.\r
221\r
222**/\r
223DEBUG_PORT_HANDLE\r
224GetDebugPortHandle (\r
225 VOID\r
226 )\r
227{\r
b422b62c 228 return (DEBUG_PORT_HANDLE) (UINTN)(GetMailboxPointer ()->DebugPortHandle);\r
229}\r
230\r
231/**\r
adcc2727
JF
232 Worker function to set up Debug Agent environment.\r
233\r
77695f4d 234 This function will set up IDT table and initialize the IDT entries and\r
adcc2727
JF
235 initialize CPU LOCAL APIC timer.\r
236 It also tries to connect HOST if Debug Agent was not initialized before.\r
b422b62c 237\r
238 @param[in] Mailbox Pointer to Mailbox.\r
239\r
240**/\r
241VOID\r
adcc2727 242SetupDebugAgentEnvironment (\r
b422b62c 243 IN DEBUG_AGENT_MAILBOX *Mailbox\r
244 )\r
245{\r
246 IA32_DESCRIPTOR Idtr;\r
247 UINT16 IdtEntryCount;\r
248 UINT64 DebugPortHandle;\r
adcc2727 249 UINT32 DebugTimerFrequency;\r
b422b62c 250\r
251 if (mMultiProcessorDebugSupport) {\r
252 InitializeSpinLock (&mDebugMpContext.MpContextSpinLock);\r
253 InitializeSpinLock (&mDebugMpContext.DebugPortSpinLock);\r
254 InitializeSpinLock (&mDebugMpContext.MailboxSpinLock);\r
255 //\r
256 // Clear Break CPU index value\r
257 //\r
258 mDebugMpContext.BreakAtCpuIndex = (UINT32) -1;\r
259 }\r
260\r
261 //\r
262 // Get original IDT address and size.\r
263 //\r
264 AsmReadIdtr ((IA32_DESCRIPTOR *) &Idtr);\r
265 IdtEntryCount = (UINT16) ((Idtr.Limit + 1) / sizeof (IA32_IDT_GATE_DESCRIPTOR));\r
266 if (IdtEntryCount < 33) {\r
8cc26df4
JF
267 ZeroMem (&mIdtEntryTable, sizeof (IA32_IDT_GATE_DESCRIPTOR) * 33);\r
268 //\r
269 // Copy original IDT table into new one\r
270 //\r
271 CopyMem (&mIdtEntryTable, (VOID *) Idtr.Base, Idtr.Limit + 1);\r
272 //\r
273 // Load new IDT table\r
274 //\r
b422b62c 275 Idtr.Limit = (UINT16) (sizeof (IA32_IDT_GATE_DESCRIPTOR) * 33 - 1);\r
276 Idtr.Base = (UINTN) &mIdtEntryTable;\r
b422b62c 277 AsmWriteIdtr ((IA32_DESCRIPTOR *) &Idtr);\r
278 }\r
279\r
280 //\r
281 // Initialize the IDT table entries to support source level debug.\r
282 //\r
283 InitializeDebugIdt ();\r
284\r
3bf04a71
JF
285 //\r
286 // If mMailboxPointer is not set before, set it\r
287 //\r
288 if (mMailboxPointer == NULL) {\r
289 if (Mailbox != NULL) {\r
290 //\r
291 // If Mailbox exists, copy it into one global variable\r
292 //\r
293 CopyMem (&mMailbox, Mailbox, sizeof (DEBUG_AGENT_MAILBOX));\r
294 } else {\r
295 ZeroMem (&mMailbox, sizeof (DEBUG_AGENT_MAILBOX));\r
296 }\r
297 mMailboxPointer = &mMailbox;\r
298 }\r
b422b62c 299\r
adcc2727
JF
300 //\r
301 // Initialize Debug Timer hardware and save its initial count and frequency\r
302 //\r
86d13652 303 mDebugMpContext.DebugTimerInitCount = InitializeDebugTimer (&DebugTimerFrequency, TRUE);\r
adcc2727 304 UpdateMailboxContent (mMailboxPointer, DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY, DebugTimerFrequency);\r
b422b62c 305 //\r
306 // Initialize debug communication port\r
307 //\r
308 DebugPortHandle = (UINT64) (UINTN)DebugPortInitialize ((VOID *)(UINTN)mMailboxPointer->DebugPortHandle, NULL);\r
309 UpdateMailboxContent (mMailboxPointer, DEBUG_MAILBOX_DEBUG_PORT_HANDLE_INDEX, DebugPortHandle);\r
310\r
311 if (Mailbox == NULL) {\r
312 //\r
313 // Trigger one software interrupt to inform HOST\r
314 //\r
315 TriggerSoftInterrupt (SYSTEM_RESET_SIGNATURE);\r
316 SetDebugFlag (DEBUG_AGENT_FLAG_MEMORY_READY, 1);\r
317 //\r
318 // Memory has been ready\r
319 //\r
320 if (IsHostAttached ()) {\r
321 //\r
322 // Trigger one software interrupt to inform HOST\r
323 //\r
324 TriggerSoftInterrupt (MEMORY_READY_SIGNATURE);\r
325 }\r
326 }\r
18b144ea 327}\r
328\r
b422b62c 329\r
18b144ea 330/**\r
331 Initialize debug agent.\r
332\r
adcc2727 333 This function is used to set up debug environment for DXE phase.\r
18b144ea 334\r
335 If this function is called by DXE Core, Context must be the pointer\r
336 to HOB list which will be used to get GUIDed HOB. It will enable\r
337 interrupt to support break-in feature.\r
338 If this function is called by DXE module, Context must be NULL. It\r
339 will enable interrupt to support break-in feature.\r
340\r
341 @param[in] InitFlag Init flag is used to decide initialize process.\r
342 @param[in] Context Context needed according to InitFlag.\r
343 @param[in] Function Continue function called by debug agent library; it was\r
344 optional.\r
345\r
346**/\r
347VOID\r
348EFIAPI\r
349InitializeDebugAgent (\r
350 IN UINT32 InitFlag,\r
f9c9215b 351 IN VOID *Context OPTIONAL,\r
18b144ea 352 IN DEBUG_AGENT_CONTINUE Function OPTIONAL\r
353 )\r
354{\r
b422b62c 355 UINT64 *MailboxLocation;\r
18b144ea 356 DEBUG_AGENT_MAILBOX *Mailbox;\r
18b144ea 357 BOOLEAN InterruptStatus;\r
b422b62c 358 VOID *HobList;\r
359 IA32_DESCRIPTOR IdtDescriptor;\r
360 IA32_DESCRIPTOR *Ia32Idtr;\r
361 IA32_IDT_ENTRY *Ia32IdtEntry;\r
e2c8d3cf
JF
362 BOOLEAN PeriodicMode;\r
363 UINTN TimerCycle;\r
18b144ea 364\r
b422b62c 365 if (InitFlag == DEBUG_AGENT_INIT_DXE_AP) {\r
e2c8d3cf
JF
366 //\r
367 // Check if CPU APIC Timer is working, otherwise initialize it.\r
368 //\r
df60fb4c 369 InitializeLocalApicSoftwareEnable (TRUE);\r
e2c8d3cf
JF
370 GetApicTimerState (NULL, &PeriodicMode, NULL);\r
371 TimerCycle = GetApicTimerInitCount ();\r
372 if (!PeriodicMode || TimerCycle == 0) {\r
373 InitializeDebugTimer (NULL, FALSE);\r
374 }\r
b422b62c 375 //\r
376 // Invoked by AP, enable interrupt to let AP could receive IPI from other processors\r
377 //\r
378 EnableInterrupts ();\r
379 return ;\r
18b144ea 380 }\r
381\r
4fe43eb3 382 //\r
b422b62c 383 // Disable Debug Timer interrupt\r
384 //\r
385 SaveAndSetDebugTimerInterrupt (FALSE);\r
18b144ea 386 //\r
387 // Save and disable original interrupt status\r
388 //\r
389 InterruptStatus = SaveAndDisableInterrupts ();\r
390\r
b422b62c 391 //\r
392 // Try to get mailbox firstly\r
393 //\r
394 HobList = NULL;\r
395 Mailbox = NULL;\r
396 MailboxLocation = NULL;\r
397\r
398 switch (InitFlag) {\r
399\r
400 case DEBUG_AGENT_INIT_DXE_LOAD:\r
18b144ea 401 //\r
b422b62c 402 // Check if Debug Agent has been initialized before\r
18b144ea 403 //\r
b422b62c 404 if (IsDebugAgentInitialzed ()) {\r
586fda48 405 DEBUG ((DEBUG_INFO, "Debug Agent: The former agent will be overwritten by the new one!\n"));\r
b422b62c 406 }\r
407\r
408 mMultiProcessorDebugSupport = TRUE;\r
93c0bdec 409 //\r
b422b62c 410 // Save original IDT table\r
411 //\r
412 AsmReadIdtr (&IdtDescriptor);\r
413 mSaveIdtTableSize = IdtDescriptor.Limit + 1;\r
414 mSavedIdtTable = AllocateCopyPool (mSaveIdtTableSize, (VOID *) IdtDescriptor.Base);\r
415 //\r
b422b62c 416 // Check if Debug Agent initialized in DXE phase\r
417 //\r
418 Mailbox = GetMailboxFromConfigurationTable ();\r
419 if (Mailbox == NULL) {\r
420 //\r
4fe43eb3 421 // Try to get mailbox from GUIDed HOB build in PEI\r
b422b62c 422 //\r
423 HobList = GetHobList ();\r
424 Mailbox = GetMailboxFromHob (HobList);\r
425 }\r
426 //\r
adcc2727 427 // Set up Debug Agent Environment and try to connect HOST if required\r
b422b62c 428 //\r
adcc2727 429 SetupDebugAgentEnvironment (Mailbox);\r
08021523 430 //\r
b422b62c 431 // For DEBUG_AGENT_INIT_S3, needn't to install configuration table and EFI Serial IO protocol\r
432 // For DEBUG_AGENT_INIT_DXE_CORE, InternalConstructorWorker() will invoked in Constructor()\r
433 //\r
434 InternalConstructorWorker ();\r
435 //\r
2befbc82
JF
436 // Enable Debug Timer interrupt\r
437 //\r
438 SaveAndSetDebugTimerInterrupt (TRUE);\r
439 //\r
b422b62c 440 // Enable interrupt to receive Debug Timer interrupt\r
93c0bdec 441 //\r
18b144ea 442 EnableInterrupts ();\r
443\r
b422b62c 444 mDebugAgentInitialized = TRUE;\r
445 FindAndReportModuleImageInfo (SIZE_4KB);\r
446\r
447 *(EFI_STATUS *)Context = EFI_SUCCESS;\r
448\r
b422b62c 449 break;\r
450\r
451 case DEBUG_AGENT_INIT_DXE_UNLOAD:\r
452 if (mDebugAgentInitialized) {\r
453 if (IsHostAttached ()) {\r
b422b62c 454 *(EFI_STATUS *)Context = EFI_ACCESS_DENIED;\r
4fe43eb3 455 //\r
b422b62c 456 // Enable Debug Timer interrupt again\r
457 //\r
458 SaveAndSetDebugTimerInterrupt (TRUE);\r
459 } else {\r
460 //\r
461 // Restore original IDT table\r
462 //\r
463 AsmReadIdtr (&IdtDescriptor);\r
464 IdtDescriptor.Limit = (UINT16) (mSaveIdtTableSize - 1);\r
465 CopyMem ((VOID *) IdtDescriptor.Base, mSavedIdtTable, mSaveIdtTableSize);\r
466 AsmWriteIdtr (&IdtDescriptor);\r
467 FreePool (mSavedIdtTable);\r
468 mDebugAgentInitialized = FALSE;\r
469 *(EFI_STATUS *)Context = EFI_SUCCESS;\r
470 }\r
471 } else {\r
b422b62c 472 *(EFI_STATUS *)Context = EFI_NOT_STARTED;\r
473 }\r
18b144ea 474\r
18b144ea 475 //\r
b422b62c 476 // Restore interrupt state.\r
18b144ea 477 //\r
b422b62c 478 SetInterruptState (InterruptStatus);\r
479 break;\r
18b144ea 480\r
b422b62c 481 case DEBUG_AGENT_INIT_DXE_CORE:\r
482 mDxeCoreFlag = TRUE;\r
483 mMultiProcessorDebugSupport = TRUE;\r
18b144ea 484 //\r
4fe43eb3 485 // Try to get mailbox from GUIDed HOB build in PEI\r
18b144ea 486 //\r
b422b62c 487 HobList = Context;\r
488 Mailbox = GetMailboxFromHob (HobList);\r
489 //\r
adcc2727 490 // Set up Debug Agent Environment and try to connect HOST if required\r
08021523 491 //\r
adcc2727 492 SetupDebugAgentEnvironment (Mailbox);\r
08021523 493 //\r
2befbc82
JF
494 // Enable Debug Timer interrupt\r
495 //\r
496 SaveAndSetDebugTimerInterrupt (TRUE);\r
497 //\r
b422b62c 498 // Enable interrupt to receive Debug Timer interrupt\r
499 //\r
500 EnableInterrupts ();\r
18b144ea 501\r
b422b62c 502 break;\r
18b144ea 503\r
b422b62c 504 case DEBUG_AGENT_INIT_S3:\r
18b144ea 505\r
b422b62c 506 if (Context != NULL) {\r
507 Ia32Idtr = (IA32_DESCRIPTOR *) Context;\r
508 Ia32IdtEntry = (IA32_IDT_ENTRY *)(Ia32Idtr->Base);\r
3ee16809
HW
509 MailboxLocation = (UINT64 *) ((UINTN) Ia32IdtEntry[DEBUG_MAILBOX_VECTOR].Bits.OffsetLow +\r
510 ((UINTN) Ia32IdtEntry[DEBUG_MAILBOX_VECTOR].Bits.OffsetHigh << 16));\r
b422b62c 511 Mailbox = (DEBUG_AGENT_MAILBOX *)(UINTN)(*MailboxLocation);\r
512 VerifyMailboxChecksum (Mailbox);\r
513 }\r
18b144ea 514 //\r
3bf04a71
JF
515 // Save Mailbox pointer in global variable\r
516 //\r
517 mMailboxPointer = Mailbox;\r
518 //\r
adcc2727 519 // Set up Debug Agent Environment and try to connect HOST if required\r
18b144ea 520 //\r
adcc2727 521 SetupDebugAgentEnvironment (Mailbox);\r
18b144ea 522 //\r
b422b62c 523 // Disable interrupt\r
18b144ea 524 //\r
b422b62c 525 DisableInterrupts ();\r
526 FindAndReportModuleImageInfo (SIZE_4KB);\r
527 if (GetDebugFlag (DEBUG_AGENT_FLAG_BREAK_BOOT_SCRIPT) == 1) {\r
528 //\r
529 // If Boot Script entry break is set, code will be break at here.\r
530 //\r
531 CpuBreakpoint ();\r
532 }\r
533 break;\r
534\r
535 default:\r
18b144ea 536 //\r
4fe43eb3 537 // Only DEBUG_AGENT_INIT_PREMEM_SEC and DEBUG_AGENT_INIT_POSTMEM_SEC are allowed for this\r
b422b62c 538 // Debug Agent library instance.\r
18b144ea 539 //\r
586fda48 540 DEBUG ((DEBUG_ERROR, "Debug Agent: The InitFlag value is not allowed!\n"));\r
b422b62c 541 CpuDeadLoop ();\r
542 break;\r
18b144ea 543 }\r
18b144ea 544}\r