EmulatorPkg/WinHost: Enable network support.

Follow the implementation from Unix host to implement SNP
EMU_IO_THUNK_PROTOCOL and EMU_SNP_PROTOCOL. The network IO driver is the
same one as Nt32. Please refer to NETWORK-IO Subproject for network Io
driver(SnpNt32Io.dll).

Signed-off-by: Nickle Wang <nickle.wang@hpe.com>
Signed-off-by: Derek Lin <derek.lin2@hpe.com>
Acked-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Nickle Wang 2020-04-09 11:20:39 +08:00 committed by mergify[bot]
parent 68d720fd92
commit bb78cfbec0
5 changed files with 1155 additions and 1 deletions

View File

@ -4,6 +4,7 @@
# #
# Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.<BR>
# Portions copyright (c) 2011, Apple Inc. All rights reserved. # Portions copyright (c) 2011, Apple Inc. All rights reserved.
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
# #
# SPDX-License-Identifier: BSD-2-Clause-Patent # SPDX-License-Identifier: BSD-2-Clause-Patent
# #
@ -95,6 +96,13 @@
gEmulatorPkgTokenSpaceGuid.PcdEmuGop|L"GOP Window"|VOID*|0x00001018 gEmulatorPkgTokenSpaceGuid.PcdEmuGop|L"GOP Window"|VOID*|0x00001018
gEmulatorPkgTokenSpaceGuid.PcdEmuFileSystem|L"."|VOID*|0x00001004 gEmulatorPkgTokenSpaceGuid.PcdEmuFileSystem|L"."|VOID*|0x00001004
gEmulatorPkgTokenSpaceGuid.PcdEmuSerialPort|L"/dev/ttyS0"|VOID*|0x00001002 gEmulatorPkgTokenSpaceGuid.PcdEmuSerialPort|L"/dev/ttyS0"|VOID*|0x00001002
#
# On Unix host, this is the network interface name on host system that will
# be used in UEFI.
# On Win host, this is the network interface index number on Windows that
# will be used in UEFI. For example, string L"0" is the first network
# interface.
gEmulatorPkgTokenSpaceGuid.PcdEmuNetworkInterface|L"en0"|VOID*|0x0000100d gEmulatorPkgTokenSpaceGuid.PcdEmuNetworkInterface|L"en0"|VOID*|0x0000100d
gEmulatorPkgTokenSpaceGuid.PcdEmuCpuModel|L"Intel(R) Processor Model"|VOID*|0x00001007 gEmulatorPkgTokenSpaceGuid.PcdEmuCpuModel|L"Intel(R) Processor Model"|VOID*|0x00001007

View File

@ -9,7 +9,7 @@
allocate memory space with ReadWrite and Execute attribute. allocate memory space with ReadWrite and Execute attribute.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> (C) Copyright 2016-2020 Hewlett Packard Enterprise Development LP<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -443,6 +443,7 @@ Returns:
AddThunkProtocol (&mWinNtWndThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuGop), TRUE); AddThunkProtocol (&mWinNtWndThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuGop), TRUE);
AddThunkProtocol (&mWinNtFileSystemThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuFileSystem), TRUE); AddThunkProtocol (&mWinNtFileSystemThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuFileSystem), TRUE);
AddThunkProtocol (&mWinNtBlockIoThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuVirtualDisk), TRUE); AddThunkProtocol (&mWinNtBlockIoThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuVirtualDisk), TRUE);
AddThunkProtocol (&mWinNtSnpThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuNetworkInterface), TRUE);
// //
// Allocate space for gSystemMemory Array // Allocate space for gSystemMemory Array

View File

@ -1,6 +1,7 @@
/**@file /**@file
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
@ -29,6 +30,7 @@ Abstract:
#include <Protocol/EmuBlockIo.h> #include <Protocol/EmuBlockIo.h>
#include <Protocol/BlockIo.h> #include <Protocol/BlockIo.h>
#include <Protocol/EmuSnp.h>
#include <Library/BaseLib.h> #include <Library/BaseLib.h>
#include <Library/PeCoffLib.h> #include <Library/PeCoffLib.h>
@ -41,6 +43,7 @@ Abstract:
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/PeiServicesLib.h> #include <Library/PeiServicesLib.h>
#include <Library/PeCoffExtraActionLib.h> #include <Library/PeCoffExtraActionLib.h>
#include <Library/NetLib.h>
#define TEMPORARY_RAM_SIZE 0x20000 #define TEMPORARY_RAM_SIZE 0x20000
@ -200,4 +203,6 @@ extern EMU_THUNK_PROTOCOL gEmuThunkProtocol;
extern EMU_IO_THUNK_PROTOCOL mWinNtWndThunkIo; extern EMU_IO_THUNK_PROTOCOL mWinNtWndThunkIo;
extern EMU_IO_THUNK_PROTOCOL mWinNtFileSystemThunkIo; extern EMU_IO_THUNK_PROTOCOL mWinNtFileSystemThunkIo;
extern EMU_IO_THUNK_PROTOCOL mWinNtBlockIoThunkIo; extern EMU_IO_THUNK_PROTOCOL mWinNtBlockIoThunkIo;
extern EMU_IO_THUNK_PROTOCOL mWinNtSnpThunkIo;
#endif #endif

View File

@ -4,6 +4,7 @@
# Main executable file of Win Emulator that loads Sec core after initialization finished. # Main executable file of Win Emulator that loads Sec core after initialization finished.
# Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.<BR>
# Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR> # Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
# #
# SPDX-License-Identifier: BSD-2-Clause-Patent # SPDX-License-Identifier: BSD-2-Clause-Patent
# #
@ -33,11 +34,13 @@
WinThunk.c WinThunk.c
WinHost.h WinHost.h
WinHost.c WinHost.c
WinPacketFilter.c
WinInclude.h WinInclude.h
[Packages] [Packages]
MdePkg/MdePkg.dec MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec MdeModulePkg/MdeModulePkg.dec
NetworkPkg/NetworkPkg.dec
EmulatorPkg/EmulatorPkg.dec EmulatorPkg/EmulatorPkg.dec
[LibraryClasses] [LibraryClasses]
@ -61,6 +64,7 @@
gEmuGraphicsWindowProtocolGuid gEmuGraphicsWindowProtocolGuid
gEmuBlockIoProtocolGuid gEmuBlockIoProtocolGuid
gEfiSimpleFileSystemProtocolGuid gEfiSimpleFileSystemProtocolGuid
gEmuSnpProtocolGuid
[Guids] [Guids]
gEfiFileSystemVolumeLabelInfoIdGuid # SOMETIMES_CONSUMED gEfiFileSystemVolumeLabelInfoIdGuid # SOMETIMES_CONSUMED
@ -78,6 +82,7 @@
gEmulatorPkgTokenSpaceGuid.PcdEmuGop|L"GOP Window" gEmulatorPkgTokenSpaceGuid.PcdEmuGop|L"GOP Window"
gEmulatorPkgTokenSpaceGuid.PcdEmuFileSystem gEmulatorPkgTokenSpaceGuid.PcdEmuFileSystem
gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage
gEmulatorPkgTokenSpaceGuid.PcdEmuNetworkInterface|L"0"
[BuildOptions] [BuildOptions]
MSFT:*_*_*_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" MSFT:*_*_*_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb"

File diff suppressed because it is too large Load Diff