summaryrefslogtreecommitdiffstats
path: root/Nt32Pkg/SnpNt32Dxe
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-09-04 08:42:53 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-09-04 08:42:53 +0000
commit593a8308cc95cfff7d23f2c5e5a2ab8b8712e823 (patch)
treed2d97bf1d9667dd00c0cd9e3c8859a9689e3ab0c /Nt32Pkg/SnpNt32Dxe
parent0c2b5da80e9551286cd02a92d91090290ae2d816 (diff)
downloadedk2-593a8308cc95cfff7d23f2c5e5a2ab8b8712e823.tar.gz
edk2-593a8308cc95cfff7d23f2c5e5a2ab8b8712e823.tar.bz2
edk2-593a8308cc95cfff7d23f2c5e5a2ab8b8712e823.zip
1. Import SnpNt32Dxe. That is a thunk driver could produce SNP protocol on NT32 platform. It needs cowork with Network I/O driver.
2. Add network stack in Nt32Pkg.dsc. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3774 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Nt32Pkg/SnpNt32Dxe')
-rw-r--r--Nt32Pkg/SnpNt32Dxe/ComponentName.c161
-rw-r--r--Nt32Pkg/SnpNt32Dxe/SnpNt32.c1044
-rw-r--r--Nt32Pkg/SnpNt32Dxe/SnpNt32.h246
-rw-r--r--Nt32Pkg/SnpNt32Dxe/SnpNt32Dxe.inf56
-rw-r--r--Nt32Pkg/SnpNt32Dxe/SnpNt32Dxe.msa62
5 files changed, 1569 insertions, 0 deletions
diff --git a/Nt32Pkg/SnpNt32Dxe/ComponentName.c b/Nt32Pkg/SnpNt32Dxe/ComponentName.c
new file mode 100644
index 0000000000..f385a06ae3
--- /dev/null
+++ b/Nt32Pkg/SnpNt32Dxe/ComponentName.c
@@ -0,0 +1,161 @@
+/** @file
+
+Copyright (c) 2006 - 2007, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ ComponentName.c
+
+Abstract:
+
+
+**/
+
+#include "SnpNt32.h"
+
+//
+// EFI Component Name Functions
+//
+EFI_STATUS
+EFIAPI
+SnpNt32DriverComponentNameGetDriverName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
+ );
+
+EFI_STATUS
+EFIAPI
+SnpNt32DriverComponentNameGetControllerName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
+ );
+
+//
+// EFI Component Name Protocol
+//
+EFI_COMPONENT_NAME_PROTOCOL gSnpNt32DriverComponentName = {
+ SnpNt32DriverComponentNameGetDriverName,
+ SnpNt32DriverComponentNameGetControllerName,
+ "eng"
+};
+
+static EFI_UNICODE_STRING_TABLE mSnpNt32DriverNameTable[] = {
+ {
+ "eng",
+ L"SNP NT32 Driver"
+ },
+ {
+ NULL,
+ NULL
+ }
+};
+
+EFI_STATUS
+EFIAPI
+SnpNt32DriverComponentNameGetDriverName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
+ )
+/*++
+
+ Routine Description:
+ Retrieves a Unicode string that is the user readable name of the EFI Driver.
+
+ Arguments:
+ This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+ Language - A pointer to a three character ISO 639-2 language identifier.
+ This is the language of the driver name that that the caller
+ is requesting, and it must match one of the languages specified
+ in SupportedLanguages. The number of languages supported by a
+ driver is up to the driver writer.
+ DriverName - A pointer to the Unicode string to return. This Unicode string
+ is the name of the driver specified by This in the language
+ specified by Language.
+
+ Returns:
+ EFI_SUCCESS - The Unicode string for the Driver specified by This
+ and the language specified by Language was returned
+ in DriverName.
+ EFI_INVALID_PARAMETER - Language is NULL.
+ EFI_INVALID_PARAMETER - DriverName is NULL.
+ EFI_UNSUPPORTED - The driver specified by This does not support the
+ language specified by Language.
+
+--*/
+{
+ return LookupUnicodeString (
+ Language,
+ gSnpNt32DriverComponentName.SupportedLanguages,
+ mSnpNt32DriverNameTable,
+ DriverName
+ );
+}
+
+EFI_STATUS
+EFIAPI
+SnpNt32DriverComponentNameGetControllerName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
+ )
+/*++
+
+ Routine Description:
+ Retrieves a Unicode string that is the user readable name of the controller
+ that is being managed by an EFI Driver.
+
+ Arguments:
+ This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+ ControllerHandle - The handle of a controller that the driver specified by
+ This is managing. This handle specifies the controller
+ whose name is to be returned.
+ ChildHandle - The handle of the child controller to retrieve the name
+ of. This is an optional parameter that may be NULL. It
+ will be NULL for device drivers. It will also be NULL
+ for a bus drivers that wish to retrieve the name of the
+ bus controller. It will not be NULL for a bus driver
+ that wishes to retrieve the name of a child controller.
+ Language - A pointer to a three character ISO 639-2 language
+ identifier. This is the language of the controller name
+ that that the caller is requesting, and it must match one
+ of the languages specified in SupportedLanguages. The
+ number of languages supported by a driver is up to the
+ driver writer.
+ ControllerName - A pointer to the Unicode string to return. This Unicode
+ string is the name of the controller specified by
+ ControllerHandle and ChildHandle in the language specified
+ by Language from the point of view of the driver specified
+ by This.
+
+ Returns:
+ EFI_SUCCESS - The Unicode string for the user readable name in the
+ language specified by Language for the driver
+ specified by This was returned in DriverName.
+ EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
+ EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
+ EFI_INVALID_PARAMETER - Language is NULL.
+ EFI_INVALID_PARAMETER - ControllerName is NULL.
+ EFI_UNSUPPORTED - The driver specified by This is not currently managing
+ the controller specified by ControllerHandle and
+ ChildHandle.
+ EFI_UNSUPPORTED - The driver specified by This does not support the
+ language specified by Language.
+
+--*/
+{
+ return EFI_UNSUPPORTED;
+}
diff --git a/Nt32Pkg/SnpNt32Dxe/SnpNt32.c b/Nt32Pkg/SnpNt32Dxe/SnpNt32.c
new file mode 100644
index 0000000000..67a3ac0038
--- /dev/null
+++ b/Nt32Pkg/SnpNt32Dxe/SnpNt32.c
@@ -0,0 +1,1044 @@
+/** @file
+
+Copyright (c) 2006 - 2007, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ SnpNt32.c
+
+Abstract:
+
+-**/
+
+#include "SnpNt32.h"
+
+EFI_DRIVER_BINDING_PROTOCOL gSnpNt32DriverBinding = {
+ SnpNt32DriverBindingSupported,
+ SnpNt32DriverBindingStart,
+ SnpNt32DriverBindingStop,
+ 0xa,
+ NULL,
+ NULL
+};
+
+SNPNT32_GLOBAL_DATA gSnpNt32GlobalData = {
+ SNP_NT32_DRIVER_SIGNATURE, // Signature
+ {
+ NULL,
+ NULL
+ }, // InstanceList
+ NULL, // WinNtThunk
+ NULL, // NetworkLibraryHandle
+ {
+ 0
+ }, // NtNetUtilityTable
+ {
+ 0,
+ 0,
+ 0
+ }, // Lock
+ //
+ // Private functions
+ //
+ SnpNt32InitializeGlobalData, // InitializeGlobalData
+ SnpNt32InitializeInstanceData, // InitializeInstanceData
+ SnpNt32CloseInstance // CloseInstance
+};
+
+
+/**
+ Test to see if this driver supports ControllerHandle.
+
+ @param This Protocol instance pointer.
+ @param ControllerHandle Handle of device to test.
+ @param RemainingDevicePath Optional parameter use to pick a specific child
+ device to start.
+
+ @retval EFI_SUCCES This driver supports this device.
+ @retval other This driver does not support this device.
+
+**/
+EFI_STATUS
+EFIAPI
+SnpNt32DriverBindingSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
+ )
+{
+
+ SNPNT32_GLOBAL_DATA *GlobalData;
+ NET_LIST_ENTRY *Entry;
+ SNPNT32_INSTANCE_DATA *Instance;
+
+ GlobalData = &gSnpNt32GlobalData;
+
+ NET_LIST_FOR_EACH (Entry, &GlobalData->InstanceList) {
+
+ Instance = NET_LIST_USER_STRUCT_S (Entry, SNPNT32_INSTANCE_DATA, Entry, SNP_NT32_INSTANCE_SIGNATURE);
+
+ if (Instance->DeviceHandle == ControllerHandle) {
+ return EFI_SUCCESS;
+ }
+
+ }
+
+ return EFI_UNSUPPORTED;
+}
+
+
+/**
+ Start this driver on ControllerHandle.
+
+ @param This Protocol instance pointer.
+ @param ControllerHandle Handle of device to bind driver to.
+ @param RemainingDevicePath Optional parameter use to pick a specific child
+ device to start.
+
+ @retval EFI_SUCCES This driver is added to ControllerHandle.
+
+**/
+EFI_STATUS
+EFIAPI
+SnpNt32DriverBindingStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
+ )
+{
+ return EFI_SUCCESS;
+}
+
+
+/**
+ Stop this driver on ControllerHandle.
+
+ @param This Protocol instance pointer.
+ @param ControllerHandle Handle of device to stop driver on.
+ @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number
+ of children is zero stop the entire bus driver.
+ @param ChildHandleBuffer List of Child Handles to Stop.
+
+ @retval EFI_SUCCES This driver is removed ControllerHandle.
+
+**/
+EFI_STATUS
+EFIAPI
+SnpNt32DriverBindingStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ )
+{
+
+ return EFI_SUCCESS;
+}
+
+
+/**
+ Start the SnpNt32 interface.
+
+ @param This Context pointer.
+
+ @retval EFI_SUCCESS The interface is started.
+
+**/
+EFI_STATUS
+SnpNt32Start (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This
+ )
+{
+ return EFI_SUCCESS;
+}
+
+
+/**
+ Stop the SnpNt32 interface.
+
+ @param This Context pointer.
+
+ @retval EFI_SUCCESS The interface is stopped.
+
+**/
+EFI_STATUS
+SnpNt32Stop (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This
+ )
+{
+ return EFI_SUCCESS;
+}
+
+
+/**
+ Initialize the SnpNt32 interface.
+
+ @param This Context pointer.
+ @param ExtraRxBufferSize Number of extra receive buffer.
+ @param ExtraTxBufferSize Number of extra transmit buffer.
+
+ @retval EFI_SUCCESS The interface is initialized.
+
+**/
+EFI_STATUS
+SnpNt32Initialize (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
+ IN UINTN ExtraRxBufferSize OPTIONAL,
+ IN UINTN ExtraTxBufferSize OPTIONAL
+ )
+{
+ return EFI_SUCCESS;
+}
+
+
+/**
+ Reset the snpnt32 interface.
+
+ @param This Context pointer.
+ @param ExtendedVerification Not implemented.
+
+ @retval EFI_SUCCESS The interface is reseted.
+
+**/
+EFI_STATUS
+SnpNt32Reset (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
+ IN BOOLEAN ExtendedVerification
+ )
+{
+ return EFI_SUCCESS;
+}
+
+
+/**
+ Shut down the snpnt32 interface.
+
+ @param This Context pointer.
+
+ @retval EFI_SUCCESS The interface is shut down.
+
+**/
+EFI_STATUS
+SnpNt32Shutdown (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This
+ )
+{
+ return EFI_SUCCESS;
+}
+
+
+/**
+ Change the interface's receive filter setting.
+
+ @param This Context pointer.
+ @param EnableBits The receive filters to enable.
+ @param DisableBits The receive filters to disable
+ @param ResetMcastFilter Reset the multicast filters or not.
+ @param McastFilterCount The count of multicast filter to set.
+ @param McastFilter Pointer to the arrya of multicast addresses to set.
+
+ @retval EFI_SUCCESS The receive filter is updated.
+ @retval EFI_ACCESS_DENIED The snpnt32 lock is already owned by another
+ routine.
+ @retval EFI_DEVICE_ERROR Failed to update the receive filter.
+
+**/
+EFI_STATUS
+SnpNt32ReceiveFilters (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
+ IN UINT32 EnableBits,
+ IN UINT32 DisableBits,
+ IN BOOLEAN ResetMcastFilter,
+ IN UINTN McastFilterCount OPTIONAL,
+ IN EFI_MAC_ADDRESS *McastFilter OPTIONAL
+ )
+{
+ SNPNT32_INSTANCE_DATA *Instance;
+ SNPNT32_GLOBAL_DATA *GlobalData;
+ INT32 ReturnValue;
+
+ Instance = SNP_NT32_INSTANCE_DATA_FROM_SNP_THIS (This);
+
+ GlobalData = Instance->GlobalData;
+
+ if (EFI_ERROR (NET_TRYLOCK (&GlobalData->Lock))) {
+ return EFI_ACCESS_DENIED;
+ }
+
+ ReturnValue = GlobalData->NtNetUtilityTable.SetReceiveFilter (
+ Instance->InterfaceInfo.InterfaceIndex,
+ EnableBits,
+ McastFilterCount,
+ McastFilter
+ );
+
+ NET_UNLOCK (&GlobalData->Lock);
+
+ if (ReturnValue <= 0) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+/**
+ Change or reset the mac address of the interface.
+
+ @param This Context pointer.
+ @param reset Reset the mac address to the original one or not.
+ @param NewMacAddr Pointer to the new mac address to set.
+
+ @retval EFI_UNSUPPORTED Not supported yet.
+
+**/
+EFI_STATUS
+SnpNt32StationAddress (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
+ IN BOOLEAN Reset,
+ IN EFI_MAC_ADDRESS *NewMacAddr OPTIONAL
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+
+/**
+ Get or reset the statistics data.
+
+ @param This Context pointer.
+ @param Reset Reset the statistics or not.
+ @param StatisticsSize The size of the buffer used to receive the
+ statistics data.
+ @param StatisticsTable Pointer to the table used to receive the statistics
+ data.
+
+ @retval EFI_UNSUPPORTED Not supported yet.
+
+**/
+EFI_STATUS
+SnpNt32Statistics (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * This,
+ IN BOOLEAN Reset,
+ IN OUT UINTN *StatisticsSize OPTIONAL,
+ IN OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+
+/**
+ Convert a multicast ip address to the multicast mac address.
+
+ @param This Context pointer.
+ @param Ipv6 The Ip is an Ipv6 address or not.
+ @param Ip Pointer to the Ip address to convert.
+ @param Mac Pointer to the buffer used to hold the converted
+ mac address.
+
+ @retval EFI_UNSUPPORTED Not supported yet.
+
+**/
+EFI_STATUS
+SnpNt32McastIptoMac (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
+ IN BOOLEAN Ipv6,
+ IN EFI_IP_ADDRESS *Ip,
+ OUT EFI_MAC_ADDRESS *Mac
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+
+/**
+ Read or write the nv data.
+
+ @param This Context pinter.
+ @param ReadOrWrite Read or write the nv data.
+ @param Offset The offset to the start of the nv data.
+ @param BufferSize Size of the buffer.
+ @param Buffer Pointer to the buffer containing the data to write
+ or used to receive the data read.
+
+ @retval EFI_UNSUPPORTED Not supported yet.
+
+**/
+EFI_STATUS
+SnpNt32Nvdata (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
+ IN BOOLEAN ReadOrWrite,
+ IN UINTN Offset,
+ IN UINTN BufferSize,
+ IN OUT VOID *Buffer
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+
+/**
+ Get the status information of the interface.
+
+ @param This Context pointer.
+ @param InterruptStatus The storage to hold the interrupt status.
+ @param TxBuffer Pointer to get the list of pointers of previously
+ transmitted buffers whose transmission was
+ completed asynchrnously.
+
+ @retval EFI_SUCCESS The status is got.
+
+**/
+EFI_STATUS
+SnpNt32GetStatus (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
+ OUT UINT32 *InterruptStatus,
+ OUT VOID **TxBuffer
+ )
+{
+
+ if (TxBuffer != NULL) {
+ *((UINT8 **) TxBuffer) = (UINT8 *) 1;
+ }
+
+ if (InterruptStatus != NULL) {
+ *InterruptStatus = EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT;
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+/**
+ Transmit a packet.
+
+ @param This Context pointer.
+ @param HeaderSize The media header size contained in the packet
+ buffer.
+ @param BufferSize The size of the packet buffer.
+ @param Buffer Pointer to the buffer containing the packet data.
+ @param SrcAddr If non null, points to the source address of this
+ packet.
+ @param DestAddr If non null, points to the destination address of
+ this packet.
+ @param Protocol The protocol type of this packet.
+
+ @retval EFI_SUCCESS The packet is transmitted or put into the transmit
+ queue.
+ @retval other Some error occurs.
+
+**/
+EFI_STATUS
+SnpNt32Transmit (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
+ IN UINTN HeaderSize,
+ IN UINTN BufferSize,
+ IN VOID *Buffer,
+ IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
+ IN EFI_MAC_ADDRESS *DestAddr OPTIONAL,
+ IN UINT16 *Protocol OPTIONAL
+ )
+{
+ SNPNT32_INSTANCE_DATA *Instance;
+ SNPNT32_GLOBAL_DATA *GlobalData;
+ INT32 ReturnValue;
+
+ Instance = SNP_NT32_INSTANCE_DATA_FROM_SNP_THIS (This);
+
+ GlobalData = Instance->GlobalData;
+
+ if ((HeaderSize != 0) && (SrcAddr == NULL)) {
+ SrcAddr = &Instance->Mode.CurrentAddress;
+ }
+
+ if (EFI_ERROR (NET_TRYLOCK (&GlobalData->Lock))) {
+ return EFI_ACCESS_DENIED;
+ }
+
+ ReturnValue = GlobalData->NtNetUtilityTable.Transmit (
+ Instance->InterfaceInfo.InterfaceIndex,
+ HeaderSize,
+ BufferSize,
+ Buffer,
+ SrcAddr,
+ DestAddr,
+ Protocol
+ );
+
+ NET_UNLOCK (&GlobalData->Lock);
+
+ if (ReturnValue < 0) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+/**
+ Receive network data.
+
+ @param This Context pointer.
+ @param HeaderSize Optional parameter and is a pointer to the header
+ portion of the data received.
+ @param BuffSize Pointer to the length of the Buffer on entry and
+ contains the length of the received data on return
+ @param Buffer Pointer to the memory for the received data
+ @param SourceAddr Optional parameter, is a pointer to contain the
+ source ethernet address on return
+ @param DestinationAddr Optional parameter, is a pointer to contain the
+ destination ethernet address on return.
+ @param Protocol Optional parameter, is a pointer to contain the
+ Protocol type from the ethernet header on return.
+
+ @retval EFI_SUCCESS A packet is received and put into the buffer.
+ @retval EFI_BUFFER_TOO_SMALL The provided buffer is too small to receive the
+ packet.
+ @retval EFI_NOT_READY There is no packet received.
+
+**/
+EFI_STATUS
+SnpNt32Receive (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
+ OUT UINTN *HeaderSize,
+ IN OUT UINTN *BuffSize,
+ OUT VOID *Buffer,
+ OUT EFI_MAC_ADDRESS *SourceAddr,
+ OUT EFI_MAC_ADDRESS *DestinationAddr,
+ OUT UINT16 *Protocol
+ )
+{
+ SNPNT32_INSTANCE_DATA *Instance;
+ SNPNT32_GLOBAL_DATA *GlobalData;
+ INT32 ReturnValue;
+
+ Instance = SNP_NT32_INSTANCE_DATA_FROM_SNP_THIS (This);
+
+ GlobalData = Instance->GlobalData;
+
+ ASSERT (GlobalData->NtNetUtilityTable.Receive != NULL);
+
+ if (EFI_ERROR (NET_TRYLOCK (&GlobalData->Lock))) {
+ return EFI_ACCESS_DENIED;
+ }
+
+ ReturnValue = GlobalData->NtNetUtilityTable.Receive (
+ Instance->InterfaceInfo.InterfaceIndex,
+ BuffSize,
+ Buffer
+ );
+
+ NET_UNLOCK (&GlobalData->Lock);
+
+ if (ReturnValue < 0) {
+ if (ReturnValue == -100) {
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ return EFI_DEVICE_ERROR;
+ } else if (ReturnValue == 0) {
+ return EFI_NOT_READY;
+ }
+
+ if (HeaderSize != NULL) {
+ *HeaderSize = 14;
+ }
+
+ if (SourceAddr != NULL) {
+ NetZeroMem (SourceAddr, sizeof (EFI_MAC_ADDRESS));
+ NetCopyMem (SourceAddr, ((UINT8 *) Buffer) + 6, 6);
+ }
+
+ if (DestinationAddr != NULL) {
+ NetZeroMem (DestinationAddr, sizeof (EFI_MAC_ADDRESS));
+ NetCopyMem (DestinationAddr, ((UINT8 *) Buffer), 6);
+ }
+
+ if (Protocol != NULL) {
+ *Protocol = NTOHS (*((UINT16 *) (((UINT8 *) Buffer) + 12)));
+ }
+
+ return EFI_SUCCESS;
+}
+
+SNPNT32_INSTANCE_DATA gSnpNt32InstanceTemplate = {
+ SNP_NT32_INSTANCE_SIGNATURE, // Signature
+ {
+ NULL,
+ NULL
+ }, // Entry
+ NULL, // GlobalData
+ NULL, // DeviceHandle
+ NULL, // DevicePath
+ { // Snp
+ EFI_SIMPLE_NETWORK_PROTOCOL_REVISION, // Revision
+ SnpNt32Start, // Start
+ SnpNt32Stop, // Stop
+ SnpNt32Initialize, // Initialize
+ SnpNt32Reset, // Reset
+ SnpNt32Shutdown, // Shutdown
+ SnpNt32ReceiveFilters, // ReceiveFilters
+ SnpNt32StationAddress, // StationAddress
+ SnpNt32Statistics, // Statistics
+ SnpNt32McastIptoMac, // MCastIpToMac
+ SnpNt32Nvdata, // NvData
+ SnpNt32GetStatus, // GetStatus
+ SnpNt32Transmit, // Transmit
+ SnpNt32Receive, // Receive
+ NULL, // WaitForPacket
+ NULL // Mode
+ },
+ { // Mode
+ EfiSimpleNetworkInitialized, // State
+ NET_ETHER_ADDR_LEN, // HwAddressSize
+ NET_ETHER_HEADER_SIZE, // MediaHeaderSize
+ 1500, // MaxPacketSize
+ 0, // NvRamSize
+ 0, // NvRamAccessSize
+ 0, // ReceiveFilterMask
+ 0, // ReceiveFilterSetting
+ MAX_MCAST_FILTER_CNT, // MaxMCastFilterCount
+ 0, // MCastFilterCount
+ {
+ 0
+ }, // MCastFilter
+ {
+ 0
+ }, // CurrentAddress
+ {
+ 0
+ }, // BroadcastAddress
+ {
+ 0
+ }, // PermanentAddress
+ NET_IFTYPE_ETHERNET, // IfType
+ FALSE, // MacAddressChangeable
+ FALSE, // MultipleTxSupported
+ FALSE, // MediaPresentSupported
+ TRUE // MediaPresent
+ },
+ {
+ 0
+ } // InterfaceInfo
+};
+
+
+/**
+ Initialize the driver's global data.
+
+ @param This Pointer to the global context data.
+
+ @retval EFI_SUCCESS The global data is initialized.
+ @retval EFI_NOT_FOUND The required DLL is not found.
+
+**/
+EFI_STATUS
+SnpNt32InitializeGlobalData (
+ IN SNPNT32_GLOBAL_DATA *This
+ )
+{
+ EFI_STATUS Status;
+ CHAR16 *DllFileNameU;
+ UINT32 Index;
+ INT32 ReturnValue;
+ BOOLEAN NetUtilityLibInitDone;
+ NT_NET_INTERFACE_INFO NetInterfaceInfoBuffer[MAX_INTERFACE_INFO_NUMBER];
+ SNPNT32_INSTANCE_DATA *Instance;
+ NET_LIST_ENTRY *Entry;
+ UINT32 InterfaceCount;
+
+ ASSERT (This != NULL);
+
+ NetUtilityLibInitDone = FALSE;
+ InterfaceCount = MAX_INTERFACE_INFO_NUMBER;
+
+ NetListInit (&This->InstanceList);
+ NET_LOCK_INIT (&This->Lock);
+
+ //
+ // Get the WinNT thunk
+ //
+ Status = gBS->LocateProtocol (&gEfiWinNtThunkProtocolGuid, NULL, &This->WinNtThunk);
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ASSERT (This->WinNtThunk != NULL);
+
+ DllFileNameU = NETWORK_LIBRARY_NAME_U;
+
+ //
+ // Load network utility library
+ //
+ This->NetworkLibraryHandle = This->WinNtThunk->LoadLibraryEx (DllFileNameU, NULL, 0);
+
+ if (NULL == This->NetworkLibraryHandle) {
+ return EFI_NOT_FOUND;
+ }
+
+ This->NtNetUtilityTable.Initialize = (NT_NET_INITIALIZE) This->WinNtThunk->GetProcAddress (
+ This->NetworkLibraryHandle,
+ NETWORK_LIBRARY_INITIALIZE
+ );
+
+ if (NULL == This->NtNetUtilityTable.Initialize) {
+ Status = EFI_NOT_FOUND;
+ goto ErrorReturn;
+ }
+
+ This->NtNetUtilityTable.Finalize = (NT_NET_FINALIZE) This->WinNtThunk->GetProcAddress (
+ This->NetworkLibraryHandle,
+ NETWORK_LIBRARY_FINALIZE
+ );
+
+ if (NULL == This->NtNetUtilityTable.Finalize) {
+ Status = EFI_NOT_FOUND;
+ goto ErrorReturn;
+ }
+
+ This->NtNetUtilityTable.SetReceiveFilter = (NT_NET_SET_RECEIVE_FILTER) This->WinNtThunk->GetProcAddress (
+ This->NetworkLibraryHandle,
+ NETWORK_LIBRARY_SET_RCV_FILTER
+ );
+
+ if (NULL == This->NtNetUtilityTable.SetReceiveFilter) {
+ Status = EFI_NOT_FOUND;
+ goto ErrorReturn;
+ }
+
+ This->NtNetUtilityTable.Receive = (NT_NET_RECEIVE) This->WinNtThunk->GetProcAddress (
+ This->NetworkLibraryHandle,
+ NETWORK_LIBRARY_RECEIVE
+ );
+
+ if (NULL == This->NtNetUtilityTable.Receive) {
+ Status = EFI_NOT_FOUND;
+ goto ErrorReturn;
+ }
+
+ This->NtNetUtilityTable.Transmit = (NT_NET_TRANSMIT) This->WinNtThunk->GetProcAddress (
+ This->NetworkLibraryHandle,
+ NETWORK_LIBRARY_TRANSMIT
+ );
+
+ if (NULL == This->NtNetUtilityTable.Transmit) {
+ Status = EFI_NOT_FOUND;
+ goto ErrorReturn;
+ }
+ //
+ // Initialize the network utility library
+ // And enumerate the interfaces in NT32 host
+ //
+ ReturnValue = This->NtNetUtilityTable.Initialize (&InterfaceCount, &NetInterfaceInfoBuffer[0]);
+ if (ReturnValue <= 0) {
+ Status = EFI_DEVICE_ERROR;
+ goto ErrorReturn;
+ }
+
+ NetUtilityLibInitDone = TRUE;
+
+ if (InterfaceCount == 0) {
+ Status = EFI_NOT_FOUND;
+ goto ErrorReturn;
+ }
+ //
+ // Create fake SNP instances
+ //
+ for (Index = 0; Index < InterfaceCount; Index++) {
+
+ Instance = NetAllocatePool (sizeof (SNPNT32_INSTANCE_DATA));
+
+ if (NULL == Instance) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto ErrorReturn;
+ }
+ //
+ // Copy the content from a template
+ //
+ NetCopyMem (Instance, &gSnpNt32InstanceTemplate, sizeof (SNPNT32_INSTANCE_DATA));
+
+ //
+ // Set the interface information.
+ //
+ Instance->InterfaceInfo = NetInterfaceInfoBuffer[Index];
+ //
+ // Initialize this instance
+ //
+ Status = This->InitializeInstanceData (This, Instance);
+ if (EFI_ERROR (Status)) {
+
+ NetFreePool (Instance);
+ goto ErrorReturn;
+ }
+ //
+ // Insert this instance into the instance list
+ //
+ NetListInsertTail (&This->InstanceList, &Instance->Entry);
+ }
+
+ return EFI_SUCCESS;
+
+ErrorReturn:
+
+ while (!NetListIsEmpty (&This->InstanceList)) {
+
+ Entry = This->InstanceList.ForwardLink;
+
+ Instance = NET_LIST_USER_STRUCT_S (Entry, SNPNT32_INSTANCE_DATA, Entry, SNP_NT32_INSTANCE_SIGNATURE);
+
+ NetListRemoveEntry (Entry);
+
+ This->CloseInstance (This, Instance);
+ NetFreePool (Instance);
+ }
+
+ if (NetUtilityLibInitDone) {
+
+ ASSERT (This->WinNtThunk != NULL);
+
+ if (This->NtNetUtilityTable.Finalize != NULL) {
+ This->NtNetUtilityTable.Finalize ();
+ This->NtNetUtilityTable.Finalize = NULL;
+ }
+ }
+
+ return Status;
+}
+
+
+/**
+ Initialize the snpnt32 driver instance.
+
+ @param This Pointer to the SnpNt32 global data.
+ @param Instance Pointer to the instance context data.
+
+ @retval EFI_SUCCESS The driver instance is initialized.
+
+**/
+EFI_STATUS
+SnpNt32InitializeInstanceData (
+ IN SNPNT32_GLOBAL_DATA *This,
+ IN SNPNT32_INSTANCE_DATA *Instance
+ )
+{
+ EFI_STATUS Status;
+ EFI_DEV_PATH EndNode;
+ EFI_DEV_PATH Node;
+
+ Instance->GlobalData = This;
+ Instance->Snp.Mode = &Instance->Mode;
+ //
+ // Set broadcast address
+ //
+ SetMem (&Instance->Mode.BroadcastAddress, sizeof (EFI_MAC_ADDRESS), 0xFF);
+
+ //
+ // Copy Current/PermanentAddress MAC address
+ //
+ Instance->Mode.CurrentAddress = Instance->InterfaceInfo.MacAddr;
+ Instance->Mode.PermanentAddress = Instance->InterfaceInfo.MacAddr;
+
+ //
+ // Since the fake SNP is based on a real NIC, to avoid conflict with the host
+ // NIC network stack, we use a different MAC address.
+ // So just change the last byte of the MAC address for the real NIC.
+ //
+ Instance->Mode.CurrentAddress.Addr[NET_ETHER_ADDR_LEN - 1]++;
+
+ //
+ // Create a fake device path for the instance
+ //
+ NetZeroMem (&Node, sizeof (Node));
+
+ Node.DevPath.Type = MESSAGING_DEVICE_PATH;
+ Node.DevPath.SubType = MSG_MAC_ADDR_DP;
+ SetDevicePathNodeLength (&Node.DevPath, sizeof (MAC_ADDR_DEVICE_PATH));
+
+ NetCopyMem (
+ &Node.MacAddr.MacAddress,
+ &Instance->Mode.CurrentAddress,
+ sizeof (EFI_MAC_ADDRESS)
+ );
+
+ Node.MacAddr.IfType = Instance->Mode.IfType;
+
+ SetDevicePathEndNode (&EndNode.DevPath);
+
+ Instance->DevicePath = AppendDevicePathNode (
+ &EndNode.DevPath,
+ &Node.DevPath
+ );
+
+ //
+ // Create a fake device handle for the fake SNP
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &Instance->DeviceHandle,
+ &gEfiSimpleNetworkProtocolGuid,
+ &Instance->Snp,
+ &gEfiDevicePathProtocolGuid,
+ Instance->DevicePath,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ goto ErrorReturn;
+ }
+
+ return EFI_SUCCESS;
+
+ErrorReturn:
+ return Status;
+}
+
+
+/**
+ Close the SnpNt32 driver instance.
+
+ @param This Pointer to the SnpNt32 global data.
+ @param Instance Pointer to the instance context data.
+
+ @retval EFI_SUCCESS The instance is closed.
+
+**/
+EFI_STATUS
+SnpNt32CloseInstance (
+ IN SNPNT32_GLOBAL_DATA *This,
+ IN SNPNT32_INSTANCE_DATA *Instance
+ )
+{
+ ASSERT (This != NULL);
+ ASSERT (Instance != NULL);
+
+ gBS->UninstallMultipleProtocolInterfaces (
+ Instance->DeviceHandle,
+ &gEfiSimpleNetworkProtocolGuid,
+ &Instance->Snp,
+ &gEfiDevicePathProtocolGuid,
+ Instance->DevicePath,
+ NULL
+ );
+
+ if (Instance->DevicePath != NULL) {
+ gBS->FreePool (Instance->DevicePath);
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+/**
+ Unload the SnpNt32 driver.
+
+ @param ImageHandle The handle of the driver image.
+
+ @retval EFI_SUCCESS The driver is unloaded.
+ @retval other Some error occurs.
+
+**/
+EFI_STATUS
+EFIAPI
+SnpNt32Unload (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ EFI_STATUS Status;
+ SNPNT32_GLOBAL_DATA *This;
+ NET_LIST_ENTRY *Entry;
+ SNPNT32_INSTANCE_DATA *Instance;
+
+ This = &gSnpNt32GlobalData;
+
+ Status = NetLibDefaultUnload (ImageHandle);
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ while (!NetListIsEmpty (&This->InstanceList)) {
+ //
+ // Walkthrough the interfaces and remove all the SNP instance
+ //
+ Entry = This->InstanceList.ForwardLink;
+
+ Instance = NET_LIST_USER_STRUCT_S (Entry, SNPNT32_INSTANCE_DATA, Entry, SNP_NT32_INSTANCE_SIGNATURE);
+
+ NetListRemoveEntry (Entry);
+
+ This->CloseInstance (This, Instance);
+ NetFreePool (Instance);
+ }
+
+ if (This->NtNetUtilityTable.Finalize != NULL) {
+ This->NtNetUtilityTable.Finalize ();
+ }
+
+ This->WinNtThunk->FreeLibrary (This->NetworkLibraryHandle);
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+InitializeSnpNt32river (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+
+ Install DriverBinding Protocol for the Win NT Bus driver on the drivers
+ image handle.
+
+Arguments:
+
+ ImageHandle - The handle of this image.
+ SystemTable - Pointer to the EFI system table.
+
+Returns:
+
+ EFI_SUCEESS - The protocols are installed and the SnpNt32 is initialized.
+ other - Some error occurs.
+
+--*/
+{
+
+ EFI_STATUS Status;
+
+ //
+ // Install the Driver Protocols
+ //
+
+ Status = NetLibInstallAllDriverProtocolsWithUnload (
+ ImageHandle,
+ SystemTable,
+ &gSnpNt32DriverBinding,
+ ImageHandle,
+ &gSnpNt32DriverComponentName,
+ NULL,
+ NULL,
+ SnpNt32Unload
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Initialize the global data
+ //
+ Status = SnpNt32InitializeGlobalData (&gSnpNt32GlobalData);
+ if (EFI_ERROR (Status)) {
+ SnpNt32Unload (ImageHandle);
+ }
+
+ return Status;
+}
diff --git a/Nt32Pkg/SnpNt32Dxe/SnpNt32.h b/Nt32Pkg/SnpNt32Dxe/SnpNt32.h
new file mode 100644
index 0000000000..d1b999f537
--- /dev/null
+++ b/Nt32Pkg/SnpNt32Dxe/SnpNt32.h
@@ -0,0 +1,246 @@
+/** @file
+
+Copyright (c) 2006 - 2007, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ SnpNt32.h
+
+Abstract:
+
+-**/
+
+#ifndef _SNP_NT32_H_
+#define _SNP_NT32_H_
+
+#include <PiDxe.h>
+
+#include <Protocol/SimpleNetwork.h>
+#include <Protocol/DevicePath.h>
+#include <Protocol/WinNtThunk.h>
+
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/NetLib.h>
+#include <Library/MemoryAllocationLib.h>
+
+typedef struct _SNPNT32_GLOBAL_DATA SNPNT32_GLOBAL_DATA;
+typedef struct _SNPNT32_INSTANCE_DATA SNPNT32_INSTANCE_DATA;
+
+#define NETWORK_LIBRARY_NAME_U L"SnpNt32Io.dll"
+
+#define NETWORK_LIBRARY_INITIALIZE "SnpInitialize"
+#define NETWORK_LIBRARY_FINALIZE "SnpFinalize"
+#define NETWORK_LIBRARY_SET_RCV_FILTER "SnpSetReceiveFilter"
+#define NETWORK_LIBRARY_RECEIVE "SnpReceive"
+#define NETWORK_LIBRARY_TRANSMIT "SnpTransmit"
+
+#pragma pack(1)
+typedef struct _NT_NET_INTERFACE_INFO {
+ UINT32 InterfaceIndex;
+ EFI_MAC_ADDRESS MacAddr;
+} NT_NET_INTERFACE_INFO;
+#pragma pack()
+
+#define NET_ETHER_HEADER_SIZE 14
+
+#define MAX_INTERFACE_INFO_NUMBER 16
+#define MAX_FILE_NAME_LENGTH 280
+
+//
+// Functions in Net Library
+//
+typedef
+INT32
+(*NT_NET_INITIALIZE) (
+ IN OUT UINT32 *InterfaceCount,
+ IN OUT NT_NET_INTERFACE_INFO * InterfaceInfoBuffer
+ );
+
+typedef
+INT32
+(*NT_NET_FINALIZE) (
+ VOID
+ );
+
+typedef
+INT32
+(*NT_NET_SET_RECEIVE_FILTER) (
+ IN UINT32 Index,
+ IN UINT32 EnableFilter,
+ IN UINT32 MCastFilterCnt,
+ IN EFI_MAC_ADDRESS * MCastFilter
+ );
+
+typedef
+INT32
+(*NT_NET_RECEIVE) (
+ IN UINT32 Index,
+ IN OUT UINT32 *BufferSize,
+ OUT VOID *Buffer
+ );
+
+typedef
+INT32
+(*NT_NET_TRANSMIT) (
+ IN UINT32 Index,
+ IN UINT32 HeaderSize,
+ IN UINT32 BufferSize,
+ IN VOID *Buffer,
+ IN EFI_MAC_ADDRESS * SrcAddr,
+ IN EFI_MAC_ADDRESS * DestAddr,
+ IN UINT16 *Protocol
+ );
+
+typedef struct _NT_NET_UTILITY_TABLE {
+ NT_NET_INITIALIZE Initialize;
+ NT_NET_FINALIZE Finalize;
+ NT_NET_SET_RECEIVE_FILTER SetReceiveFilter;
+ NT_NET_RECEIVE Receive;
+ NT_NET_TRANSMIT Transmit;
+} NT_NET_UTILITY_TABLE;
+
+//
+// Private functions
+//
+typedef
+EFI_STATUS
+(*SNPNT32_INITIALIZE_GLOBAL_DATA) (
+ IN SNPNT32_GLOBAL_DATA * This
+ );
+
+typedef
+EFI_STATUS
+(*SNPNT32_INITIALIZE_INSTANCE_DATA) (
+ IN SNPNT32_GLOBAL_DATA * This,
+ IN SNPNT32_INSTANCE_DATA * Instance
+ );
+
+typedef
+EFI_STATUS
+(*SNPNT32_CLOSE_INSTANCE) (
+ IN SNPNT32_GLOBAL_DATA * This,
+ IN SNPNT32_INSTANCE_DATA * Instance
+ );
+
+//
+// Global data for this driver
+//
+#define SNP_NT32_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('W', 'S', 'N', 'P')
+
+typedef struct _SNPNT32_GLOBAL_DATA {
+ UINT32 Signature;
+
+ //
+ // List for all the fake SNP instance
+ //
+ NET_LIST_ENTRY InstanceList;
+
+ EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
+ HMODULE NetworkLibraryHandle;
+
+ NT_NET_UTILITY_TABLE NtNetUtilityTable;
+
+ NET_LOCK Lock;
+
+ //
+ // Private functions
+ //
+ SNPNT32_INITIALIZE_GLOBAL_DATA InitializeGlobalData;
+ SNPNT32_INITIALIZE_INSTANCE_DATA InitializeInstanceData;
+ SNPNT32_CLOSE_INSTANCE CloseInstance;
+} SNPNT32_GLOBAL_DATA;
+
+//
+// Instance data for each fake SNP instance
+//
+#define SNP_NT32_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('w', 'S', 'N', 'P')
+
+typedef struct _SNPNT32_INSTANCE_DATA {
+ UINT32 Signature;
+
+ //
+ // List entry use for linking with other instance
+ //
+ NET_LIST_ENTRY Entry;
+
+ SNPNT32_GLOBAL_DATA *GlobalData;
+
+ EFI_HANDLE DeviceHandle;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+
+ EFI_SIMPLE_NETWORK_PROTOCOL Snp;
+ EFI_SIMPLE_NETWORK_MODE Mode;
+
+ NT_NET_INTERFACE_INFO InterfaceInfo;
+
+ //
+ // Private functions
+ //
+} SNPNT32_INSTANCE_DATA;
+
+#define SNP_NT32_INSTANCE_DATA_FROM_SNP_THIS(a) \
+ CR ( \
+ a, \
+ SNPNT32_INSTANCE_DATA, \
+ Snp, \
+ SNP_NT32_INSTANCE_SIGNATURE \
+ )
+
+extern EFI_DRIVER_BINDING_PROTOCOL gSnpNt32DriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL gSnpNt32DriverComponentName;
+
+EFI_STATUS
+EFIAPI
+SnpNt32DriverBindingSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+SnpNt32DriverBindingStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+SnpNt32DriverBindingStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ );
+
+EFI_STATUS
+SnpNt32InitializeGlobalData (
+ IN SNPNT32_GLOBAL_DATA *This
+ );
+
+EFI_STATUS
+SnpNt32InitializeInstanceData (
+ IN SNPNT32_GLOBAL_DATA *This,
+ IN SNPNT32_INSTANCE_DATA *Instance
+ );
+
+EFI_STATUS
+SnpNt32CloseInstance (
+ IN SNPNT32_GLOBAL_DATA *This,
+ IN SNPNT32_INSTANCE_DATA *Instance
+ );
+
+#endif
diff --git a/Nt32Pkg/SnpNt32Dxe/SnpNt32Dxe.inf b/Nt32Pkg/SnpNt32Dxe/SnpNt32Dxe.inf
new file mode 100644
index 0000000000..2896a83c34
--- /dev/null
+++ b/Nt32Pkg/SnpNt32Dxe/SnpNt32Dxe.inf
@@ -0,0 +1,56 @@
+#/** @file
+# Component name for module SnpNt32Dxe
+#
+# Copyright (c) 2007, Intel Corporation.
+#
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+#
+#**/
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = SnpNt32Dxe
+ FILE_GUID = D0893F05-B06D-4161-B947-9BE9B85AC3A1
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ EDK_RELEASE_VERSION = 0x00020000
+ EFI_SPECIFICATION_VERSION = 0x00020000
+
+ ENTRY_POINT = InitializeSnpNt32river
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[Sources.common]
+ ComponentName.c
+ SnpNt32.h
+ SnpNt32.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ Nt32Pkg/Nt32Pkg.dec
+
+[LibraryClasses]
+ DevicePathLib
+ UefiLib
+ UefiBootServicesTableLib
+ BaseMemoryLib
+ DebugLib
+ UefiDriverEntryPoint
+ NetLib
+
+[Protocols]
+ gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiWinNtThunkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
diff --git a/Nt32Pkg/SnpNt32Dxe/SnpNt32Dxe.msa b/Nt32Pkg/SnpNt32Dxe/SnpNt32Dxe.msa
new file mode 100644
index 0000000000..cbce6c168b
--- /dev/null
+++ b/Nt32Pkg/SnpNt32Dxe/SnpNt32Dxe.msa
@@ -0,0 +1,62 @@
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <MsaHeader>
+ <ModuleName>SnpNt32Dxe</ModuleName>
+ <ModuleType>DXE_DRIVER</ModuleType>
+ <GuidValue>D0893F05-B06D-4161-B947-9BE9B85AC3A1</GuidValue>
+ <Version>1.0</Version>
+ <Abstract>Component name for module SnpNt32</Abstract>
+ <Description>FIX ME!</Description>
+ <Copyright>Copyright (c) 2007, Intel Corporation. </Copyright>
+ <License>All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
+ </MsaHeader>
+ <ModuleDefinitions>
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
+ <BinaryModule>false</BinaryModule>
+ <OutputFileBasename>SnpNt32Dxe</OutputFileBasename>
+ </ModuleDefinitions>
+ <LibraryClassDefinitions>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>DebugLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>BaseMemoryLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>UefiBootServicesTableLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>UefiLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>DevicePathLib</Keyword>
+ </LibraryClass>
+ </LibraryClassDefinitions>
+ <SourceFiles>
+ <Filename>SnpNt32.c</Filename>
+ <Filename>SnpNt32.h</Filename>
+ <Filename>ComponentName.c</Filename>
+ </SourceFiles>
+ <PackageDependencies>
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
+ <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
+ </PackageDependencies>
+ <Protocols>
+ <Protocol Usage="ALWAYS_CONSUMED">
+ <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
+ </Protocol>
+ <Protocol Usage="ALWAYS_CONSUMED">
+ <ProtocolCName>gEfiSimpleNetworkProtocolGuid</ProtocolCName>
+ </Protocol>
+ </Protocols>
+ <Externs>
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
+ </Externs>
+</ModuleSurfaceArea> \ No newline at end of file