3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Top level C file for debug support driver. Contains initialization function.
25 // private header files
27 #include "plDebugSupport.h"
30 // This is a global that is the actual interface
32 EFI_DEBUG_SUPPORT_PROTOCOL gDebugSupportProtocolInterface
= {
34 GetMaximumProcessorIndex
,
35 RegisterPeriodicCallback
,
36 RegisterExceptionCallback
,
37 InvalidateInstructionCache
44 InitializeDebugSupportDriver (
45 IN EFI_HANDLE ImageHandle
,
46 IN EFI_SYSTEM_TABLE
*SystemTable
51 Driver entry point. Checks to see there's not already a DebugSupport protocol
52 installed for the selected processor before installing protocol.
55 IN EFI_HANDLE ImageHandle,
56 IN EFI_SYSTEM_TABLE *SystemTable
63 // TODO: ImageHandle - add argument and description to function comment
64 // TODO: SystemTable - add argument and description to function comment
66 EFI_LOADED_IMAGE_PROTOCOL
*LoadedImageProtocolPtr
;
69 EFI_HANDLE
*HandlePtr
;
71 EFI_DEBUG_SUPPORT_PROTOCOL
*DebugSupportProtocolPtr
;
74 // Install Protocol Interface...
76 // First check to see that the debug support protocol for this processor
77 // type is not already installed
79 Status
= gBS
->LocateHandleBuffer (
81 &gEfiDebugSupportProtocolGuid
,
87 if (Status
!= EFI_NOT_FOUND
) {
90 Status
= gBS
->OpenProtocol (
91 HandlePtr
[NumHandles
],
92 &gEfiDebugSupportProtocolGuid
,
93 (VOID
**) &DebugSupportProtocolPtr
,
96 EFI_OPEN_PROTOCOL_GET_PROTOCOL
98 if (Status
== EFI_SUCCESS
&& DebugSupportProtocolPtr
->Isa
== EFI_ISA
) {
99 gBS
->FreePool (HandlePtr
);
100 Status
= EFI_ALREADY_STARTED
;
103 } while (NumHandles
> 0);
104 gBS
->FreePool (HandlePtr
);
108 // Get our image information and install platform specific unload handler
110 Status
= gBS
->OpenProtocol (
112 &gEfiLoadedImageProtocolGuid
,
113 (VOID
**) &LoadedImageProtocolPtr
,
116 EFI_OPEN_PROTOCOL_GET_PROTOCOL
118 ASSERT (!EFI_ERROR (Status
));
119 if (Status
!= EFI_SUCCESS
) {
123 LoadedImageProtocolPtr
->Unload
= plUnloadDebugSupportDriver
;
126 // Call hook for platform specific initialization
128 Status
= plInitializeDebugSupportDriver ();
129 ASSERT (!EFI_ERROR (Status
));
130 if (Status
!= EFI_SUCCESS
) {
135 // Install DebugSupport protocol to new handle
138 Status
= gBS
->InstallProtocolInterface (
140 &gEfiDebugSupportProtocolGuid
,
141 EFI_NATIVE_INTERFACE
,
142 &gDebugSupportProtocolInterface
144 ASSERT (!EFI_ERROR (Status
));
145 if (Status
!= EFI_SUCCESS
) {