mirror of https://github.com/acidanthera/audk.git
[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 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11137 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
785e597795
commit
3c4b1122e0
|
@ -150,6 +150,7 @@
|
|||
gEfiSerialIoProtocolGuid ## PROTOCOL CONSUMES
|
||||
gEfiDevicePathProtocolGuid ## PROTOCOL CONSUMES
|
||||
gEfiDriverHealthProtocolGuid ## PROTOCOL SOMETIMES_CONSUMES
|
||||
gEfiPciIoProtocolGuid ## PROTOCOL CONSUMES
|
||||
|
||||
[FeaturePcd]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate
|
||||
|
|
|
@ -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,6 +212,9 @@ InitializeDeviceManager (
|
|||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
mMacDeviceList.CurListLen = 0;
|
||||
mMacDeviceList.MaxListLen = 0;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -310,6 +344,379 @@ ExtractDisplayedHiiFormFromHiiHandle (
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
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 NewQuestionId New question id.
|
||||
@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.
|
||||
|
@ -343,12 +750,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.
|
||||
|
@ -378,8 +791,25 @@ CallDeviceManager (
|
|||
}
|
||||
|
||||
//
|
||||
// Create Subtitle OpCodes
|
||||
// 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;
|
||||
}
|
||||
|
||||
//
|
||||
// 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(String) + StrLen(mSelectedMacAddrString) + 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
|
||||
//
|
||||
|
@ -394,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 = LABEL_FORM_ID_OFFSET + mNextShowFormId;
|
||||
|
||||
//
|
||||
// Create Hii Extend Label OpCode as the end opcode
|
||||
|
@ -403,8 +836,6 @@ 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
|
||||
//
|
||||
|
@ -415,6 +846,13 @@ CallDeviceManager (
|
|||
// 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;
|
||||
}
|
||||
|
@ -435,6 +873,44 @@ CallDeviceManager (
|
|||
TokenHelp = HiiSetString (HiiHandle, 0, String, NULL);
|
||||
FreePool (String);
|
||||
|
||||
//
|
||||
// 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),
|
||||
|
@ -444,11 +920,23 @@ CallDeviceManager (
|
|||
0
|
||||
);
|
||||
}
|
||||
|
||||
} else {
|
||||
//
|
||||
// Add End Opcode for Subtitle
|
||||
//
|
||||
HiiCreateEndOpCode (StartOpCodeHandle);
|
||||
// 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
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
|
@ -494,7 +982,7 @@ CallDeviceManager (
|
|||
HiiUpdateForm (
|
||||
HiiHandle,
|
||||
&mDeviceManagerGuid,
|
||||
DEVICE_MANAGER_FORM_ID,
|
||||
mNextShowFormId,
|
||||
StartOpCodeHandle,
|
||||
EndOpCodeHandle
|
||||
);
|
||||
|
@ -505,7 +993,7 @@ CallDeviceManager (
|
|||
&HiiHandle,
|
||||
1,
|
||||
&mDeviceManagerGuid,
|
||||
0,
|
||||
mNextShowFormId,
|
||||
NULL,
|
||||
&ActionRequest
|
||||
);
|
||||
|
@ -514,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,
|
||||
|
@ -537,6 +1025,7 @@ CallDeviceManager (
|
|||
// Force return to Device Manager
|
||||
//
|
||||
gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -548,8 +1037,38 @@ CallDeviceManager (
|
|||
// Force return to Device Manager
|
||||
//
|
||||
gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
//
|
||||
// Enter from device manager and into the network device list.
|
||||
//
|
||||
if (gCallbackKey == QUESTION_NETWORK_DEVICE_ID) {
|
||||
mNextShowFormId = NETWORK_DEVICE_LIST_FORM_ID;
|
||||
gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
//
|
||||
// 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 {
|
||||
mNextShowFormId = mNextShowFormId - 1;
|
||||
gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;
|
||||
}
|
||||
|
||||
Done:
|
||||
//
|
||||
// Remove our packagelist from HII database.
|
||||
//
|
||||
|
|
|
@ -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, \
|
||||
|
|
Binary file not shown.
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue