NetworkPkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the NetworkPkg package

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:07 -08:00
committed by mergify[bot]
parent 2f88bd3a12
commit d1050b9dff
294 changed files with 29888 additions and 30440 deletions

View File

@@ -11,7 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// EFI Component Name Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gVlanConfigComponentName = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gVlanConfigComponentName = {
VlanConfigComponentNameGetDriverName,
VlanConfigComponentNameGetControllerName,
"eng"
@@ -21,12 +21,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gVlanConfigComponent
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gVlanConfigComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) VlanConfigComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) VlanConfigComponentNameGetControllerName,
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)VlanConfigComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)VlanConfigComponentNameGetControllerName,
"en"
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mVlanConfigDriverNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mVlanConfigDriverNameTable[] = {
{
"eng;en",
L"VLAN Configuration Driver"
@@ -78,9 +78,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mVlanConfigDriverNam
EFI_STATUS
EFIAPI
VlanConfigComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
{
return LookupUnicodeString2 (
@@ -153,11 +153,11 @@ VlanConfigComponentNameGetDriverName (
EFI_STATUS
EFIAPI
VlanConfigComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
return EFI_UNSUPPORTED;

View File

@@ -8,7 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "VlanConfigImpl.h"
EFI_DRIVER_BINDING_PROTOCOL gVlanConfigDriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gVlanConfigDriverBinding = {
VlanConfigDriverBindingSupported,
VlanConfigDriverBindingStart,
VlanConfigDriverBindingStop,
@@ -31,8 +31,8 @@ EFI_DRIVER_BINDING_PROTOCOL gVlanConfigDriverBinding = {
EFI_STATUS
EFIAPI
VlanConfigDriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EfiLibInstallDriverBindingComponentName2 (
@@ -45,7 +45,6 @@ VlanConfigDriverEntryPoint (
);
}
/**
Test to see if this driver supports ControllerHandle.
@@ -62,9 +61,9 @@ VlanConfigDriverEntryPoint (
EFI_STATUS
EFIAPI
VlanConfigDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
EFI_STATUS Status;
@@ -73,7 +72,7 @@ VlanConfigDriverBindingSupported (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiVlanConfigProtocolGuid,
(VOID **) &VlanConfig,
(VOID **)&VlanConfig,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -95,7 +94,6 @@ VlanConfigDriverBindingSupported (
return Status;
}
/**
Start this driver on ControllerHandle.
@@ -112,9 +110,9 @@ VlanConfigDriverBindingSupported (
EFI_STATUS
EFIAPI
VlanConfigDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
EFI_STATUS Status;
@@ -128,7 +126,7 @@ VlanConfigDriverBindingStart (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiCallerIdGuid,
(VOID **) &PrivateData,
(VOID **)&PrivateData,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -143,7 +141,7 @@ VlanConfigDriverBindingStart (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiVlanConfigProtocolGuid,
(VOID **) &VlanConfig,
(VOID **)&VlanConfig,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -158,7 +156,7 @@ VlanConfigDriverBindingStart (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiDevicePathProtocolGuid,
(VOID **) &DevicePath,
(VOID **)&DevicePath,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -176,9 +174,9 @@ VlanConfigDriverBindingStart (
goto ErrorExit;
}
PrivateData->ImageHandle = This->DriverBindingHandle;
PrivateData->ImageHandle = This->DriverBindingHandle;
PrivateData->ControllerHandle = ControllerHandle;
PrivateData->VlanConfig = VlanConfig;
PrivateData->VlanConfig = VlanConfig;
PrivateData->ParentDevicePath = DevicePath;
//
@@ -201,6 +199,7 @@ VlanConfigDriverBindingStart (
if (EFI_ERROR (Status)) {
goto ErrorExit;
}
return Status;
ErrorExit:
@@ -226,7 +225,6 @@ ErrorExit:
return Status;
}
/**
Stop this driver on ControllerHandle.
@@ -243,10 +241,10 @@ ErrorExit:
EFI_STATUS
EFIAPI
VlanConfigDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
@@ -258,7 +256,7 @@ VlanConfigDriverBindingStop (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiCallerIdGuid,
(VOID **) &PrivateData,
(VOID **)&PrivateData,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -266,10 +264,11 @@ VlanConfigDriverBindingStop (
if (EFI_ERROR (Status)) {
return Status;
}
ASSERT (PrivateData->Signature == VLAN_CONFIG_PRIVATE_DATA_SIGNATURE);
if (NumberOfChildren != 0) {
if (NumberOfChildren != 1 || ChildHandleBuffer[0] != PrivateData->DriverHandle) {
if ((NumberOfChildren != 1) || (ChildHandleBuffer[0] != PrivateData->DriverHandle)) {
return EFI_DEVICE_ERROR;
}

View File

@@ -8,10 +8,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "VlanConfigImpl.h"
CHAR16 mVlanStorageName[] = L"VlanNvData";
EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting = NULL;
CHAR16 mVlanStorageName[] = L"VlanNvData";
EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting = NULL;
VLAN_CONFIG_PRIVATE_DATA mVlanConfigPrivateDateTemplate = {
VLAN_CONFIG_PRIVATE_DATA mVlanConfigPrivateDateTemplate = {
VLAN_CONFIG_PRIVATE_DATA_SIGNATURE,
{
VlanExtractConfig,
@@ -20,13 +20,13 @@ VLAN_CONFIG_PRIVATE_DATA mVlanConfigPrivateDateTemplate = {
}
};
VENDOR_DEVICE_PATH mHiiVendorDevicePathNode = {
VENDOR_DEVICE_PATH mHiiVendorDevicePathNode = {
{
HARDWARE_DEVICE_PATH,
HW_VENDOR_DP,
{
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
(UINT8)(sizeof (VENDOR_DEVICE_PATH)),
(UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
}
},
VLAN_CONFIG_FORM_SET_GUID
@@ -61,22 +61,22 @@ VENDOR_DEVICE_PATH mHiiVendorDevicePathNode = {
EFI_STATUS
EFIAPI
VlanExtractConfig (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Request,
OUT EFI_STRING *Progress,
OUT EFI_STRING *Results
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Request,
OUT EFI_STRING *Progress,
OUT EFI_STRING *Results
)
{
EFI_STATUS Status;
UINTN BufferSize;
VLAN_CONFIGURATION Configuration;
EFI_STATUS Status;
UINTN BufferSize;
VLAN_CONFIGURATION Configuration;
VLAN_CONFIG_PRIVATE_DATA *PrivateData;
EFI_STRING ConfigRequestHdr;
EFI_STRING ConfigRequest;
BOOLEAN AllocatedRequest;
UINTN Size;
EFI_STRING ConfigRequestHdr;
EFI_STRING ConfigRequest;
BOOLEAN AllocatedRequest;
UINTN Size;
if (Progress == NULL || Results == NULL) {
if ((Progress == NULL) || (Results == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -94,8 +94,9 @@ VlanExtractConfig (
// Retrieve the pointer to the UEFI HII Config Routing Protocol
//
if (mHiiConfigRouting == NULL) {
gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **) &mHiiConfigRouting);
gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **)&mHiiConfigRouting);
}
ASSERT (mHiiConfigRouting != NULL);
//
@@ -103,7 +104,7 @@ VlanExtractConfig (
//
PrivateData = VLAN_CONFIG_PRIVATE_DATA_FROM_THIS (This);
ZeroMem (&Configuration, sizeof (VLAN_CONFIGURATION));
BufferSize = sizeof (Configuration);
BufferSize = sizeof (Configuration);
ConfigRequest = Request;
if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
//
@@ -112,8 +113,8 @@ VlanExtractConfig (
// followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
//
ConfigRequestHdr = HiiConstructConfigHdr (&gVlanConfigFormSetGuid, mVlanStorageName, PrivateData->DriverHandle);
Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
ConfigRequest = AllocateZeroPool (Size);
Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
ConfigRequest = AllocateZeroPool (Size);
ASSERT (ConfigRequest != NULL);
AllocatedRequest = TRUE;
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
@@ -123,7 +124,7 @@ VlanExtractConfig (
Status = mHiiConfigRouting->BlockToConfig (
mHiiConfigRouting,
ConfigRequest,
(UINT8 *) &Configuration,
(UINT8 *)&Configuration,
BufferSize,
Results,
Progress
@@ -135,6 +136,7 @@ VlanExtractConfig (
FreePool (ConfigRequest);
ConfigRequest = NULL;
}
//
// Set Progress string to the original request string.
//
@@ -147,7 +149,6 @@ VlanExtractConfig (
return Status;
}
/**
This function processes the results of changes in configuration.
@@ -169,12 +170,12 @@ VlanExtractConfig (
EFI_STATUS
EFIAPI
VlanRouteConfig (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Configuration,
OUT EFI_STRING *Progress
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Configuration,
OUT EFI_STRING *Progress
)
{
if (Configuration == NULL || Progress == NULL) {
if ((Configuration == NULL) || (Progress == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -212,12 +213,12 @@ VlanRouteConfig (
EFI_STATUS
EFIAPI
VlanCallback (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN EFI_BROWSER_ACTION Action,
IN EFI_QUESTION_ID QuestionId,
IN UINT8 Type,
IN EFI_IFR_TYPE_VALUE *Value,
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN EFI_BROWSER_ACTION Action,
IN EFI_QUESTION_ID QuestionId,
IN UINT8 Type,
IN EFI_IFR_TYPE_VALUE *Value,
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
)
{
VLAN_CONFIG_PRIVATE_DATA *PrivateData;
@@ -244,89 +245,89 @@ VlanCallback (
//
Configuration = AllocateZeroPool (sizeof (VLAN_CONFIGURATION));
ASSERT (Configuration != NULL);
HiiGetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration);
HiiGetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *)Configuration);
VlanConfig = PrivateData->VlanConfig;
if (Action == EFI_BROWSER_ACTION_CHANGED) {
switch (QuestionId) {
case VLAN_ADD_QUESTION_ID:
//
// Add a VLAN
//
VlanConfig->Set (VlanConfig, Configuration->VlanId, Configuration->Priority);
VlanUpdateForm (PrivateData);
//
// Connect the newly created VLAN device
//
VlanHandle = NetLibGetVlanHandle (PrivateData->ControllerHandle, Configuration->VlanId);
if (VlanHandle == NULL) {
case VLAN_ADD_QUESTION_ID:
//
// There may be no child handle created for VLAN ID 0, connect the parent handle
// Add a VLAN
//
VlanHandle = PrivateData->ControllerHandle;
}
gBS->ConnectController (VlanHandle, NULL, NULL, TRUE);
VlanConfig->Set (VlanConfig, Configuration->VlanId, Configuration->Priority);
VlanUpdateForm (PrivateData);
//
// Clear UI data
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
Configuration->VlanId = 0;
Configuration->Priority = 0;
break;
case VLAN_REMOVE_QUESTION_ID:
//
// Remove VLAN
//
ASSERT (PrivateData->NumberOfVlan <= MAX_VLAN_NUMBER);
for (Index = 0; Index < PrivateData->NumberOfVlan; Index++) {
if (Configuration->VlanList[Index] != 0) {
//
// Connect the newly created VLAN device
//
VlanHandle = NetLibGetVlanHandle (PrivateData->ControllerHandle, Configuration->VlanId);
if (VlanHandle == NULL) {
//
// Checkbox is selected, need remove this VLAN
// There may be no child handle created for VLAN ID 0, connect the parent handle
//
VlanConfig->Remove (VlanConfig, PrivateData->VlanId[Index]);
VlanHandle = PrivateData->ControllerHandle;
}
}
VlanUpdateForm (PrivateData);
if (PrivateData->NumberOfVlan == 0) {
gBS->ConnectController (VlanHandle, NULL, NULL, TRUE);
//
// No VLAN device now, connect the physical NIC handle.
// Note: PrivateData->NumberOfVlan has been updated by VlanUpdateForm()
// Clear UI data
//
gBS->ConnectController (PrivateData->ControllerHandle, NULL, NULL, TRUE);
}
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
Configuration->VlanId = 0;
Configuration->Priority = 0;
break;
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
ZeroMem (Configuration->VlanList, MAX_VLAN_NUMBER);
break;
case VLAN_REMOVE_QUESTION_ID:
//
// Remove VLAN
//
ASSERT (PrivateData->NumberOfVlan <= MAX_VLAN_NUMBER);
for (Index = 0; Index < PrivateData->NumberOfVlan; Index++) {
if (Configuration->VlanList[Index] != 0) {
//
// Checkbox is selected, need remove this VLAN
//
VlanConfig->Remove (VlanConfig, PrivateData->VlanId[Index]);
}
}
default:
break;
VlanUpdateForm (PrivateData);
if (PrivateData->NumberOfVlan == 0) {
//
// No VLAN device now, connect the physical NIC handle.
// Note: PrivateData->NumberOfVlan has been updated by VlanUpdateForm()
//
gBS->ConnectController (PrivateData->ControllerHandle, NULL, NULL, TRUE);
}
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
ZeroMem (Configuration->VlanList, MAX_VLAN_NUMBER);
break;
default:
break;
}
} else if (Action == EFI_BROWSER_ACTION_CHANGING) {
switch (QuestionId) {
case VLAN_UPDATE_QUESTION_ID:
//
// Update current VLAN list into Form.
//
VlanUpdateForm (PrivateData);
break;
case VLAN_UPDATE_QUESTION_ID:
//
// Update current VLAN list into Form.
//
VlanUpdateForm (PrivateData);
break;
default:
break;
default:
break;
}
}
HiiSetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration, NULL);
HiiSetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *)Configuration, NULL);
FreePool (Configuration);
return EFI_SUCCESS;
}
/**
This function update VLAN list in the VLAN configuration Form.
@@ -335,7 +336,7 @@ VlanCallback (
**/
VOID
VlanUpdateForm (
IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
)
{
EFI_VLAN_CONFIG_PROTOCOL *VlanConfig;
@@ -355,9 +356,9 @@ VlanUpdateForm (
//
// Find current VLAN configuration
//
VlanData = NULL;
VlanData = NULL;
NumberOfVlan = 0;
VlanConfig = PrivateData->VlanConfig;
VlanConfig = PrivateData->VlanConfig;
VlanConfig->Find (VlanConfig, NULL, &NumberOfVlan, &VlanData);
//
@@ -366,6 +367,7 @@ VlanUpdateForm (
if (NumberOfVlan > MAX_VLAN_NUMBER) {
NumberOfVlan = MAX_VLAN_NUMBER;
}
PrivateData->NumberOfVlan = NumberOfVlan;
//
@@ -380,24 +382,24 @@ VlanUpdateForm (
//
// Create Hii Extend Label OpCode as the start opcode
//
StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
StartOpCodeHandle,
&gEfiIfrTianoGuid,
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
StartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
StartOpCodeHandle,
&gEfiIfrTianoGuid,
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
StartLabel->Number = LABEL_VLAN_LIST;
//
// Create Hii Extend Label OpCode as the end opcode
//
EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
EndOpCodeHandle,
&gEfiIfrTianoGuid,
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
EndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
EndOpCodeHandle,
&gEfiIfrTianoGuid,
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
EndLabel->Number = LABEL_END;
@@ -416,7 +418,7 @@ VlanUpdateForm (
StrCpyS (String + 4 - DigitalCount, (sizeof (VlanStr) /sizeof (CHAR16)) - 10 - (4 - DigitalCount), VlanIdStr);
String += 4;
StrCpyS (String, (sizeof (VlanStr) /sizeof (CHAR16)) - 10 - (4 - DigitalCount) - 4, L", Priority:");
StrCpyS (String, (sizeof (VlanStr) /sizeof (CHAR16)) - 10 - (4 - DigitalCount) - 4, L", Priority:");
String += 11;
UnicodeValueToStringS (
String,
@@ -433,9 +435,9 @@ VlanUpdateForm (
HiiCreateCheckBoxOpCode (
StartOpCodeHandle,
(EFI_QUESTION_ID) (VLAN_LIST_VAR_OFFSET + Index),
(EFI_QUESTION_ID)(VLAN_LIST_VAR_OFFSET + Index),
VLAN_CONFIGURATION_VARSTORE_ID,
(UINT16) (VLAN_LIST_VAR_OFFSET + Index),
(UINT16)(VLAN_LIST_VAR_OFFSET + Index),
StringId,
STRING_TOKEN (STR_VLAN_VLAN_LIST_HELP),
0,
@@ -465,7 +467,6 @@ VlanUpdateForm (
}
}
/**
This function publish the VLAN configuration Form for a network device. The
HII Config Access protocol will be installed on a child handle of the network
@@ -480,7 +481,7 @@ VlanUpdateForm (
**/
EFI_STATUS
InstallVlanConfigForm (
IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
)
{
EFI_STATUS Status;
@@ -497,26 +498,28 @@ InstallVlanConfigForm (
//
ChildDevicePath = AppendDevicePathNode (
PrivateData->ParentDevicePath,
(CONST EFI_DEVICE_PATH_PROTOCOL *) &mHiiVendorDevicePathNode
(CONST EFI_DEVICE_PATH_PROTOCOL *)&mHiiVendorDevicePathNode
);
if (ChildDevicePath == NULL) {
return EFI_OUT_OF_RESOURCES;
}
PrivateData->ChildDevicePath = ChildDevicePath;
DriverHandle = NULL;
ConfigAccess = &PrivateData->ConfigAccess;
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverHandle,
&gEfiDevicePathProtocolGuid,
ChildDevicePath,
&gEfiHiiConfigAccessProtocolGuid,
ConfigAccess,
NULL
);
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverHandle,
&gEfiDevicePathProtocolGuid,
ChildDevicePath,
&gEfiHiiConfigAccessProtocolGuid,
ConfigAccess,
NULL
);
if (EFI_ERROR (Status)) {
return Status;
}
PrivateData->DriverHandle = DriverHandle;
//
@@ -548,16 +551,18 @@ InstallVlanConfigForm (
if (HiiHandle == NULL) {
return EFI_OUT_OF_RESOURCES;
}
PrivateData->HiiHandle = HiiHandle;
//
// Update formset title help string.
//
MacString = NULL;
Status = NetLibGetMacString (PrivateData->ControllerHandle, PrivateData->ImageHandle, &MacString);
Status = NetLibGetMacString (PrivateData->ControllerHandle, PrivateData->ImageHandle, &MacString);
if (EFI_ERROR (Status)) {
return Status;
}
PrivateData->MacString = MacString;
StrCpyS (Str, sizeof (Str) / sizeof (CHAR16), L"VLAN Configuration (MAC:");
@@ -595,11 +600,11 @@ InstallVlanConfigForm (
**/
EFI_STATUS
UninstallVlanConfigForm (
IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
)
{
EFI_STATUS Status;
EFI_VLAN_CONFIG_PROTOCOL *VlanConfig;
EFI_STATUS Status;
EFI_VLAN_CONFIG_PROTOCOL *VlanConfig;
//
// End the parent-child relationship.
@@ -637,6 +642,7 @@ UninstallVlanConfigForm (
);
return Status;
}
PrivateData->DriverHandle = NULL;
if (PrivateData->ChildDevicePath != NULL) {
@@ -660,5 +666,6 @@ UninstallVlanConfigForm (
HiiRemovePackages (PrivateData->HiiHandle);
PrivateData->HiiHandle = NULL;
}
return EFI_SUCCESS;
}

View File

@@ -32,40 +32,39 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "VlanConfigNvData.h"
extern EFI_COMPONENT_NAME2_PROTOCOL gVlanConfigComponentName2;
extern EFI_COMPONENT_NAME_PROTOCOL gVlanConfigComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gVlanConfigComponentName2;
extern EFI_COMPONENT_NAME_PROTOCOL gVlanConfigComponentName;
//
// Tool generated IFR binary data and String package data
//
extern UINT8 VlanConfigBin[];
extern UINT8 VlanConfigDxeStrings[];
extern UINT8 VlanConfigBin[];
extern UINT8 VlanConfigDxeStrings[];
#define VLAN_LIST_VAR_OFFSET ((UINT16) OFFSET_OF (VLAN_CONFIGURATION, VlanList))
#define VLAN_LIST_VAR_OFFSET ((UINT16) OFFSET_OF (VLAN_CONFIGURATION, VlanList))
typedef struct {
UINTN Signature;
UINTN Signature;
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
EFI_HII_HANDLE HiiHandle;
EFI_HANDLE DriverHandle;
EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath;
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
EFI_HII_HANDLE HiiHandle;
EFI_HANDLE DriverHandle;
EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath;
EFI_HANDLE ControllerHandle;
EFI_HANDLE ImageHandle;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
EFI_VLAN_CONFIG_PROTOCOL *VlanConfig;
CHAR16 *MacString;
EFI_HANDLE ControllerHandle;
EFI_HANDLE ImageHandle;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
EFI_VLAN_CONFIG_PROTOCOL *VlanConfig;
CHAR16 *MacString;
UINT16 NumberOfVlan;
UINT16 VlanId[MAX_VLAN_NUMBER];
UINT16 NumberOfVlan;
UINT16 VlanId[MAX_VLAN_NUMBER];
} VLAN_CONFIG_PRIVATE_DATA;
#define VLAN_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('V', 'C', 'P', 'D')
#define VLAN_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('V', 'C', 'P', 'D')
#define VLAN_CONFIG_PRIVATE_DATA_FROM_THIS(a) CR (a, VLAN_CONFIG_PRIVATE_DATA, ConfigAccess, VLAN_CONFIG_PRIVATE_DATA_SIGNATURE)
extern VLAN_CONFIG_PRIVATE_DATA mVlanConfigPrivateDateTemplate;
extern VLAN_CONFIG_PRIVATE_DATA mVlanConfigPrivateDateTemplate;
/**
Retrieves a Unicode string that is the user readable name of the driver.
@@ -104,9 +103,9 @@ extern VLAN_CONFIG_PRIVATE_DATA mVlanConfigPrivateDateTemplate;
EFI_STATUS
EFIAPI
VlanConfigComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
);
/**
@@ -170,11 +169,11 @@ VlanConfigComponentNameGetDriverName (
EFI_STATUS
EFIAPI
VlanConfigComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
/**
@@ -193,9 +192,9 @@ VlanConfigComponentNameGetControllerName (
EFI_STATUS
EFIAPI
VlanConfigDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
/**
@@ -214,9 +213,9 @@ VlanConfigDriverBindingSupported (
EFI_STATUS
EFIAPI
VlanConfigDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
/**
@@ -235,10 +234,10 @@ VlanConfigDriverBindingStart (
EFI_STATUS
EFIAPI
VlanConfigDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
/**
@@ -249,7 +248,7 @@ VlanConfigDriverBindingStop (
**/
VOID
VlanUpdateForm (
IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
);
/**
@@ -266,7 +265,7 @@ VlanUpdateForm (
**/
EFI_STATUS
InstallVlanConfigForm (
IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
);
/**
@@ -281,7 +280,7 @@ InstallVlanConfigForm (
**/
EFI_STATUS
UninstallVlanConfigForm (
IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
);
/**
@@ -313,10 +312,10 @@ UninstallVlanConfigForm (
EFI_STATUS
EFIAPI
VlanExtractConfig (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Request,
OUT EFI_STRING *Progress,
OUT EFI_STRING *Results
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Request,
OUT EFI_STRING *Progress,
OUT EFI_STRING *Results
);
/**
@@ -340,9 +339,9 @@ VlanExtractConfig (
EFI_STATUS
EFIAPI
VlanRouteConfig (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Configuration,
OUT EFI_STRING *Progress
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Configuration,
OUT EFI_STRING *Progress
);
/**
@@ -370,12 +369,12 @@ VlanRouteConfig (
EFI_STATUS
EFIAPI
VlanCallback (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN EFI_BROWSER_ACTION Action,
IN EFI_QUESTION_ID QuestionId,
IN UINT8 Type,
IN EFI_IFR_TYPE_VALUE *Value,
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN EFI_BROWSER_ACTION Action,
IN EFI_QUESTION_ID QuestionId,
IN UINT8 Type,
IN EFI_IFR_TYPE_VALUE *Value,
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
);
#endif

View File

@@ -16,25 +16,25 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define VLAN_CONFIGURATION_FORM_ID 0x0001
#define VLAN_HEAD_FORM_ID 0x0002
#define VLAN_ADD_QUESTION_ID 0x1000
#define VLAN_REMOVE_QUESTION_ID 0x2000
#define VLAN_UPDATE_QUESTION_ID 0x3000
#define VLAN_ADD_QUESTION_ID 0x1000
#define VLAN_REMOVE_QUESTION_ID 0x2000
#define VLAN_UPDATE_QUESTION_ID 0x3000
#define LABEL_VLAN_LIST 0x0001
#define LABEL_END 0xffff
#define LABEL_VLAN_LIST 0x0001
#define LABEL_END 0xffff
//
// The maximum number of VLAN that will be displayed on the menu
//
#define MAX_VLAN_NUMBER 100
#define MAX_VLAN_NUMBER 100
//
// Nv Data structure referenced by IFR
//
typedef struct {
UINT16 VlanId;
UINT8 Priority;
UINT8 VlanList[MAX_VLAN_NUMBER];
UINT16 VlanId;
UINT8 Priority;
UINT8 VlanList[MAX_VLAN_NUMBER];
} VLAN_CONFIGURATION;
#endif