summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2011-04-13 06:46:08 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2011-04-13 06:46:08 +0000
commit0c66eb6d6ebaecbc64b550854b1d5f1391aa0527 (patch)
tree1e2753560d433b19c6bbf28cd812c40a3d3c2013
parenta6b8f8fc1724d458acfe7ae274e72f8374d24d03 (diff)
downloadedk2-0c66eb6d6ebaecbc64b550854b1d5f1391aa0527.zip
edk2-0c66eb6d6ebaecbc64b550854b1d5f1391aa0527.tar.gz
edk2-0c66eb6d6ebaecbc64b550854b1d5f1391aa0527.tar.bz2
sync patch r10682, r11137, r11138, r11139, r11140, r11141, r11150, r11152, r11172 from main trunk.
1. Fix bug that cursor position will change when enter newly registered HII Form after ConnectAll() in DeviceManager. Root cause is that in old code, reinstall of HII handle for DeviceManager will cause inconsistent HII handle index for newly installed HII packages by ConnectAll(), thus cause inconsistent QuestionId. FormBrowser will record QuestionId of a Form ever visited, so the cursor position is changed. 2. [BDS] Device Manager was requested to add more sub-level menu about network device. Now show menu like: Network Device List -> Mac:XX:XX:XX... -> IPv4 Network Config Mac:XX:XX:XX... VLAN Configuration 3. Move the Mac address string from the form title to form title help for the driver Ipv4 and VLAN. 4. Move the Mac address string from the form title to form title help for the driver Ipv6 5. Change the menu show in the device manager from "Network Controller Information" to "ABC Information Sample". git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/UDK2010@11532 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf1
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c661
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.h29
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerStrings.unibin11000 -> 13368 bytes
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerVfr.Vfr30
-rw-r--r--MdeModulePkg/Universal/DriverSampleDxe/inventorystrings.unibin8438 -> 8422 bytes
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxeStrings.unibin2866 -> 2982 bytes
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.c8
-rw-r--r--MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c8
-rw-r--r--MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigStrings.unibin3662 -> 3824 bytes
-rw-r--r--NetworkPkg/Ip6Dxe/Ip6ConfigNv.c8
-rw-r--r--NetworkPkg/Ip6Dxe/Ip6DxeStrings.unibin9574 -> 9694 bytes
12 files changed, 645 insertions, 100 deletions
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
index 1ed83e9..eebee40 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
@@ -150,6 +150,7 @@
gEfiSerialIoProtocolGuid ## PROTOCOL CONSUMES
gEfiDevicePathProtocolGuid ## PROTOCOL CONSUMES
gEfiDriverHealthProtocolGuid ## PROTOCOL SOMETIMES_CONSUMES
+ gEfiPciIoProtocolGuid ## PROTOCOL CONSUMES
[FeaturePcd]
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c
index a7c9ba6..d471a01 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c
@@ -32,9 +32,27 @@ DEVICE_MANAGER_CALLBACK_DATA gDeviceManagerPrivate = {
}
};
+#define MAX_MAC_ADDRESS_NODE_LIST_LEN 10
+
EFI_GUID mDeviceManagerGuid = DEVICE_MANAGER_FORMSET_GUID;
EFI_GUID mDriverHealthGuid = DRIVER_HEALTH_FORMSET_GUID;
+//
+// Which Mac Address string is select
+// it will decide what menu need to show in the NETWORK_DEVICE_FORM_ID form.
+//
+EFI_STRING mSelectedMacAddrString;
+
+//
+// Which form Id need to be show.
+//
+EFI_FORM_ID mNextShowFormId = DEVICE_MANAGER_FORM_ID;
+
+//
+// The Mac Address show in the NETWORK_DEVICE_LIST_FORM_ID
+//
+MAC_ADDRESS_NODE_LIST mMacDeviceList;
+
DEVICE_MANAGER_MENU_ITEM mDeviceManagerMenuItemTable[] = {
{ STRING_TOKEN (STR_DISK_DEVICE), EFI_DISK_DEVICE_CLASS },
{ STRING_TOKEN (STR_VIDEO_DEVICE), EFI_VIDEO_DEVICE_CLASS },
@@ -122,6 +140,8 @@ DeviceManagerCallback (
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
)
{
+ UINTN CurIndex;
+
if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)) {
//
// Do nothing for UEFI OPEN/CLOSE Action
@@ -135,6 +155,17 @@ DeviceManagerCallback (
gCallbackKey = QuestionId;
+ if ((QuestionId < MAX_KEY_SECTION_LEN + NETWORK_DEVICE_LIST_KEY_OFFSET) && (QuestionId >= NETWORK_DEVICE_LIST_KEY_OFFSET)) {
+ //
+ // If user select the mac address, need to record mac address string to support next form show.
+ //
+ for (CurIndex = 0; CurIndex < mMacDeviceList.CurListLen; CurIndex ++) {
+ if (mMacDeviceList.NodeList[CurIndex].QuestionId == QuestionId) {
+ mSelectedMacAddrString = HiiGetString (gDeviceManagerPrivate.HiiHandle, mMacDeviceList.NodeList[CurIndex].PromptId, NULL);
+ }
+ }
+ }
+
//
// Request to exit SendForm(), so as to switch to selected form
//
@@ -181,37 +212,8 @@ InitializeDeviceManager (
);
ASSERT_EFI_ERROR (Status);
- //
- // Publish our HII data
- //
- gDeviceManagerPrivate.HiiHandle = HiiAddPackages (
- &mDeviceManagerGuid,
- gDeviceManagerPrivate.DriverHandle,
- DeviceManagerVfrBin,
- BdsDxeStrings,
- NULL
- );
- if (gDeviceManagerPrivate.HiiHandle == NULL) {
- return EFI_OUT_OF_RESOURCES;
- } else {
- Status = EFI_SUCCESS;
- }
-
- //
- // Publish Driver Health HII data
- //
- gDeviceManagerPrivate.DriverHealthHiiHandle = HiiAddPackages (
- &mDeviceManagerGuid,
- gDeviceManagerPrivate.DriverHealthHandle,
- DriverHealthVfrBin,
- BdsDxeStrings,
- NULL
- );
- if (gDeviceManagerPrivate.DriverHealthHiiHandle == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- } else {
- Status = EFI_SUCCESS;
- }
+ mMacDeviceList.CurListLen = 0;
+ mMacDeviceList.MaxListLen = 0;
return Status;
}
@@ -343,6 +345,378 @@ ExtractDisplayedHiiFormFromHiiHandle (
}
/**
+ Get the mac address string from the device path.
+ if the device path has the vlan, get the vanid also.
+
+ @param MacAddressNode Device path begin with mac address
+ @param PBuffer Output string buffer contain mac address.
+
+**/
+BOOLEAN
+GetMacAddressString(
+ IN MAC_ADDR_DEVICE_PATH *MacAddressNode,
+ OUT CHAR16 **PBuffer
+ )
+{
+ UINTN HwAddressSize;
+ UINTN Index;
+ UINT8 *HwAddress;
+ EFI_DEVICE_PATH_PROTOCOL *Node;
+ UINT16 VlanId;
+ CHAR16 *String;
+ UINTN BufferLen;
+
+ VlanId = 0;
+ String = NULL;
+ ASSERT(MacAddressNode != NULL);
+
+ HwAddressSize = sizeof (EFI_MAC_ADDRESS);
+ if (MacAddressNode->IfType == 0x01 || MacAddressNode->IfType == 0x00) {
+ HwAddressSize = 6;
+ }
+
+ //
+ // The output format is MAC:XX:XX:XX:...\XXXX
+ // The size is the Number size + ":" size + Vlan size(\XXXX) + End
+ //
+ BufferLen = (4 + 2 * HwAddressSize + (HwAddressSize - 1) + 5 + 1) * sizeof (CHAR16);
+ String = AllocateZeroPool (BufferLen);
+ if (String == NULL) {
+ return FALSE;
+ }
+
+ *PBuffer = String;
+ StrCpy(String, L"MAC:");
+ String += 4;
+
+ //
+ // Convert the MAC address into a unicode string.
+ //
+ HwAddress = &MacAddressNode->MacAddress.Addr[0];
+ for (Index = 0; Index < HwAddressSize; Index++) {
+ String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, *(HwAddress++), 2);
+ if (Index < HwAddressSize - 1) {
+ *String++ = L':';
+ }
+ }
+
+ //
+ // If VLAN is configured, it will need extra 5 characters like "\0005".
+ // Plus one unicode character for the null-terminator.
+ //
+ Node = (EFI_DEVICE_PATH_PROTOCOL *)MacAddressNode;
+ while (!IsDevicePathEnd (Node)) {
+ if (Node->Type == MESSAGING_DEVICE_PATH && Node->SubType == MSG_VLAN_DP) {
+ VlanId = ((VLAN_DEVICE_PATH *) Node)->VlanId;
+ }
+ Node = NextDevicePathNode (Node);
+ }
+
+ if (VlanId != 0) {
+ *String++ = L'\\';
+ String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, VlanId, 4);
+ }
+
+ //
+ // Null terminate the Unicode string
+ //
+ *String = L'\0';
+
+ return TRUE;
+}
+
+/**
+ Save question id and prompt id to the mac device list.
+ If the same mac address has saved yet, no need to add more.
+
+ @param MacAddrString Mac address string.
+
+ @retval EFI_SUCCESS Add the item is successful.
+ @return Other values if failed to Add the item.
+**/
+BOOLEAN
+AddIdToMacDeviceList (
+ IN EFI_STRING MacAddrString
+ )
+{
+ MENU_INFO_ITEM *TempDeviceList;
+ UINTN Index;
+ EFI_STRING StoredString;
+ EFI_STRING_ID PromptId;
+ EFI_HII_HANDLE HiiHandle;
+
+ HiiHandle = gDeviceManagerPrivate.HiiHandle;
+ TempDeviceList = NULL;
+
+ for (Index = 0; Index < mMacDeviceList.CurListLen; Index ++) {
+ StoredString = HiiGetString (HiiHandle, mMacDeviceList.NodeList[Index].PromptId, NULL);
+ if (StoredString == NULL) {
+ return FALSE;
+ }
+
+ //
+ // Already has save the same mac address to the list.
+ //
+ if (StrCmp (MacAddrString, StoredString) == 0) {
+ return FALSE;
+ }
+ }
+
+ PromptId = HiiSetString(HiiHandle, 0, MacAddrString, NULL);
+ //
+ // If not in the list, save it.
+ //
+ if (mMacDeviceList.MaxListLen > mMacDeviceList.CurListLen + 1) {
+ mMacDeviceList.NodeList[mMacDeviceList.CurListLen].PromptId = PromptId;
+ mMacDeviceList.NodeList[mMacDeviceList.CurListLen].QuestionId = (EFI_QUESTION_ID) (mMacDeviceList.CurListLen + NETWORK_DEVICE_LIST_KEY_OFFSET);
+ } else {
+ mMacDeviceList.MaxListLen += MAX_MAC_ADDRESS_NODE_LIST_LEN;
+ if (mMacDeviceList.CurListLen != 0) {
+ TempDeviceList = (MENU_INFO_ITEM *)AllocateCopyPool (sizeof (MENU_INFO_ITEM) * mMacDeviceList.MaxListLen, (VOID *)mMacDeviceList.NodeList);
+ } else {
+ TempDeviceList = (MENU_INFO_ITEM *)AllocatePool (sizeof (MENU_INFO_ITEM) * mMacDeviceList.MaxListLen);
+ }
+
+ if (TempDeviceList == NULL) {
+ return FALSE;
+ }
+ TempDeviceList[mMacDeviceList.CurListLen].PromptId = PromptId;
+ TempDeviceList[mMacDeviceList.CurListLen].QuestionId = (EFI_QUESTION_ID) (mMacDeviceList.CurListLen + NETWORK_DEVICE_LIST_KEY_OFFSET);
+
+ if (mMacDeviceList.CurListLen > 0) {
+ FreePool(mMacDeviceList.NodeList);
+ }
+
+ mMacDeviceList.NodeList = TempDeviceList;
+ }
+ mMacDeviceList.CurListLen ++;
+
+ return TRUE;
+}
+
+/**
+ Check the devcie path, try to find whether it has mac address path.
+
+ In this function, first need to check whether this path has mac address path.
+ second, when the mac address device path has find, also need to deicide whether
+ need to add this mac address relate info to the menu.
+
+ @param *Node Input device which need to be check.
+ @param *NeedAddItem Whether need to add the menu in the network device list.
+
+ @retval TRUE Has mac address device path.
+ @retval FALSE NOT Has mac address device path.
+
+**/
+BOOLEAN
+IsMacAddressDevicePath (
+ IN VOID *Node,
+ OUT BOOLEAN *NeedAddItem
+ )
+{
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ CHAR16 *Buffer;
+ BOOLEAN ReturnVal;
+
+ ASSERT (Node != NULL);
+ *NeedAddItem = FALSE;
+ ReturnVal = FALSE;
+ Buffer = NULL;
+
+ DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Node;
+
+ //
+ // find the partition device path node
+ //
+ while (!IsDevicePathEnd (DevicePath)) {
+ if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&
+ (DevicePathSubType (DevicePath) == MSG_MAC_ADDR_DP)) {
+ ReturnVal = TRUE;
+
+ if (DEVICE_MANAGER_FORM_ID == mNextShowFormId) {
+ *NeedAddItem = TRUE;
+ break;
+ }
+
+ if (!GetMacAddressString((MAC_ADDR_DEVICE_PATH*)DevicePath, &Buffer)) {
+ break;
+ }
+
+ if (NETWORK_DEVICE_FORM_ID == mNextShowFormId) {
+ if (StrCmp (Buffer, mSelectedMacAddrString) == 0) {
+ *NeedAddItem = TRUE;
+ }
+ break;
+ }
+
+ if (NETWORK_DEVICE_LIST_FORM_ID == mNextShowFormId) {
+ //
+ // Same handle may has two network child handle, so the questionid
+ // has the offset of SAME_HANDLE_KEY_OFFSET.
+ //
+ if (AddIdToMacDeviceList (Buffer)) {
+ *NeedAddItem = TRUE;
+ }
+ break;
+ }
+ }
+ DevicePath = NextDevicePathNode (DevicePath);
+ }
+
+ if (Buffer != NULL) {
+ FreePool (Buffer);
+ }
+
+ return ReturnVal;
+}
+
+/**
+ Check to see if the device path is for the network device.
+
+ @param Handle The HII handle which include the mac address device path.
+ @param ItemCount The new add Mac address item count.
+
+ @retval TRUE Need to add new item in the menu.
+ @return FALSE Do not need to add the menu about the network.
+
+**/
+BOOLEAN
+IsNeedAddNetworkMenu (
+ IN EFI_HII_HANDLE Handle,
+ OUT UINTN *ItemCount
+ )
+{
+ EFI_STATUS Status;
+ UINTN EntryCount;
+ UINTN Index;
+ EFI_HII_HANDLE HiiDeviceManagerHandle;
+ EFI_HANDLE DriverHandle;
+ EFI_HANDLE ControllerHandle;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath;
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
+ BOOLEAN IsNeedAdd;
+
+ HiiDeviceManagerHandle = gDeviceManagerPrivate.HiiHandle;
+ IsNeedAdd = FALSE;
+ OpenInfoBuffer = NULL;
+ if ((Handle == NULL) || (ItemCount == NULL)) {
+ return FALSE;
+ }
+ *ItemCount = 0;
+
+ Status = gHiiDatabase->GetPackageListHandle (gHiiDatabase, Handle, &DriverHandle);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+ //
+ // Get the device path by the got Driver handle .
+ //
+ Status = gBS->HandleProtocol (DriverHandle, &gEfiDevicePathProtocolGuid, (VOID **) &DevicePath);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+ TmpDevicePath = DevicePath;
+
+ //
+ // Check whether this device path include mac address device path.
+ // If this path has mac address path, get the value whether need
+ // add this info to the menu and return.
+ // Else check more about the child handle devcie path.
+ //
+ if (IsMacAddressDevicePath(TmpDevicePath, &IsNeedAdd)) {
+ if ((NETWORK_DEVICE_LIST_FORM_ID == mNextShowFormId) && IsNeedAdd) {
+ (*ItemCount) = 1;
+ }
+ return IsNeedAdd;
+ }
+
+ //
+ // Search whether this path is the controller path, not he child handle path.
+ // And the child handle has the network devcie connected.
+ //
+ TmpDevicePath = DevicePath;
+ Status = gBS->LocateDevicePath(&gEfiDevicePathProtocolGuid, &TmpDevicePath, &ControllerHandle);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+
+ if (!IsDevicePathEnd (TmpDevicePath)) {
+ return FALSE;
+ }
+
+ //
+ // Retrieve the list of agents that are consuming the specific protocol
+ // on ControllerHandle.
+ // The buffer point by OpenInfoBuffer need be free at this function.
+ //
+ Status = gBS->OpenProtocolInformation (
+ ControllerHandle,
+ &gEfiPciIoProtocolGuid,
+ &OpenInfoBuffer,
+ &EntryCount
+ );
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+
+ //
+ // Inspect if ChildHandle is one of the agents.
+ //
+ Status = EFI_UNSUPPORTED;
+ for (Index = 0; Index < EntryCount; Index++) {
+ //
+ // Query all the children created by the controller handle's driver
+ //
+ if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
+ Status = gBS->OpenProtocol (
+ OpenInfoBuffer[Index].ControllerHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &ChildDevicePath,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ continue;
+ }
+
+ //
+ // Check whether this device path include mac address device path.
+ //
+ if (!IsMacAddressDevicePath(ChildDevicePath, &IsNeedAdd)) {
+ //
+ // If this path not has mac address path, check the other.
+ //
+ continue;
+ } else {
+ //
+ // If need to update the NETWORK_DEVICE_LIST_FORM, try to get more.
+ //
+ if ((NETWORK_DEVICE_LIST_FORM_ID == mNextShowFormId)) {
+ if (IsNeedAdd) {
+ (*ItemCount) += 1;
+ }
+ continue;
+ } else {
+ //
+ // If need to update other form, return whether need to add to the menu.
+ //
+ goto Done;
+ }
+ }
+ }
+ }
+
+Done:
+ if (OpenInfoBuffer != NULL) {
+ FreePool (OpenInfoBuffer);
+ }
+ return IsNeedAdd;
+}
+
+/**
Call the browser and display the device manager to allow user
to configure the platform.
@@ -375,12 +749,18 @@ CallDeviceManager (
EFI_IFR_GUID_LABEL *EndLabel;
UINTN NumHandles;
EFI_HANDLE *DriverHealthHandles;
+ BOOLEAN AddNetworkMenu;
+ UINTN AddItemCount;
+ UINTN NewStringLen;
+ EFI_STRING NewStringTitle;
HiiHandles = NULL;
Status = EFI_SUCCESS;
gCallbackKey = 0;
NumHandles = 0;
DriverHealthHandles = NULL;
+ AddNetworkMenu = FALSE;
+ AddItemCount = 0;
//
// Connect all prior to entering the platform setup menu.
@@ -389,9 +769,47 @@ CallDeviceManager (
BdsLibConnectAllDriversToAllControllers ();
gConnectAllHappened = TRUE;
}
+
+ HiiHandle = gDeviceManagerPrivate.HiiHandle;
+ if (HiiHandle == NULL) {
+ //
+ // Publish our HII data.
+ //
+ HiiHandle = HiiAddPackages (
+ &mDeviceManagerGuid,
+ gDeviceManagerPrivate.DriverHandle,
+ DeviceManagerVfrBin,
+ BdsDxeStrings,
+ NULL
+ );
+ if (HiiHandle == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ gDeviceManagerPrivate.HiiHandle = HiiHandle;
+ }
+
+ //
+ // If need show the Network device list form, clear the old save list first.
+ //
+ if ((mNextShowFormId == NETWORK_DEVICE_LIST_FORM_ID) && (mMacDeviceList.CurListLen > 0)) {
+ mMacDeviceList.CurListLen = 0;
+ }
+
//
- // Create Subtitle OpCodes
+ // Update the network device form titile.
//
+ if (mNextShowFormId == NETWORK_DEVICE_FORM_ID) {
+ String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NULL);
+ NewStringLen = StrLen(mSelectedMacAddrString) * 2;
+ NewStringLen += (StrLen(String) + 2) * 2;
+ NewStringTitle = AllocatePool (NewStringLen);
+ UnicodeSPrint (NewStringTitle, NewStringLen, L"%s %s", String, mSelectedMacAddrString);
+ HiiSetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);
+ FreePool (String);
+ FreePool (NewStringTitle);
+ }
+
//
// Allocate space for creation of UpdateData Buffer
//
@@ -406,7 +824,10 @@ CallDeviceManager (
//
StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- StartLabel->Number = LABEL_DEVICES_LIST;
+ //
+ // According to the next show Form id(mNextShowFormId) to decide which form need to update.
+ //
+ StartLabel->Number = (UINT16) (LABEL_FORM_ID_OFFSET + mNextShowFormId);
//
// Create Hii Extend Label OpCode as the end opcode
@@ -415,20 +836,23 @@ CallDeviceManager (
EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
EndLabel->Number = LABEL_END;
- HiiCreateSubTitleOpCode (StartOpCodeHandle, STRING_TOKEN (STR_DEVICES_LIST), 0, 0, 1);
-
//
// Get all the Hii handles
//
HiiHandles = HiiGetHiiHandles (NULL);
ASSERT (HiiHandles != NULL);
- HiiHandle = gDeviceManagerPrivate.HiiHandle;
-
//
// Search for formset of each class type
//
for (Index = 0; HiiHandles[Index] != NULL; Index++) {
+ //
+ // The QuestionId in the form which will call the driver form has this asssumption.
+ // QuestionId = Handle Index + NETWORK_DEVICE_LIST_KEY_OFFSET;
+ // Different QuestionId at least has the section of NETWORK_DEVICE_LIST_KEY_OFFSET.
+ //
+ ASSERT(Index < MAX_KEY_SECTION_LEN);
+
if (!ExtractDisplayedHiiFormFromHiiHandle (HiiHandles[Index], &gEfiHiiPlatformSetupFormsetGuid, &FormSetTitle, &FormSetHelp)) {
continue;
}
@@ -449,21 +873,71 @@ CallDeviceManager (
TokenHelp = HiiSetString (HiiHandle, 0, String, NULL);
FreePool (String);
- HiiCreateActionOpCode (
- StartOpCodeHandle,
- (EFI_QUESTION_ID) (Index + DEVICE_KEY_OFFSET),
- Token,
- TokenHelp,
- EFI_IFR_FLAG_CALLBACK,
- 0
- );
+ //
+ // Network device process
+ //
+ if (IsNeedAddNetworkMenu (HiiHandles[Index], &AddItemCount)) {
+ if (mNextShowFormId == DEVICE_MANAGER_FORM_ID) {
+ //
+ // Only show one menu item "Network Config" in the device manger form.
+ //
+ if (!AddNetworkMenu) {
+ AddNetworkMenu = TRUE;
+ HiiCreateActionOpCode (
+ StartOpCodeHandle,
+ (EFI_QUESTION_ID) QUESTION_NETWORK_DEVICE_ID,
+ STRING_TOKEN (STR_FORM_NETWORK_DEVICE_LIST_TITLE),
+ STRING_TOKEN (STR_FORM_NETWORK_DEVICE_LIST_HELP),
+ EFI_IFR_FLAG_CALLBACK,
+ 0
+ );
+ }
+ } else if (mNextShowFormId == NETWORK_DEVICE_LIST_FORM_ID) {
+ //
+ // In network device list form, same mac address device only show one menu.
+ //
+ while (AddItemCount > 0) {
+ HiiCreateActionOpCode (
+ StartOpCodeHandle,
+ mMacDeviceList.NodeList[mMacDeviceList.CurListLen - AddItemCount].QuestionId,
+ mMacDeviceList.NodeList[mMacDeviceList.CurListLen - AddItemCount].PromptId,
+ STRING_TOKEN (STR_NETWORK_DEVICE_HELP),
+ EFI_IFR_FLAG_CALLBACK,
+ 0
+ );
+ AddItemCount -= 1;
+ }
+ } else if (mNextShowFormId == NETWORK_DEVICE_FORM_ID) {
+ //
+ // In network device form, only the selected mac address device need to be show.
+ //
+ HiiCreateActionOpCode (
+ StartOpCodeHandle,
+ (EFI_QUESTION_ID) (Index + DEVICE_KEY_OFFSET),
+ Token,
+ TokenHelp,
+ EFI_IFR_FLAG_CALLBACK,
+ 0
+ );
+ }
+ } else {
+ //
+ //
+ // Not network device process, only need to show at device manger form.
+ //
+ if (mNextShowFormId == DEVICE_MANAGER_FORM_ID) {
+ HiiCreateActionOpCode (
+ StartOpCodeHandle,
+ (EFI_QUESTION_ID) (Index + DEVICE_KEY_OFFSET),
+ Token,
+ TokenHelp,
+ EFI_IFR_FLAG_CALLBACK,
+ 0
+ );
+ }
+ }
}
- //
- // Add End Opcode for Subtitle
- //
- HiiCreateEndOpCode (StartOpCodeHandle);
-
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiDriverHealthProtocolGuid,
@@ -508,7 +982,7 @@ CallDeviceManager (
HiiUpdateForm (
HiiHandle,
&mDeviceManagerGuid,
- DEVICE_MANAGER_FORM_ID,
+ mNextShowFormId,
StartOpCodeHandle,
EndOpCodeHandle
);
@@ -519,7 +993,7 @@ CallDeviceManager (
&HiiHandle,
1,
&mDeviceManagerGuid,
- 0,
+ mNextShowFormId,
NULL,
&ActionRequest
);
@@ -528,10 +1002,10 @@ CallDeviceManager (
}
//
- // We will have returned from processing a callback - user either hit ESC to exit, or selected
+ // We will have returned from processing a callback, selected
// a target to display
//
- if ((gCallbackKey != 0) && (gCallbackKey != DEVICE_MANAGER_KEY_DRIVER_HEALTH)) {
+ if ((gCallbackKey >= DEVICE_KEY_OFFSET)) {
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
Status = gFormBrowser2->SendForm (
gFormBrowser2,
@@ -551,6 +1025,7 @@ CallDeviceManager (
// Force return to Device Manager
//
gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;
+ goto Done;
}
//
@@ -562,26 +1037,44 @@ CallDeviceManager (
// Force return to Device Manager
//
gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;
+ goto Done;
}
//
- // Cleanup dynamic created strings in HII database by reinstall the packagelist
+ // Enter from device manager and into the network device list.
//
- HiiRemovePackages (HiiHandle);
+ if (gCallbackKey == QUESTION_NETWORK_DEVICE_ID) {
+ mNextShowFormId = NETWORK_DEVICE_LIST_FORM_ID;
+ gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;
+ goto Done;
+ }
- gDeviceManagerPrivate.HiiHandle = HiiAddPackages (
- &mDeviceManagerGuid,
- gDeviceManagerPrivate.DriverHandle,
- DeviceManagerVfrBin,
- BdsDxeStrings,
- NULL
- );
- if (gDeviceManagerPrivate.HiiHandle == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
+ //
+ // In this case, go from the network device list to the specify device.
+ //
+ if ((gCallbackKey < MAX_KEY_SECTION_LEN + NETWORK_DEVICE_LIST_KEY_OFFSET ) && (gCallbackKey >= NETWORK_DEVICE_LIST_KEY_OFFSET)) {
+ mNextShowFormId = NETWORK_DEVICE_FORM_ID;
+ gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;
+ goto Done;
+ }
+
+ //
+ // Select the ESC, the gCallbackKey == 0.
+ //
+ if(mNextShowFormId - 1 < DEVICE_MANAGER_FORM_ID) {
+ mNextShowFormId = DEVICE_MANAGER_FORM_ID;
} else {
- Status = EFI_SUCCESS;
+ mNextShowFormId = (UINT16) (mNextShowFormId - 1);
+ gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;
}
+Done:
+ //
+ // Remove our packagelist from HII database.
+ //
+ HiiRemovePackages (HiiHandle);
+ gDeviceManagerPrivate.HiiHandle = NULL;
+
HiiFreeOpCodeHandle (StartOpCodeHandle);
HiiFreeOpCodeHandle (EndOpCodeHandle);
FreePool (HiiHandles);
@@ -676,13 +1169,31 @@ CallDriverHealth (
EFI_DEVICE_PATH_PROTOCOL *DriverDevicePath;
UINTN Length;
- HiiHandle = gDeviceManagerPrivate.DriverHealthHiiHandle;
Index = 0;
Length = 0;
DriverHealthInfo = NULL;
DriverDevicePath = NULL;
InitializeListHead (&DriverHealthList);
+ HiiHandle = gDeviceManagerPrivate.DriverHealthHiiHandle;
+ if (HiiHandle == NULL) {
+ //
+ // Publish Driver Health HII data.
+ //
+ HiiHandle = HiiAddPackages (
+ &mDeviceManagerGuid,
+ gDeviceManagerPrivate.DriverHealthHandle,
+ DriverHealthVfrBin,
+ BdsDxeStrings,
+ NULL
+ );
+ if (HiiHandle == NULL) {
+ return;
+ }
+
+ gDeviceManagerPrivate.DriverHealthHiiHandle = HiiHandle;
+ }
+
//
// Allocate space for creation of UpdateData Buffer
//
@@ -964,23 +1475,11 @@ CallDriverHealth (
}
//
- // Cleanup dynamic created strings in HII database by reinstall the packagelist
+ // Remove driver health packagelist from HII database.
//
-
HiiRemovePackages (HiiHandle);
+ gDeviceManagerPrivate.DriverHealthHiiHandle = NULL;
- gDeviceManagerPrivate.DriverHealthHiiHandle = HiiAddPackages (
- &mDriverHealthGuid,
- gDeviceManagerPrivate.DriverHealthHandle,
- DriverHealthVfrBin,
- BdsDxeStrings,
- NULL
- );
- if (gDeviceManagerPrivate.DriverHealthHiiHandle == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- } else {
- Status = EFI_SUCCESS;
- }
//
// Free driver health info list
//
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.h b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.h
index c706f55..483d4b1 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.h
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.h
@@ -17,6 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "Bds.h"
#include "FrontPage.h"
+#include <Protocol/PciIo.h>
//
// These are defined as the same with vfr file
@@ -31,8 +32,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
0xf76e0a70, 0xb5ed, 0x4c38, {0xac, 0x9a, 0xe5, 0xf5, 0x4b, 0xf1, 0x6e, 0x34} \
}
-#define LABEL_DEVICES_LIST 0x0080
+#define LABEL_DEVICES_LIST 0x1100
+#define LABEL_NETWORK_DEVICE_LIST_ID 0x1101
+#define LABEL_NETWORK_DEVICE_ID 0x1102
#define LABEL_END 0xffff
+#define LABEL_FORM_ID_OFFSET 0x0100
#define LABEL_DRIVER_HEALTH 0x2000
#define LABEL_DRIVER_HEALTH_END 0x2001
@@ -43,16 +47,20 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define LABEL_VBIOS 0x0040
#define DEVICE_MANAGER_FORM_ID 0x1000
-#define DRIVER_HEALTH_FORM_ID 0x1001
-
-#define DEVICE_KEY_OFFSET 0x1000
-#define DEVICE_MANAGER_KEY_VBIOS 0x2000
+#define NETWORK_DEVICE_LIST_FORM_ID 0x1001
+#define NETWORK_DEVICE_FORM_ID 0x1002
+#define DRIVER_HEALTH_FORM_ID 0x1003
+#define DEVICE_KEY_OFFSET 0x4000
+#define NETWORK_DEVICE_LIST_KEY_OFFSET 0x2000
+#define DEVICE_MANAGER_KEY_VBIOS 0x3000
+#define MAX_KEY_SECTION_LEN 0x1000
#define DEVICE_MANAGER_KEY_DRIVER_HEALTH 0x1111
#define DRIVER_HEALTH_KEY_OFFSET 0x2000
#define DRIVER_HEALTH_REPAIR_ALL_KEY 0x3000
#define DRIVER_HEALTH_RETURN_KEY 0x4000
+#define QUESTION_NETWORK_DEVICE_ID 0x3FFF
//
// These are the VFR compiler generated data representing our VFR data.
//
@@ -124,6 +132,17 @@ typedef struct {
EFI_DRIVER_HEALTH_STATUS HealthStatus;
} DRIVER_HEALTH_INFO;
+typedef struct {
+ EFI_STRING_ID PromptId;
+ EFI_QUESTION_ID QuestionId;
+}MENU_INFO_ITEM;
+
+typedef struct {
+ UINTN CurListLen;
+ UINTN MaxListLen;
+ MENU_INFO_ITEM *NodeList;
+} MAC_ADDRESS_NODE_LIST;
+
#define DEVICE_MANAGER_HEALTH_INFO_FROM_LINK(a) \
CR (a, \
DRIVER_HEALTH_INFO, \
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerStrings.uni b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerStrings.uni
index 0f40fef..f25fa84 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerStrings.uni
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerStrings.uni
Binary files differ
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerVfr.Vfr b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerVfr.Vfr
index 41a25e4..6fffe80 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerVfr.Vfr
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerVfr.Vfr
@@ -22,14 +22,17 @@
#define EFI_ON_BOARD_DEVICE_CLASS 0x0010
#define EFI_OTHER_DEVICE_CLASS 0x0020
#define LABEL_VBIOS 0x0040
-
-#define LABEL_DEVICES_LIST 0x0080
+#define LABEL_DEVICES_LIST 0x1100
+#define LABEL_NETWORK_DEVICE_LIST_ID 0x1101
+#define LABEL_NETWORK_DEVICE_ID 0x1102
#define LABEL_END 0xffff
#define DEVICE_MANAGER_CLASS 0x0000
#define FRONT_PAGE_SUBCLASS 0x0003
#define DEVICE_MANAGER_FORM_ID 0x1000
+#define NETWORK_DEVICE_LIST_FORM_ID 0x1001
+#define NETWORK_DEVICE_FORM_ID 0x1002
#define DEVICE_MANAGER_KEY_DRIVER_HEALTH 0x1111
@@ -44,6 +47,7 @@ formset
form formid = DEVICE_MANAGER_FORM_ID,
title = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE);
+ subtitle text = STRING_TOKEN(STR_DEVICES_LIST);
//
// This is where devices get added to the device manager hierarchy
//
@@ -76,5 +80,27 @@ formset
subtitle text = STRING_TOKEN(STR_EXIT_STRING);
endform;
+
+ form formid = NETWORK_DEVICE_LIST_FORM_ID,
+ title = STRING_TOKEN(STR_FORM_NETWORK_DEVICE_LIST_TITLE);
+
+ subtitle text = STRING_TOKEN(STR_NETWORK_DEVICE_LIST_STRING);
+
+ label LABEL_NETWORK_DEVICE_LIST_ID;
+ label LABEL_END;
+ subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
+ subtitle text = STRING_TOKEN(STR_EXIT_STRING);
+ endform;
+
+ form formid = NETWORK_DEVICE_FORM_ID,
+ title = STRING_TOKEN(STR_FORM_NETWORK_DEVICE_TITLE);
+
+ subtitle text = STRING_TOKEN(STR_NETWORK_DEVICE_STRING);
+
+ label LABEL_NETWORK_DEVICE_ID;
+ label LABEL_END;
+ subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
+ subtitle text = STRING_TOKEN(STR_EXIT_STRING);
+ endform;
endformset;
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/inventorystrings.uni b/MdeModulePkg/Universal/DriverSampleDxe/inventorystrings.uni
index 8d94456..926c327 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/inventorystrings.uni
+++ b/MdeModulePkg/Universal/DriverSampleDxe/inventorystrings.uni
Binary files differ
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxeStrings.uni b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxeStrings.uni
index 808f431..c3886df 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxeStrings.uni
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxeStrings.uni
Binary files differ
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.c b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.c
index e161b51..b0aee5f 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.c
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.c
@@ -852,16 +852,16 @@ Ip4ConfigDeviceInit (
}
//
- // Append MAC string in the menu string and tile string
+ // Append MAC string in the menu help string and tile help string
//
Status = NetLibGetMacString (Instance->Controller, Instance->Image, &MacString);
if (!EFI_ERROR (Status)) {
- OldMenuString = HiiGetString (Instance->RegisteredHandle, STRING_TOKEN (STR_IP4_CONFIG_FORM_TITLE), NULL);
+ OldMenuString = HiiGetString (Instance->RegisteredHandle, STRING_TOKEN (STR_IP4_CONFIG_FORM_HELP), NULL);
UnicodeSPrint (MenuString, 128, L"%s (MAC:%s)", OldMenuString, MacString);
- HiiSetString (Instance->RegisteredHandle, STRING_TOKEN (STR_IP4_CONFIG_FORM_TITLE), MenuString, NULL);
+ HiiSetString (Instance->RegisteredHandle, STRING_TOKEN (STR_IP4_CONFIG_FORM_HELP), MenuString, NULL);
UnicodeSPrint (PortString, 128, L"MAC:%s", MacString);
- HiiSetString (Instance->RegisteredHandle, STRING_TOKEN (STR_IP4_DEVICE_FORM_TITLE), PortString, NULL);
+ HiiSetString (Instance->RegisteredHandle, STRING_TOKEN (STR_IP4_DEVICE_FORM_HELP), PortString, NULL);
FreePool (MacString);
}
diff --git a/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c b/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c
index 57fe339..871199e 100644
--- a/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c
+++ b/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c
@@ -527,7 +527,7 @@ InstallVlanConfigForm (
PrivateData->HiiHandle = HiiHandle;
//
- // Update formset title
+ // Update formset title help string.
//
MacString = NULL;
Status = NetLibGetMacString (PrivateData->ControllerHandle, PrivateData->ImageHandle, &MacString);
@@ -541,17 +541,17 @@ InstallVlanConfigForm (
StrCat (Str, L")");
HiiSetString (
HiiHandle,
- STRING_TOKEN (STR_VLAN_FORM_SET_TITLE),
+ STRING_TOKEN (STR_VLAN_FORM_SET_TITLE_HELP),
Str,
NULL
);
//
- // Update form title
+ // Update form title help string.
//
HiiSetString (
HiiHandle,
- STRING_TOKEN (STR_VLAN_FORM_TITLE),
+ STRING_TOKEN (STR_VLAN_FORM_HELP),
Str,
NULL
);
diff --git a/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigStrings.uni b/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigStrings.uni
index edb6071..e5a6d16 100644
--- a/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigStrings.uni
+++ b/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigStrings.uni
Binary files differ
diff --git a/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c b/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c
index 9ec4886..ef5ea2e 100644
--- a/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c
+++ b/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c
@@ -2010,26 +2010,26 @@ Ip6ConfigFormInit (
}
//
- // Append MAC string in the menu string and tile string
+ // Append MAC string in the menu help string and tile help string
//
Status = NetLibGetMacString (IpSb->Controller, IpSb->Image, &MacString);
if (!EFI_ERROR (Status)) {
OldMenuString = HiiGetString (
CallbackInfo->RegisteredHandle,
- STRING_TOKEN (STR_IP6_CONFIG_FORM_TITLE),
+ STRING_TOKEN (STR_IP6_CONFIG_FORM_HELP),
NULL)
;
UnicodeSPrint (MenuString, 128, L"%s (MAC:%s)", OldMenuString, MacString);
HiiSetString (
CallbackInfo->RegisteredHandle,
- STRING_TOKEN (STR_IP6_CONFIG_FORM_TITLE),
+ STRING_TOKEN (STR_IP6_CONFIG_FORM_HELP),
MenuString,
NULL
);
UnicodeSPrint (PortString, 128, L"MAC:%s", MacString);
HiiSetString (
CallbackInfo->RegisteredHandle,
- STRING_TOKEN (STR_IP6_DEVICE_FORM_TITLE),
+ STRING_TOKEN (STR_IP6_DEVICE_FORM_HELP),
PortString,
NULL
);
diff --git a/NetworkPkg/Ip6Dxe/Ip6DxeStrings.uni b/NetworkPkg/Ip6Dxe/Ip6DxeStrings.uni
index cf85e08..e95f2f9 100644
--- a/NetworkPkg/Ip6Dxe/Ip6DxeStrings.uni
+++ b/NetworkPkg/Ip6Dxe/Ip6DxeStrings.uni
Binary files differ