1 /**@file
2 
3 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
4 (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6 
7 
8 Module Name:
9   WinHost.h
10 
11 Abstract:
12   Include file for Windows Host
13 
14 **/
15 #ifndef _HOST_H_
16 #define _HOST_H_
17 
18 #include <stdio.h>
19 #include <time.h>
20 #include "WinInclude.h"
21 
22 #include <PiPei.h>
23 #include <IndustryStandard/PeImage.h>
24 #include <Guid/FileInfo.h>
25 #include <Guid/FileSystemInfo.h>
26 #include <Guid/FileSystemVolumeLabelInfo.h>
27 #include <Ppi/EmuThunk.h>
28 #include <Protocol/EmuThunk.h>
29 #include <Protocol/SimpleFileSystem.h>
30 
31 #include <Protocol/EmuBlockIo.h>
32 #include <Protocol/BlockIo.h>
33 #include <Protocol/EmuSnp.h>
34 
35 #include <Library/BaseLib.h>
36 #include <Library/PeCoffLib.h>
37 #include <Library/DebugLib.h>
38 #include <Library/MemoryAllocationLib.h>
39 #include <Library/ThunkPpiList.h>
40 #include <Library/ThunkProtocolList.h>
41 #include <Library/PcdLib.h>
42 #include <Library/PrintLib.h>
43 #include <Library/BaseMemoryLib.h>
44 #include <Library/PeiServicesLib.h>
45 #include <Library/PeCoffExtraActionLib.h>
46 #include <Library/NetLib.h>
47 
48 
49 #define TEMPORARY_RAM_SIZE                0x20000
50 
51 typedef struct {
52   VOID                  *Address;
53   UINTN                 Size;
54 } NT_FD_INFO;
55 
56 typedef struct {
57   EFI_PHYSICAL_ADDRESS  Memory;
58   UINT64                Size;
59 } NT_SYSTEM_MEMORY;
60 
61 RETURN_STATUS
62 EFIAPI
63 SecPeCoffGetEntryPoint (
64   IN     VOID  *Pe32Data,
65   IN OUT VOID  **EntryPoint
66 );
67 
68 VOID
69 SecLoadSecCore (
70   IN  UINTN   TemporaryRam,
71   IN  UINTN   TemporaryRamSize,
72   IN  VOID    *BootFirmwareVolumeBase,
73   IN  UINTN   BootFirmwareVolumeSize,
74   IN  VOID    *SecCorePe32File
75 )
76 /*++
77 
78 Routine Description:
79   This is the service to load the SEC Core from the Firmware Volume
80 
81 Arguments:
82   TemporaryRam            - Memory to use for SEC.
83   TemporaryRamSize        - Size of Memory to use for SEC
84   BootFirmwareVolumeBase  - Start of the Boot FV
85   SecCorePe32File         - SEC Core PE32
86 
87 Returns:
88   Success means control is transferred and thus we should never return
89 
90 --*/
91 ;
92 
93 EFI_STATUS
94 EFIAPI
95 SecWinNtFdAddress (
96   IN     UINTN                 Index,
97   IN OUT EFI_PHYSICAL_ADDRESS  *FdBase,
98   IN OUT UINT64                *FdSize
99   )
100 /*++
101 
102 Routine Description:
103 
104   TODO: Add function description
105 
106 Arguments:
107 
108   Index   - TODO: add argument description
109   FdBase  - TODO: add argument description
110   FdSize  - TODO: add argument description
111 
112 Returns:
113 
114   TODO: add return values
115 
116 --*/
117 ;
118 
119 
120 EFI_STATUS
121 EFIAPI
122 SecImageRead (
123   IN     VOID    *FileHandle,
124   IN     UINTN   FileOffset,
125   IN OUT UINTN   *ReadSize,
126   OUT    VOID    *Buffer
127   )
128 /*++
129 
130 Routine Description:
131 
132   TODO: Add function description
133 
134 Arguments:
135 
136   FileHandle  - TODO: add argument description
137   FileOffset  - TODO: add argument description
138   ReadSize    - TODO: add argument description
139   Buffer      - TODO: add argument description
140 
141 Returns:
142 
143   TODO: add return values
144 
145 --*/
146 ;
147 
148 CHAR16                            *
149 AsciiToUnicode (
150   IN  CHAR8   *Ascii,
151   IN  UINTN   *StrLen OPTIONAL
152   )
153 /*++
154 
155 Routine Description:
156 
157   TODO: Add function description
158 
159 Arguments:
160 
161   Ascii   - TODO: add argument description
162   StrLen  - TODO: add argument description
163 
164 Returns:
165 
166   TODO: add return values
167 
168 --*/
169 ;
170 
171 UINTN
172 CountSeparatorsInString (
173   IN  CONST CHAR16   *String,
174   IN  CHAR16   Separator
175   )
176 /*++
177 
178 Routine Description:
179 
180   TODO: Add function description
181 
182 Arguments:
183 
184   String    - TODO: add argument description
185   Separator - TODO: add argument description
186 
187 Returns:
188 
189   TODO: add return values
190 
191 --*/
192 ;
193 
194 BOOLEAN
195 EfiSystemMemoryRange (
196   IN  VOID *MemoryAddress
197   );
198 VOID
199 SecInitializeThunk (
200   VOID
201 );
202 extern EMU_THUNK_PROTOCOL    gEmuThunkProtocol;
203 extern EMU_IO_THUNK_PROTOCOL mWinNtWndThunkIo;
204 extern EMU_IO_THUNK_PROTOCOL mWinNtFileSystemThunkIo;
205 extern EMU_IO_THUNK_PROTOCOL mWinNtBlockIoThunkIo;
206 extern EMU_IO_THUNK_PROTOCOL mWinNtSnpThunkIo;
207 
208 #endif
209