/** Initialize OEM status code device . @return Always return EFI_SUCCESS. **/ EFI_STATUS EFIAPI OemHookStatusCodeInitialize ( VOID ) { PEI_NT_THUNK_PPI *NtThunkPpi; EFI_STATUS Status; // // Locate NtThunkPpi for retrieving standard output handle // Status = PeiServicesLocatePpi ( &gPeiNtThunkPpiGuid, 0, NULL, (VOID **) &NtThunkPpi ); ASSERT_EFI_ERROR (Status); mWinNt = (EFI_WIN_NT_THUNK_PROTOCOL *) NtThunkPpi->NtThunk (); // // Cache standard output handle. // mStdOut = mWinNt->GetStdHandle (STD_OUTPUT_HANDLE); return EFI_SUCCESS; }
EFI_STATUS EFIAPI PeimInitializeWinNtStuff ( IN EFI_FFS_FILE_HEADER *FfsHeader, IN EFI_PEI_SERVICES **PeiServices ) /*++ Routine Description: Perform a call-back into the SEC simulator to get NT Stuff Arguments: PeiServices - General purpose services available to every PEIM. Returns: None --*/ // TODO: FfsHeader - add argument and description to function comment { EFI_STATUS Status; EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor; PEI_NT_THUNK_PPI *PeiNtService; UINT64 InterfaceSize; EFI_PHYSICAL_ADDRESS InterfaceBase; Status = (**PeiServices).LocatePpi ( PeiServices, &gPeiNtThunkPpiGuid, // GUID 0, // INSTANCE &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR &PeiNtService // PPI ); ASSERT_PEI_ERROR (PeiServices, Status); Status = PeiNtService->NtThunk (&InterfaceSize, &InterfaceBase); ASSERT_PEI_ERROR (PeiServices, Status); Status = PeiBuildHobGuidData ( PeiServices, &mEfiPeiWinNtThunkProtocolGuid, // Guid &InterfaceBase, // Buffer (UINTN) InterfaceSize // BufferSize ); return Status; }
EFI_STATUS EFIAPI PeimInitializeWinNtThunkPPIToProtocolPeim ( IN EFI_FFS_FILE_HEADER *FfsHeader, IN EFI_PEI_SERVICES **PeiServices ) /*++ Routine Description: Perform a call-back into the SEC simulator to get NT Stuff Arguments: PeiServices - General purpose services available to every PEIM. Returns: None --*/ // TODO: FfsHeader - add argument and description to function comment { EFI_STATUS Status; EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor; PEI_NT_THUNK_PPI *PeiNtService; VOID *Ptr; DEBUG ((EFI_D_ERROR, "NT 32 WinNT Stuff PEIM Loaded\n")); Status = (**PeiServices).LocatePpi ( (const EFI_PEI_SERVICES **)PeiServices, &gPeiNtThunkPpiGuid, // GUID 0, // INSTANCE &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR (VOID**)&PeiNtService // PPI ); ASSERT_EFI_ERROR (Status); Ptr = PeiNtService->NtThunk (); BuildGuidDataHob ( &gEfiWinNtThunkProtocolGuid, // Guid &Ptr, // Buffer sizeof (VOID *) // Sizeof Buffer ); return Status; }