1 /** @file 2 Status Code Handler Driver which produces datahub handler and hook it 3 onto the DXE status code router. 4 5 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 http://opensource.org/licenses/bsd-license.php 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 14 **/ 15 16 #include "DatahubStatusCodeHandlerDxe.h" 17 18 EFI_EVENT mExitBootServicesEvent = NULL; 19 EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL; 20 21 /** 22 Unregister status code callback functions only available at boot time from 23 report status code router when exiting boot services. 24 25 @param Event Event whose notification function is being invoked. 26 @param Context Pointer to the notification function's context, which is 27 always zero in current implementation. 28 29 **/ 30 VOID 31 EFIAPI 32 UnregisterBootTimeHandlers ( 33 IN EFI_EVENT Event, 34 IN VOID *Context 35 ) 36 { 37 mRscHandlerProtocol->Unregister (DataHubStatusCodeReportWorker); 38 } 39 40 /** 41 Entry point of DXE Status Code Driver. 42 43 This function is the entry point of this DXE Status Code Driver. 44 It initializes registers status code handlers, and registers event for EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE. 45 46 @param ImageHandle The firmware allocated handle for the EFI image. 47 @param SystemTable A pointer to the EFI System Table. 48 49 @retval EFI_SUCCESS The entry point is executed successfully. 50 51 **/ 52 EFI_STATUS 53 EFIAPI 54 DatahubStatusCodeHandlerDxeEntry ( 55 IN EFI_HANDLE ImageHandle, 56 IN EFI_SYSTEM_TABLE *SystemTable 57 ) 58 { 59 EFI_STATUS Status; 60 61 if (FeaturePcdGet (PcdStatusCodeUseDataHub)) { 62 Status = gBS->LocateProtocol ( 63 &gEfiRscHandlerProtocolGuid, 64 NULL, 65 (VOID **) &mRscHandlerProtocol 66 ); 67 ASSERT_EFI_ERROR (Status); 68 69 // 70 // Dispatch initialization request to supported devices 71 // 72 DataHubStatusCodeInitializeWorker (); 73 74 mRscHandlerProtocol->Register (DataHubStatusCodeReportWorker, TPL_HIGH_LEVEL); 75 76 Status = gBS->CreateEventEx ( 77 EVT_NOTIFY_SIGNAL, 78 TPL_NOTIFY, 79 UnregisterBootTimeHandlers, 80 NULL, 81 &gEfiEventExitBootServicesGuid, 82 &mExitBootServicesEvent 83 ); 84 ASSERT_EFI_ERROR (Status); 85 } 86 87 return EFI_SUCCESS; 88 } 89