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
33 Debug Port Driver entry point.
35 Checks to see there's not already a DebugSupport protocol installed for
36 the selected processor before installing protocol.
38 @param[in] ImageHandle The firmware allocated handle for the EFI image.
39 @param[in] SystemTable A pointer to the EFI System Table.
41 @retval EFI_SUCCESS The entry point is executed successfully.
42 @retval EFI_ALREADY_STARTED DebugSupport protocol is installed already.
43 @retval other Some error occurs when executing this entry point.
47 InitializeDebugSupportDriver (
48 IN EFI_HANDLE ImageHandle
,
49 IN EFI_SYSTEM_TABLE
*SystemTable
52 EFI_LOADED_IMAGE_PROTOCOL
*LoadedImageProtocolPtr
;
55 EFI_HANDLE
*HandlePtr
;
57 EFI_DEBUG_SUPPORT_PROTOCOL
*DebugSupportProtocolPtr
;
60 // Install Protocol Interface...
62 // First check to see that the debug support protocol for this processor
63 // type is not already installed
65 Status
= gBS
->LocateHandleBuffer (
67 &gEfiDebugSupportProtocolGuid
,
73 if (Status
!= EFI_NOT_FOUND
) {
76 Status
= gBS
->OpenProtocol (
77 HandlePtr
[NumHandles
],
78 &gEfiDebugSupportProtocolGuid
,
79 (VOID
**) &DebugSupportProtocolPtr
,
82 EFI_OPEN_PROTOCOL_GET_PROTOCOL
84 if (Status
== EFI_SUCCESS
&& DebugSupportProtocolPtr
->Isa
== EFI_ISA
) {
86 Status
= EFI_ALREADY_STARTED
;
89 } while (NumHandles
> 0);
94 // Get our image information and install platform specific unload handler
96 Status
= gBS
->OpenProtocol (
98 &gEfiLoadedImageProtocolGuid
,
99 (VOID
**) &LoadedImageProtocolPtr
,
102 EFI_OPEN_PROTOCOL_GET_PROTOCOL
104 ASSERT (!EFI_ERROR (Status
));
105 if (Status
!= EFI_SUCCESS
) {
109 LoadedImageProtocolPtr
->Unload
= PlUnloadDebugSupportDriver
;
112 // Call hook for platform specific initialization
114 Status
= PlInitializeDebugSupportDriver ();
115 ASSERT (!EFI_ERROR (Status
));
116 if (Status
!= EFI_SUCCESS
) {
121 // Install DebugSupport protocol to new handle
124 Status
= gBS
->InstallProtocolInterface (
126 &gEfiDebugSupportProtocolGuid
,
127 EFI_NATIVE_INTERFACE
,
128 &gDebugSupportProtocolInterface
130 ASSERT (!EFI_ERROR (Status
));
131 if (Status
!= EFI_SUCCESS
) {