1 /**@file
2 
3 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 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
8 
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.
11 
12 Module Name:
13 
14     WinNtStuff.c
15 
16 Abstract:
17 
18     Tiano PEIM to abstract construction of firmware volume in a Windows NT environment.
19 
20 Revision History
21 
22 **/
23 
24 //
25 // The package level header files this module uses
26 //
27 #include <PiPei.h>
28 #include <WinNtPeim.h>
29 //
30 // The protocols, PPI and GUID defintions for this module
31 //
32 #include <Protocol/WinNtThunk.h>
33 #include <Ppi/NtThunk.h>
34 //
35 // The Library classes this module consumes
36 //
37 #include <Library/DebugLib.h>
38 #include <Library/PeimEntryPoint.h>
39 #include <Library/HobLib.h>
40 
41 EFI_STATUS
42 EFIAPI
PeimInitializeWinNtThunkPPIToProtocolPeim(IN EFI_FFS_FILE_HEADER * FfsHeader,IN EFI_PEI_SERVICES ** PeiServices)43 PeimInitializeWinNtThunkPPIToProtocolPeim (
44   IN EFI_FFS_FILE_HEADER       *FfsHeader,
45   IN EFI_PEI_SERVICES          **PeiServices
46   )
47 /*++
48 
49 Routine Description:
50 
51   Perform a call-back into the SEC simulator to get NT Stuff
52 
53 Arguments:
54 
55   PeiServices - General purpose services available to every PEIM.
56 
57 Returns:
58 
59   None
60 
61 --*/
62 // TODO:    FfsHeader - add argument and description to function comment
63 {
64   EFI_STATUS              Status;
65   EFI_PEI_PPI_DESCRIPTOR  *PpiDescriptor;
66   PEI_NT_THUNK_PPI        *PeiNtService;
67   VOID                    *Ptr;
68 
69   DEBUG ((EFI_D_ERROR, "NT 32 WinNT Stuff PEIM Loaded\n"));
70 
71   Status = (**PeiServices).LocatePpi (
72                             (const EFI_PEI_SERVICES **)PeiServices,
73                             &gPeiNtThunkPpiGuid,  // GUID
74                             0,                    // INSTANCE
75                             &PpiDescriptor,       // EFI_PEI_PPI_DESCRIPTOR
76                             (VOID**)&PeiNtService         // PPI
77                             );
78   ASSERT_EFI_ERROR (Status);
79 
80   Ptr = PeiNtService->NtThunk ();
81 
82   BuildGuidDataHob (
83     &gEfiWinNtThunkProtocolGuid,         // Guid
84     &Ptr,                                // Buffer
85     sizeof (VOID *)                      // Sizeof Buffer
86     );
87   return Status;
88 }
89