/** @file
HII Config Access protocol implementation of VLAN configuration module.
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
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<BR>
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "VlanConfigImpl.h"
{
}
};
{
{
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
}
},
};
/**
This function allows a caller to extract the current configuration for one
or more named elements from the target driver.
@param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
@param[in] Request A null-terminated Unicode string in
<ConfigRequest> format.
@param[out] Progress On return, points to a character in the Request
string. Points to the string's null terminator if
request was successful. Points to the most recent
the beginning of the string if the failure is in
successful.
@param[out] Results A null-terminated Unicode string in
<ConfigAltResp> format which has all values filled
in for the names in the Request string. String to
be allocated by the called function.
@retval EFI_SUCCESS The Results is filled with the requested values.
@retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
@retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
@retval EFI_NOT_FOUND Routing data doesn't match any storage in this
driver.
**/
)
{
return EFI_INVALID_PARAMETER;
}
if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &gVlanConfigFormSetGuid, mVlanStorageName)) {
return EFI_NOT_FOUND;
}
Size = 0;
//
// Retrieve the pointer to the UEFI HII Config Routing Protocol
//
if (mHiiConfigRouting == NULL) {
}
//
// Convert buffer data to <ConfigResp> by helper function BlockToConfig()
//
BufferSize = sizeof (Configuration);
//
// Request has no request element, construct full request string.
// Allocate and fill a buffer large enough to hold the <ConfigHdr> template
// followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
//
ConfigRequestHdr = HiiConstructConfigHdr (&gVlanConfigFormSetGuid, mVlanStorageName, PrivateData->DriverHandle);
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
}
(UINT8 *) &Configuration,
);
//
// Free the allocated config request string.
//
if (AllocatedRequest) {
}
//
// Set Progress string to the original request string.
//
}
return Status;
}
/**
This function processes the results of changes in configuration.
@param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
@param[in] Configuration A null-terminated Unicode string in <ConfigResp>
format.
@param[out] Progress A pointer to a string filled in with the offset of
the most recent '&' before the first failing
the terminating NULL if all was successful.
@retval EFI_SUCCESS The Results is processed successfully.
@retval EFI_INVALID_PARAMETER Configuration is NULL.
@retval EFI_NOT_FOUND Routing data doesn't match any storage in this
driver.
**/
)
{
return EFI_INVALID_PARAMETER;
}
return EFI_NOT_FOUND;
}
return EFI_SUCCESS;
}
/**
This function processes the results of changes in configuration.
@param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
@param[in] Action Specifies the type of action taken by the browser.
@param[in] QuestionId A unique value which is sent to the original
exporting driver so that it can identify the type
of data to expect.
@param[in] Type The type of value for the question.
@param[in] Value A pointer to the data being sent to the original
exporting driver.
@param[out] ActionRequest On return, points to the action requested by the
callback function.
@retval EFI_SUCCESS The callback successfully handled the action.
@retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
variable and its data.
@retval EFI_DEVICE_ERROR The variable could not be saved.
@retval EFI_UNSUPPORTED The specified Action is not supported by the
callback.
**/
)
{
return EFI_SUCCESS;
}
//
// All other action return unsupported.
//
return EFI_UNSUPPORTED;
}
//
// Get Browser data
//
HiiGetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration);
if (Action == EFI_BROWSER_ACTION_CHANGED) {
switch (QuestionId) {
case VLAN_ADD_QUESTION_ID:
//
// Add a VLAN
//
//
// Connect the newly created VLAN device
//
if (VlanHandle == NULL) {
//
// There may be no child handle created for VLAN ID 0, connect the parent handle
//
}
//
// Clear UI data
//
Configuration->VlanId = 0;
Configuration->Priority = 0;
break;
case VLAN_REMOVE_QUESTION_ID:
//
// Remove VLAN
//
//
// Checkbox is selected, need remove this VLAN
//
}
}
if (PrivateData->NumberOfVlan == 0) {
//
// No VLAN device now, connect the physical NIC handle.
// Note: PrivateData->NumberOfVlan has been updated by VlanUpdateForm()
//
}
break;
default:
break;
}
} else if (Action == EFI_BROWSER_ACTION_CHANGING) {
switch (QuestionId) {
case VLAN_UPDATE_QUESTION_ID:
//
// Update current VLAN list into Form.
//
break;
default:
break;
}
}
HiiSetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration, NULL);
return EFI_SUCCESS;
}
/**
This function update VLAN list in the VLAN configuration Form.
@param[in, out] PrivateData Points to VLAN configuration private data.
**/
)
{
//
// Find current VLAN configuration
//
NumberOfVlan = 0;
//
// Update VLAN configuration in PrivateData
//
if (NumberOfVlan > MAX_VLAN_NUMBER) {
}
//
// Init OpCode Handle
//
//
// Create Hii Extend Label OpCode as the start opcode
//
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
//
// Create Hii Extend Label OpCode as the end opcode
//
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
String += 10;
//
// Pad VlanId string up to 4 characters with space
//
String += 4;
String += 11;
*String = 0;
0,
0,
);
//
// Save VLAN id to private data
//
}
&gVlanConfigFormSetGuid, // Formset GUID
VLAN_CONFIGURATION_FORM_ID, // Form ID
StartOpCodeHandle, // Label for where to insert opcodes
EndOpCodeHandle // Replace data
);
}
}
/**
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
device.
@param[in, out] PrivateData Points to VLAN configuration private data.
@retval EFI_SUCCESS HII Form is installed for this network device.
@retval EFI_OUT_OF_RESOURCES Not enough resource for HII Form installation.
@retval Others Other errors as indicated.
**/
)
{
//
// Create child handle and install HII Config Access Protocol
//
);
if (ChildDevicePath == NULL) {
return EFI_OUT_OF_RESOURCES;
}
DriverHandle = NULL;
);
return Status;
}
//
// Publish the HII package list
//
);
return EFI_OUT_OF_RESOURCES;
}
//
// Update formset title help string.
//
return Status;
}
Str,
);
//
// Update form title help string.
//
Str,
);
return EFI_SUCCESS;
}
/**
This function remove the VLAN configuration Form for a network device. The
child handle for HII Config Access protocol will be destroyed.
@param[in, out] PrivateData Points to VLAN configuration private data.
**/
)
{
//
// Free MAC string
//
}
//
// Uninstall HII package list
//
}
//
// Uninstall HII Config Access Protocol
//
);
}
}
}