2 Top level C file for debug support driver. Contains initialization function.
4 Copyright (c) 2006 - 2008, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 // private header files
18 #include "plDebugSupport.h"
21 // This is a global that is the actual interface
23 EFI_DEBUG_SUPPORT_PROTOCOL gDebugSupportProtocolInterface
= {
25 GetMaximumProcessorIndex
,
26 RegisterPeriodicCallback
,
27 RegisterExceptionCallback
,
28 InvalidateInstructionCache
35 InitializeDebugSupportDriver (
36 IN EFI_HANDLE ImageHandle
,
37 IN EFI_SYSTEM_TABLE
*SystemTable
42 Driver entry point. Checks to see there's not already a DebugSupport protocol
43 installed for the selected processor before installing protocol.
46 IN EFI_HANDLE ImageHandle,
47 IN EFI_SYSTEM_TABLE *SystemTable
54 // TODO: ImageHandle - add argument and description to function comment
55 // TODO: SystemTable - add argument and description to function comment
57 EFI_LOADED_IMAGE_PROTOCOL
*LoadedImageProtocolPtr
;
60 EFI_HANDLE
*HandlePtr
;
62 EFI_DEBUG_SUPPORT_PROTOCOL
*DebugSupportProtocolPtr
;
65 // Install Protocol Interface...
67 // First check to see that the debug support protocol for this processor
68 // type is not already installed
70 Status
= gBS
->LocateHandleBuffer (
72 &gEfiDebugSupportProtocolGuid
,
78 if (Status
!= EFI_NOT_FOUND
) {
81 Status
= gBS
->OpenProtocol (
82 HandlePtr
[NumHandles
],
83 &gEfiDebugSupportProtocolGuid
,
84 (VOID
**) &DebugSupportProtocolPtr
,
87 EFI_OPEN_PROTOCOL_GET_PROTOCOL
89 if (Status
== EFI_SUCCESS
&& DebugSupportProtocolPtr
->Isa
== EFI_ISA
) {
91 Status
= EFI_ALREADY_STARTED
;
94 } while (NumHandles
> 0);
99 // Get our image information and install platform specific unload handler
101 Status
= gBS
->OpenProtocol (
103 &gEfiLoadedImageProtocolGuid
,
104 (VOID
**) &LoadedImageProtocolPtr
,
107 EFI_OPEN_PROTOCOL_GET_PROTOCOL
109 ASSERT (!EFI_ERROR (Status
));
110 if (Status
!= EFI_SUCCESS
) {
114 LoadedImageProtocolPtr
->Unload
= plUnloadDebugSupportDriver
;
117 // Call hook for platform specific initialization
119 Status
= plInitializeDebugSupportDriver ();
120 ASSERT (!EFI_ERROR (Status
));
121 if (Status
!= EFI_SUCCESS
) {
126 // Install DebugSupport protocol to new handle
129 Status
= gBS
->InstallProtocolInterface (
131 &gEfiDebugSupportProtocolGuid
,
132 EFI_NATIVE_INTERFACE
,
133 &gDebugSupportProtocolInterface
135 ASSERT (!EFI_ERROR (Status
));
136 if (Status
!= EFI_SUCCESS
) {