mirror of https://github.com/acidanthera/audk.git
Update to support to produce Component Name and & Component Name 2 protocol based on Feature flag PcdComponentNameDisable & PcdComponentName2Disable.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3987 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
ced44f7370
commit
057d744eee
|
@ -23,6 +23,45 @@ Abstract:
|
||||||
//
|
//
|
||||||
// EFI Component Name Functions
|
// EFI Component Name Functions
|
||||||
//
|
//
|
||||||
|
/**
|
||||||
|
Retrieves a Unicode string that is the user readable name of the driver.
|
||||||
|
|
||||||
|
This function retrieves the user readable name of a driver in the form of a
|
||||||
|
Unicode string. If the driver specified by This has a user readable name in
|
||||||
|
the language specified by Language, then a pointer to the driver name is
|
||||||
|
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
||||||
|
by This does not support the language specified by Language,
|
||||||
|
then EFI_UNSUPPORTED is returned.
|
||||||
|
|
||||||
|
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||||
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||||
|
|
||||||
|
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||||
|
array indicating the language. This is the
|
||||||
|
language of the driver name 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. Language is specified
|
||||||
|
in RFC 3066 or ISO 639-2 language code format.
|
||||||
|
|
||||||
|
@param DriverName[out] 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.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
||||||
|
This and the language specified by Language was
|
||||||
|
returned in DriverName.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
||||||
|
|
||||||
|
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||||
|
the language specified by Language.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SnpNt32DriverComponentNameGetDriverName (
|
SnpNt32DriverComponentNameGetDriverName (
|
||||||
|
@ -31,6 +70,75 @@ SnpNt32DriverComponentNameGetDriverName (
|
||||||
OUT CHAR16 **DriverName
|
OUT CHAR16 **DriverName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves a Unicode string that is the user readable name of the controller
|
||||||
|
that is being managed by a driver.
|
||||||
|
|
||||||
|
This function retrieves the user readable name of the controller specified by
|
||||||
|
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
||||||
|
driver specified by This has a user readable name in the language specified by
|
||||||
|
Language, then a pointer to the controller name is returned in ControllerName,
|
||||||
|
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
||||||
|
managing the controller specified by ControllerHandle and ChildHandle,
|
||||||
|
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
||||||
|
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
||||||
|
|
||||||
|
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||||
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||||
|
|
||||||
|
@param ControllerHandle[in] The handle of a controller that the driver
|
||||||
|
specified by This is managing. This handle
|
||||||
|
specifies the controller whose name is to be
|
||||||
|
returned.
|
||||||
|
|
||||||
|
@param ChildHandle[in] 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.
|
||||||
|
|
||||||
|
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||||
|
array indicating the language. This is the
|
||||||
|
language of the driver name 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. Language is specified in
|
||||||
|
RFC 3066 or ISO 639-2 language code format.
|
||||||
|
|
||||||
|
@param ControllerName[out] 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.
|
||||||
|
|
||||||
|
@retval 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.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
||||||
|
EFI_HANDLE.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
||||||
|
|
||||||
|
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
||||||
|
managing the controller specified by
|
||||||
|
ControllerHandle and ChildHandle.
|
||||||
|
|
||||||
|
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||||
|
the language specified by Language.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SnpNt32DriverComponentNameGetControllerName (
|
SnpNt32DriverComponentNameGetControllerName (
|
||||||
|
@ -41,18 +149,29 @@ SnpNt32DriverComponentNameGetControllerName (
|
||||||
OUT CHAR16 **ControllerName
|
OUT CHAR16 **ControllerName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// EFI Component Name Protocol
|
// EFI Component Name Protocol
|
||||||
//
|
//
|
||||||
EFI_COMPONENT_NAME_PROTOCOL gSnpNt32DriverComponentName = {
|
EFI_COMPONENT_NAME_PROTOCOL gSnpNt32DriverComponentName = {
|
||||||
SnpNt32DriverComponentNameGetDriverName,
|
SnpNt32DriverComponentNameGetDriverName,
|
||||||
SnpNt32DriverComponentNameGetControllerName,
|
SnpNt32DriverComponentNameGetControllerName,
|
||||||
"eng"
|
"eng"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// EFI Component Name 2 Protocol
|
||||||
|
//
|
||||||
|
EFI_COMPONENT_NAME2_PROTOCOL gSnpNt32DriverComponentName2 = {
|
||||||
|
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) SnpNt32DriverComponentNameGetDriverName,
|
||||||
|
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) SnpNt32DriverComponentNameGetControllerName,
|
||||||
|
"en"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static EFI_UNICODE_STRING_TABLE mSnpNt32DriverNameTable[] = {
|
static EFI_UNICODE_STRING_TABLE mSnpNt32DriverNameTable[] = {
|
||||||
{
|
{
|
||||||
"eng",
|
"eng;en",
|
||||||
L"SNP NT32 Driver"
|
L"SNP NT32 Driver"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -61,6 +180,45 @@ static EFI_UNICODE_STRING_TABLE mSnpNt32DriverNameTable[] = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves a Unicode string that is the user readable name of the driver.
|
||||||
|
|
||||||
|
This function retrieves the user readable name of a driver in the form of a
|
||||||
|
Unicode string. If the driver specified by This has a user readable name in
|
||||||
|
the language specified by Language, then a pointer to the driver name is
|
||||||
|
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
||||||
|
by This does not support the language specified by Language,
|
||||||
|
then EFI_UNSUPPORTED is returned.
|
||||||
|
|
||||||
|
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||||
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||||
|
|
||||||
|
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||||
|
array indicating the language. This is the
|
||||||
|
language of the driver name 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. Language is specified
|
||||||
|
in RFC 3066 or ISO 639-2 language code format.
|
||||||
|
|
||||||
|
@param DriverName[out] 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.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
||||||
|
This and the language specified by Language was
|
||||||
|
returned in DriverName.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
||||||
|
|
||||||
|
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||||
|
the language specified by Language.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SnpNt32DriverComponentNameGetDriverName (
|
SnpNt32DriverComponentNameGetDriverName (
|
||||||
|
@ -68,41 +226,84 @@ SnpNt32DriverComponentNameGetDriverName (
|
||||||
IN CHAR8 *Language,
|
IN CHAR8 *Language,
|
||||||
OUT CHAR16 **DriverName
|
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 (
|
return LookupUnicodeString2 (
|
||||||
Language,
|
Language,
|
||||||
gSnpNt32DriverComponentName.SupportedLanguages,
|
This->SupportedLanguages,
|
||||||
mSnpNt32DriverNameTable,
|
mSnpNt32DriverNameTable,
|
||||||
DriverName
|
DriverName,
|
||||||
);
|
(BOOLEAN)(This == &gSnpNt32DriverComponentName)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves a Unicode string that is the user readable name of the controller
|
||||||
|
that is being managed by a driver.
|
||||||
|
|
||||||
|
This function retrieves the user readable name of the controller specified by
|
||||||
|
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
||||||
|
driver specified by This has a user readable name in the language specified by
|
||||||
|
Language, then a pointer to the controller name is returned in ControllerName,
|
||||||
|
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
||||||
|
managing the controller specified by ControllerHandle and ChildHandle,
|
||||||
|
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
||||||
|
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
||||||
|
|
||||||
|
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||||
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||||
|
|
||||||
|
@param ControllerHandle[in] The handle of a controller that the driver
|
||||||
|
specified by This is managing. This handle
|
||||||
|
specifies the controller whose name is to be
|
||||||
|
returned.
|
||||||
|
|
||||||
|
@param ChildHandle[in] 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.
|
||||||
|
|
||||||
|
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||||
|
array indicating the language. This is the
|
||||||
|
language of the driver name 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. Language is specified in
|
||||||
|
RFC 3066 or ISO 639-2 language code format.
|
||||||
|
|
||||||
|
@param ControllerName[out] 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.
|
||||||
|
|
||||||
|
@retval 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.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
||||||
|
EFI_HANDLE.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
||||||
|
|
||||||
|
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
||||||
|
managing the controller specified by
|
||||||
|
ControllerHandle and ChildHandle.
|
||||||
|
|
||||||
|
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||||
|
the language specified by Language.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SnpNt32DriverComponentNameGetControllerName (
|
SnpNt32DriverComponentNameGetControllerName (
|
||||||
|
@ -112,50 +313,6 @@ SnpNt32DriverComponentNameGetControllerName (
|
||||||
IN CHAR8 *Language,
|
IN CHAR8 *Language,
|
||||||
OUT CHAR16 **ControllerName
|
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;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1018,15 +1018,14 @@ Returns:
|
||||||
// Install the Driver Protocols
|
// Install the Driver Protocols
|
||||||
//
|
//
|
||||||
|
|
||||||
Status = EfiLibInstallAllDriverProtocols (
|
Status = EfiLibInstallDriverBindingComponentName2 (
|
||||||
ImageHandle,
|
ImageHandle,
|
||||||
SystemTable,
|
SystemTable,
|
||||||
&gSnpNt32DriverBinding,
|
&gSnpNt32DriverBinding,
|
||||||
ImageHandle,
|
ImageHandle,
|
||||||
&gSnpNt32DriverComponentName,
|
&gSnpNt32DriverComponentName,
|
||||||
NULL,
|
&gSnpNt32DriverComponentName2
|
||||||
NULL
|
);
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,246 +1,247 @@
|
||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2006 - 2007, Intel Corporation
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
Module Name:
|
||||||
|
|
||||||
SnpNt32.h
|
SnpNt32.h
|
||||||
|
|
||||||
Abstract:
|
Abstract:
|
||||||
|
|
||||||
-**/
|
-**/
|
||||||
|
|
||||||
#ifndef _SNP_NT32_H_
|
#ifndef _SNP_NT32_H_
|
||||||
#define _SNP_NT32_H_
|
#define _SNP_NT32_H_
|
||||||
|
|
||||||
#include <PiDxe.h>
|
#include <PiDxe.h>
|
||||||
|
|
||||||
#include <Protocol/SimpleNetwork.h>
|
#include <Protocol/SimpleNetwork.h>
|
||||||
#include <Protocol/DevicePath.h>
|
#include <Protocol/DevicePath.h>
|
||||||
#include <Protocol/WinNtThunk.h>
|
#include <Protocol/WinNtThunk.h>
|
||||||
|
|
||||||
#include <Library/BaseLib.h>
|
#include <Library/BaseLib.h>
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
#include <Library/UefiLib.h>
|
#include <Library/UefiLib.h>
|
||||||
#include <Library/DevicePathLib.h>
|
#include <Library/DevicePathLib.h>
|
||||||
#include <Library/NetLib.h>
|
#include <Library/NetLib.h>
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
|
|
||||||
typedef struct _SNPNT32_GLOBAL_DATA SNPNT32_GLOBAL_DATA;
|
typedef struct _SNPNT32_GLOBAL_DATA SNPNT32_GLOBAL_DATA;
|
||||||
typedef struct _SNPNT32_INSTANCE_DATA SNPNT32_INSTANCE_DATA;
|
typedef struct _SNPNT32_INSTANCE_DATA SNPNT32_INSTANCE_DATA;
|
||||||
|
|
||||||
#define NETWORK_LIBRARY_NAME_U L"SnpNt32Io.dll"
|
#define NETWORK_LIBRARY_NAME_U L"SnpNt32Io.dll"
|
||||||
|
|
||||||
#define NETWORK_LIBRARY_INITIALIZE "SnpInitialize"
|
#define NETWORK_LIBRARY_INITIALIZE "SnpInitialize"
|
||||||
#define NETWORK_LIBRARY_FINALIZE "SnpFinalize"
|
#define NETWORK_LIBRARY_FINALIZE "SnpFinalize"
|
||||||
#define NETWORK_LIBRARY_SET_RCV_FILTER "SnpSetReceiveFilter"
|
#define NETWORK_LIBRARY_SET_RCV_FILTER "SnpSetReceiveFilter"
|
||||||
#define NETWORK_LIBRARY_RECEIVE "SnpReceive"
|
#define NETWORK_LIBRARY_RECEIVE "SnpReceive"
|
||||||
#define NETWORK_LIBRARY_TRANSMIT "SnpTransmit"
|
#define NETWORK_LIBRARY_TRANSMIT "SnpTransmit"
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
typedef struct _NT_NET_INTERFACE_INFO {
|
typedef struct _NT_NET_INTERFACE_INFO {
|
||||||
UINT32 InterfaceIndex;
|
UINT32 InterfaceIndex;
|
||||||
EFI_MAC_ADDRESS MacAddr;
|
EFI_MAC_ADDRESS MacAddr;
|
||||||
} NT_NET_INTERFACE_INFO;
|
} NT_NET_INTERFACE_INFO;
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
#define NET_ETHER_HEADER_SIZE 14
|
#define NET_ETHER_HEADER_SIZE 14
|
||||||
|
|
||||||
#define MAX_INTERFACE_INFO_NUMBER 16
|
#define MAX_INTERFACE_INFO_NUMBER 16
|
||||||
#define MAX_FILE_NAME_LENGTH 280
|
#define MAX_FILE_NAME_LENGTH 280
|
||||||
|
|
||||||
//
|
//
|
||||||
// Functions in Net Library
|
// Functions in Net Library
|
||||||
//
|
//
|
||||||
typedef
|
typedef
|
||||||
INT32
|
INT32
|
||||||
(*NT_NET_INITIALIZE) (
|
(*NT_NET_INITIALIZE) (
|
||||||
IN OUT UINT32 *InterfaceCount,
|
IN OUT UINT32 *InterfaceCount,
|
||||||
IN OUT NT_NET_INTERFACE_INFO * InterfaceInfoBuffer
|
IN OUT NT_NET_INTERFACE_INFO * InterfaceInfoBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
INT32
|
INT32
|
||||||
(*NT_NET_FINALIZE) (
|
(*NT_NET_FINALIZE) (
|
||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
INT32
|
INT32
|
||||||
(*NT_NET_SET_RECEIVE_FILTER) (
|
(*NT_NET_SET_RECEIVE_FILTER) (
|
||||||
IN UINT32 Index,
|
IN UINT32 Index,
|
||||||
IN UINT32 EnableFilter,
|
IN UINT32 EnableFilter,
|
||||||
IN UINT32 MCastFilterCnt,
|
IN UINT32 MCastFilterCnt,
|
||||||
IN EFI_MAC_ADDRESS * MCastFilter
|
IN EFI_MAC_ADDRESS * MCastFilter
|
||||||
);
|
);
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
INT32
|
INT32
|
||||||
(*NT_NET_RECEIVE) (
|
(*NT_NET_RECEIVE) (
|
||||||
IN UINT32 Index,
|
IN UINT32 Index,
|
||||||
IN OUT UINT32 *BufferSize,
|
IN OUT UINT32 *BufferSize,
|
||||||
OUT VOID *Buffer
|
OUT VOID *Buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
INT32
|
INT32
|
||||||
(*NT_NET_TRANSMIT) (
|
(*NT_NET_TRANSMIT) (
|
||||||
IN UINT32 Index,
|
IN UINT32 Index,
|
||||||
IN UINT32 HeaderSize,
|
IN UINT32 HeaderSize,
|
||||||
IN UINT32 BufferSize,
|
IN UINT32 BufferSize,
|
||||||
IN VOID *Buffer,
|
IN VOID *Buffer,
|
||||||
IN EFI_MAC_ADDRESS * SrcAddr,
|
IN EFI_MAC_ADDRESS * SrcAddr,
|
||||||
IN EFI_MAC_ADDRESS * DestAddr,
|
IN EFI_MAC_ADDRESS * DestAddr,
|
||||||
IN UINT16 *Protocol
|
IN UINT16 *Protocol
|
||||||
);
|
);
|
||||||
|
|
||||||
typedef struct _NT_NET_UTILITY_TABLE {
|
typedef struct _NT_NET_UTILITY_TABLE {
|
||||||
NT_NET_INITIALIZE Initialize;
|
NT_NET_INITIALIZE Initialize;
|
||||||
NT_NET_FINALIZE Finalize;
|
NT_NET_FINALIZE Finalize;
|
||||||
NT_NET_SET_RECEIVE_FILTER SetReceiveFilter;
|
NT_NET_SET_RECEIVE_FILTER SetReceiveFilter;
|
||||||
NT_NET_RECEIVE Receive;
|
NT_NET_RECEIVE Receive;
|
||||||
NT_NET_TRANSMIT Transmit;
|
NT_NET_TRANSMIT Transmit;
|
||||||
} NT_NET_UTILITY_TABLE;
|
} NT_NET_UTILITY_TABLE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Private functions
|
// Private functions
|
||||||
//
|
//
|
||||||
typedef
|
typedef
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
(*SNPNT32_INITIALIZE_GLOBAL_DATA) (
|
(*SNPNT32_INITIALIZE_GLOBAL_DATA) (
|
||||||
IN SNPNT32_GLOBAL_DATA * This
|
IN SNPNT32_GLOBAL_DATA * This
|
||||||
);
|
);
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
(*SNPNT32_INITIALIZE_INSTANCE_DATA) (
|
(*SNPNT32_INITIALIZE_INSTANCE_DATA) (
|
||||||
IN SNPNT32_GLOBAL_DATA * This,
|
IN SNPNT32_GLOBAL_DATA * This,
|
||||||
IN SNPNT32_INSTANCE_DATA * Instance
|
IN SNPNT32_INSTANCE_DATA * Instance
|
||||||
);
|
);
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
(*SNPNT32_CLOSE_INSTANCE) (
|
(*SNPNT32_CLOSE_INSTANCE) (
|
||||||
IN SNPNT32_GLOBAL_DATA * This,
|
IN SNPNT32_GLOBAL_DATA * This,
|
||||||
IN SNPNT32_INSTANCE_DATA * Instance
|
IN SNPNT32_INSTANCE_DATA * Instance
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Global data for this driver
|
// Global data for this driver
|
||||||
//
|
//
|
||||||
#define SNP_NT32_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('W', 'S', 'N', 'P')
|
#define SNP_NT32_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('W', 'S', 'N', 'P')
|
||||||
|
|
||||||
typedef struct _SNPNT32_GLOBAL_DATA {
|
typedef struct _SNPNT32_GLOBAL_DATA {
|
||||||
UINT32 Signature;
|
UINT32 Signature;
|
||||||
|
|
||||||
//
|
//
|
||||||
// List for all the fake SNP instance
|
// List for all the fake SNP instance
|
||||||
//
|
//
|
||||||
NET_LIST_ENTRY InstanceList;
|
NET_LIST_ENTRY InstanceList;
|
||||||
|
|
||||||
EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
|
EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
|
||||||
HMODULE NetworkLibraryHandle;
|
HMODULE NetworkLibraryHandle;
|
||||||
|
|
||||||
NT_NET_UTILITY_TABLE NtNetUtilityTable;
|
NT_NET_UTILITY_TABLE NtNetUtilityTable;
|
||||||
|
|
||||||
NET_LOCK Lock;
|
NET_LOCK Lock;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Private functions
|
// Private functions
|
||||||
//
|
//
|
||||||
SNPNT32_INITIALIZE_GLOBAL_DATA InitializeGlobalData;
|
SNPNT32_INITIALIZE_GLOBAL_DATA InitializeGlobalData;
|
||||||
SNPNT32_INITIALIZE_INSTANCE_DATA InitializeInstanceData;
|
SNPNT32_INITIALIZE_INSTANCE_DATA InitializeInstanceData;
|
||||||
SNPNT32_CLOSE_INSTANCE CloseInstance;
|
SNPNT32_CLOSE_INSTANCE CloseInstance;
|
||||||
} SNPNT32_GLOBAL_DATA;
|
} SNPNT32_GLOBAL_DATA;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Instance data for each fake SNP instance
|
// Instance data for each fake SNP instance
|
||||||
//
|
//
|
||||||
#define SNP_NT32_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('w', 'S', 'N', 'P')
|
#define SNP_NT32_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('w', 'S', 'N', 'P')
|
||||||
|
|
||||||
typedef struct _SNPNT32_INSTANCE_DATA {
|
typedef struct _SNPNT32_INSTANCE_DATA {
|
||||||
UINT32 Signature;
|
UINT32 Signature;
|
||||||
|
|
||||||
//
|
//
|
||||||
// List entry use for linking with other instance
|
// List entry use for linking with other instance
|
||||||
//
|
//
|
||||||
NET_LIST_ENTRY Entry;
|
NET_LIST_ENTRY Entry;
|
||||||
|
|
||||||
SNPNT32_GLOBAL_DATA *GlobalData;
|
SNPNT32_GLOBAL_DATA *GlobalData;
|
||||||
|
|
||||||
EFI_HANDLE DeviceHandle;
|
EFI_HANDLE DeviceHandle;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||||
|
|
||||||
EFI_SIMPLE_NETWORK_PROTOCOL Snp;
|
EFI_SIMPLE_NETWORK_PROTOCOL Snp;
|
||||||
EFI_SIMPLE_NETWORK_MODE Mode;
|
EFI_SIMPLE_NETWORK_MODE Mode;
|
||||||
|
|
||||||
NT_NET_INTERFACE_INFO InterfaceInfo;
|
NT_NET_INTERFACE_INFO InterfaceInfo;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Private functions
|
// Private functions
|
||||||
//
|
//
|
||||||
} SNPNT32_INSTANCE_DATA;
|
} SNPNT32_INSTANCE_DATA;
|
||||||
|
|
||||||
#define SNP_NT32_INSTANCE_DATA_FROM_SNP_THIS(a) \
|
#define SNP_NT32_INSTANCE_DATA_FROM_SNP_THIS(a) \
|
||||||
CR ( \
|
CR ( \
|
||||||
a, \
|
a, \
|
||||||
SNPNT32_INSTANCE_DATA, \
|
SNPNT32_INSTANCE_DATA, \
|
||||||
Snp, \
|
Snp, \
|
||||||
SNP_NT32_INSTANCE_SIGNATURE \
|
SNP_NT32_INSTANCE_SIGNATURE \
|
||||||
)
|
)
|
||||||
|
|
||||||
extern EFI_DRIVER_BINDING_PROTOCOL gSnpNt32DriverBinding;
|
extern EFI_DRIVER_BINDING_PROTOCOL gSnpNt32DriverBinding;
|
||||||
extern EFI_COMPONENT_NAME_PROTOCOL gSnpNt32DriverComponentName;
|
extern EFI_COMPONENT_NAME_PROTOCOL gSnpNt32DriverComponentName;
|
||||||
|
extern EFI_COMPONENT_NAME2_PROTOCOL gSnpNt32DriverComponentName2;
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
EFI_STATUS
|
||||||
SnpNt32DriverBindingSupported (
|
EFIAPI
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL * This,
|
SnpNt32DriverBindingSupported (
|
||||||
IN EFI_HANDLE ControllerHandle,
|
IN EFI_DRIVER_BINDING_PROTOCOL * This,
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
|
IN EFI_HANDLE ControllerHandle,
|
||||||
);
|
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
|
||||||
|
);
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
EFI_STATUS
|
||||||
SnpNt32DriverBindingStart (
|
EFIAPI
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL * This,
|
SnpNt32DriverBindingStart (
|
||||||
IN EFI_HANDLE ControllerHandle,
|
IN EFI_DRIVER_BINDING_PROTOCOL * This,
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
|
IN EFI_HANDLE ControllerHandle,
|
||||||
);
|
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
|
||||||
|
);
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
EFI_STATUS
|
||||||
SnpNt32DriverBindingStop (
|
EFIAPI
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
SnpNt32DriverBindingStop (
|
||||||
IN EFI_HANDLE ControllerHandle,
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||||
IN UINTN NumberOfChildren,
|
IN EFI_HANDLE ControllerHandle,
|
||||||
IN EFI_HANDLE *ChildHandleBuffer
|
IN UINTN NumberOfChildren,
|
||||||
);
|
IN EFI_HANDLE *ChildHandleBuffer
|
||||||
|
);
|
||||||
EFI_STATUS
|
|
||||||
SnpNt32InitializeGlobalData (
|
EFI_STATUS
|
||||||
IN SNPNT32_GLOBAL_DATA *This
|
SnpNt32InitializeGlobalData (
|
||||||
);
|
IN SNPNT32_GLOBAL_DATA *This
|
||||||
|
);
|
||||||
EFI_STATUS
|
|
||||||
SnpNt32InitializeInstanceData (
|
EFI_STATUS
|
||||||
IN SNPNT32_GLOBAL_DATA *This,
|
SnpNt32InitializeInstanceData (
|
||||||
IN SNPNT32_INSTANCE_DATA *Instance
|
IN SNPNT32_GLOBAL_DATA *This,
|
||||||
);
|
IN SNPNT32_INSTANCE_DATA *Instance
|
||||||
|
);
|
||||||
EFI_STATUS
|
|
||||||
SnpNt32CloseInstance (
|
EFI_STATUS
|
||||||
IN SNPNT32_GLOBAL_DATA *This,
|
SnpNt32CloseInstance (
|
||||||
IN SNPNT32_INSTANCE_DATA *Instance
|
IN SNPNT32_GLOBAL_DATA *This,
|
||||||
);
|
IN SNPNT32_INSTANCE_DATA *Instance
|
||||||
|
);
|
||||||
#endif
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue