12 DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE,
22#define MAX_MAC_ADDRESS_NODE_LIST_LEN 10
24EFI_GUID mDeviceManagerGuid = DEVICE_MANAGER_FORMSET_GUID;
30EFI_STRING mSelectedMacAddrString;
50 { 0x102579a0, 0x3686, 0x466e, { 0xac, 0xd8, 0x80, 0xc0, 0x87, 0x4, 0x4f, 0x4a }
55 END_ENTIRE_DEVICE_PATH_SUBTYPE,
57 (UINT8)(END_DEVICE_PATH_LENGTH),
58 (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
80 ASSERT (Handle !=
NULL);
87 if (EFI_ERROR (Status)) {
121 ASSERT (MacAddressNode !=
NULL);
124 if ((MacAddressNode->IfType == 0x01) || (MacAddressNode->IfType == 0x00)) {
132 BufferLen = (4 + 2 * HwAddressSize + (HwAddressSize - 1) + 5 + 1) *
sizeof (CHAR16);
134 if (String ==
NULL) {
139 StrCpyS (String, BufferLen /
sizeof (CHAR16), L
"MAC:");
145 HwAddress = &MacAddressNode->MacAddress.Addr[0];
146 for (Index = 0; Index < HwAddressSize; Index++) {
149 BufferLen - ((
UINTN)String - (
UINTN)*PBuffer),
150 PREFIX_ZERO | RADIX_HEX,
154 String +=
StrnLenS (String, (BufferLen - ((
UINTN)String - (
UINTN)*PBuffer)) /
sizeof (CHAR16));
155 if (Index < HwAddressSize - 1) {
177 BufferLen - ((
UINTN)String - (
UINTN)*PBuffer),
178 PREFIX_ZERO | RADIX_HEX,
182 String +=
StrnLenS (String, (BufferLen - ((
UINTN)String - (
UINTN)*PBuffer)) /
sizeof (CHAR16));
204 IN EFI_STRING MacAddrString
209 EFI_STRING StoredString;
210 EFI_STRING_ID PromptId;
213 HiiHandle = gDeviceManagerPrivate.
HiiHandle;
214 TempDeviceList =
NULL;
216 for (Index = 0; Index < mMacDeviceList.CurListLen; Index++) {
217 StoredString =
HiiGetString (HiiHandle, mMacDeviceList.NodeList[Index].PromptId,
NULL);
218 if (StoredString ==
NULL) {
225 if (
StrCmp (MacAddrString, StoredString) == 0) {
234 if (mMacDeviceList.MaxListLen > mMacDeviceList.CurListLen + 1) {
235 mMacDeviceList.NodeList[mMacDeviceList.CurListLen].PromptId = PromptId;
236 mMacDeviceList.NodeList[mMacDeviceList.CurListLen].QuestionId = (EFI_QUESTION_ID)(mMacDeviceList.CurListLen + NETWORK_DEVICE_LIST_KEY_OFFSET);
238 mMacDeviceList.MaxListLen += MAX_MAC_ADDRESS_NODE_LIST_LEN;
239 if (mMacDeviceList.CurListLen != 0) {
243 mMacDeviceList.NodeList
249 if (TempDeviceList ==
NULL) {
253 TempDeviceList[mMacDeviceList.CurListLen].PromptId = PromptId;
254 TempDeviceList[mMacDeviceList.CurListLen].QuestionId = (EFI_QUESTION_ID)(mMacDeviceList.CurListLen + NETWORK_DEVICE_LIST_KEY_OFFSET);
256 mMacDeviceList.NodeList = TempDeviceList;
259 mMacDeviceList.CurListLen++;
282 IN EFI_FORM_ID NextShowFormId,
283 OUT BOOLEAN *NeedAddItem
290 ASSERT (Node !=
NULL);
291 *NeedAddItem =
FALSE;
306 if (DEVICE_MANAGER_FORM_ID == NextShowFormId) {
315 if (NETWORK_DEVICE_FORM_ID == NextShowFormId) {
316 if (
StrCmp (Buffer, mSelectedMacAddrString) == 0) {
323 if (NETWORK_DEVICE_LIST_FORM_ID == NextShowFormId) {
339 if (Buffer !=
NULL) {
360 IN EFI_FORM_ID NextShowFormId,
376 OpenInfoBuffer =
NULL;
377 if ((Handle ==
NULL) || (ItemCount ==
NULL)) {
384 if (EFI_ERROR (Status)) {
391 Status =
gBS->HandleProtocol (DriverHandle, &gEfiDevicePathProtocolGuid, (VOID **)&DevicePath);
392 if (EFI_ERROR (Status)) {
396 TmpDevicePath = DevicePath;
405 if ((NETWORK_DEVICE_LIST_FORM_ID == NextShowFormId) && IsNeedAdd) {
416 TmpDevicePath = DevicePath;
417 Status =
gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &TmpDevicePath, &ControllerHandle);
418 if (EFI_ERROR (Status)) {
431 Status =
gBS->OpenProtocolInformation (
433 &gEfiPciIoProtocolGuid,
437 if (EFI_ERROR (Status)) {
444 Status = EFI_UNSUPPORTED;
445 for (Index = 0; Index < EntryCount; Index++) {
449 if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
450 Status =
gBS->OpenProtocol (
451 OpenInfoBuffer[Index].ControllerHandle,
452 &gEfiDevicePathProtocolGuid,
453 (VOID **)&ChildDevicePath,
456 EFI_OPEN_PROTOCOL_GET_PROTOCOL
458 if (EFI_ERROR (Status)) {
474 if ((NETWORK_DEVICE_LIST_FORM_ID == NextShowFormId)) {
491 if (OpenInfoBuffer !=
NULL) {
506 IN EFI_FORM_ID NextShowFormId
512 EFI_STRING_ID TokenHelp;
516 VOID *StartOpCodeHandle;
517 VOID *EndOpCodeHandle;
520 BOOLEAN AddNetworkMenu;
523 EFI_STRING NewStringTitle;
524 CHAR16 *DevicePathStr;
525 EFI_STRING_ID DevicePathId;
538 HiiHandle = gDeviceManagerPrivate.
HiiHandle;
539 AddNetworkMenu =
FALSE;
544 if ((NextShowFormId == NETWORK_DEVICE_LIST_FORM_ID) && (mMacDeviceList.CurListLen > 0)) {
545 mMacDeviceList.CurListLen = 0;
551 if (NextShowFormId == NETWORK_DEVICE_FORM_ID) {
553 if (String ==
NULL) {
557 NewStringLen =
StrLen (mSelectedMacAddrString) * 2;
558 NewStringLen += (
StrLen (String) + 2) * 2;
560 UnicodeSPrint (NewStringTitle, NewStringLen, L
"%s %s", String, mSelectedMacAddrString);
570 ASSERT (StartOpCodeHandle !=
NULL);
573 ASSERT (EndOpCodeHandle !=
NULL);
583 StartLabel->
Number = (UINT16)(LABEL_FORM_ID_OFFSET + NextShowFormId);
590 EndLabel->
Number = LABEL_END;
596 ASSERT (HiiHandles !=
NULL);
601 for (Index = 0; HiiHandles[Index] !=
NULL; Index++) {
603 if (EFI_ERROR (Status)) {
607 Ptr = (UINT8 *)Buffer;
608 while (TempSize < BufferSize) {
617 while (ClassGuidNum-- > 0) {
618 if (
CompareGuid (&gEfiHiiPlatformSetupFormsetGuid, ClassGuid) == 0) {
624 if (String ==
NULL) {
626 ASSERT (String !=
NULL);
633 if (String ==
NULL) {
635 ASSERT (String !=
NULL);
647 if (NextShowFormId == DEVICE_MANAGER_FORM_ID) {
651 if (!AddNetworkMenu) {
652 AddNetworkMenu =
TRUE;
655 NETWORK_DEVICE_LIST_FORM_ID,
658 EFI_IFR_FLAG_CALLBACK,
659 (EFI_QUESTION_ID)QUESTION_NETWORK_DEVICE_ID
662 }
else if (NextShowFormId == NETWORK_DEVICE_LIST_FORM_ID) {
666 while (AddItemCount > 0) {
669 NETWORK_DEVICE_FORM_ID,
670 mMacDeviceList.NodeList[mMacDeviceList.CurListLen - AddItemCount].PromptId,
672 EFI_IFR_FLAG_CALLBACK,
673 mMacDeviceList.NodeList[mMacDeviceList.CurListLen - AddItemCount].QuestionId
677 }
else if (NextShowFormId == NETWORK_DEVICE_FORM_ID) {
683 if (DevicePathStr !=
NULL) {
694 (EFI_QUESTION_ID)(Index + DEVICE_KEY_OFFSET),
704 if (NextShowFormId == DEVICE_MANAGER_FORM_ID) {
707 if (DevicePathStr !=
NULL) {
718 (EFI_QUESTION_ID)(Index + DEVICE_KEY_OFFSET),
778 OUT EFI_STRING *Progress,
779 OUT EFI_STRING *Results
782 if ((Progress ==
NULL) || (Results ==
NULL)) {
783 return EFI_INVALID_PARAMETER;
787 return EFI_NOT_FOUND;
809 IN CONST EFI_STRING Configuration,
810 OUT EFI_STRING *Progress
813 if ((Configuration ==
NULL) || (Progress ==
NULL)) {
814 return EFI_INVALID_PARAMETER;
817 *Progress = Configuration;
819 return EFI_NOT_FOUND;
842 IN EFI_BROWSER_ACTION Action,
843 IN EFI_QUESTION_ID QuestionId,
846 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
851 if (Action != EFI_BROWSER_ACTION_CHANGING) {
855 return EFI_UNSUPPORTED;
858 if ((Value ==
NULL) || (ActionRequest ==
NULL)) {
859 return EFI_INVALID_PARAMETER;
862 if ((QuestionId < MAX_KEY_SECTION_LEN + NETWORK_DEVICE_LIST_KEY_OFFSET) && (QuestionId >= NETWORK_DEVICE_LIST_KEY_OFFSET)) {
866 for (CurIndex = 0; CurIndex < mMacDeviceList.CurListLen; CurIndex++) {
867 if (mMacDeviceList.NodeList[CurIndex].QuestionId == QuestionId) {
868 mSelectedMacAddrString =
HiiGetString (gDeviceManagerPrivate.
HiiHandle, mMacDeviceList.NodeList[CurIndex].PromptId,
NULL);
873 }
else if (QuestionId == QUESTION_NETWORK_DEVICE_ID) {
899 gDeviceManagerPrivate.DriverHandle =
NULL;
900 Status =
gBS->InstallMultipleProtocolInterfaces (
901 &gDeviceManagerPrivate.DriverHandle,
902 &gEfiDevicePathProtocolGuid,
903 &mDeviceManagerHiiVendorDevicePath,
904 &gEfiHiiConfigAccessProtocolGuid,
915 gDeviceManagerPrivate.DriverHandle,
917 DeviceManagerUiLibStrings,
954 Status =
gBS->UninstallMultipleProtocolInterfaces (
955 gDeviceManagerPrivate.DriverHandle,
956 &gEfiDevicePathProtocolGuid,
957 &mDeviceManagerHiiVendorDevicePath,
958 &gEfiHiiConfigAccessProtocolGuid,
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
UINTN EFIAPI StrnLenS(IN CONST CHAR16 *String, IN UINTN MaxSize)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
BOOLEAN IsMacAddressDevicePath(IN VOID *Node, IN EFI_FORM_ID NextShowFormId, OUT BOOLEAN *NeedAddItem)
EFI_STATUS EFIAPI DeviceManagerUiLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
BOOLEAN GetMacAddressString(IN MAC_ADDR_DEVICE_PATH *MacAddressNode, OUT CHAR16 **PBuffer)
BOOLEAN IsNeedAddNetworkMenu(IN EFI_HII_HANDLE Handle, IN EFI_FORM_ID NextShowFormId, OUT UINTN *ItemCount)
VOID CreateDeviceManagerForm(IN EFI_FORM_ID NextShowFormId)
BOOLEAN AddIdToMacDeviceList(IN EFI_STRING MacAddrString)
EFI_STATUS EFIAPI DeviceManagerExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
EFI_STATUS EFIAPI DeviceManagerUiLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
CHAR16 * DmExtractDevicePathFromHiiHandle(IN EFI_HII_HANDLE Handle)
EFI_STATUS EFIAPI DeviceManagerCallback(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)
EFI_STATUS EFIAPI DeviceManagerRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
#define HARDWARE_DEVICE_PATH
#define MESSAGING_DEVICE_PATH
UINT8 EFIAPI DevicePathType(IN CONST VOID *Node)
UINT8 EFIAPI DevicePathSubType(IN CONST VOID *Node)
BOOLEAN EFIAPI IsDevicePathEnd(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DevicePathFromHandle(IN EFI_HANDLE Handle)
CHAR16 *EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
VOID *EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
UINT8 *EFIAPI HiiCreateGotoOpCode(IN VOID *OpCodeHandle, IN EFI_FORM_ID FormId, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN EFI_QUESTION_ID QuestionId)
VOID *EFIAPI HiiAllocateOpCodeHandle(VOID)
VOID EFIAPI HiiFreeOpCodeHandle(VOID *OpCodeHandle)
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
UINT8 *EFIAPI HiiCreateGuidOpCode(IN VOID *OpCodeHandle, IN CONST EFI_GUID *Guid, IN CONST VOID *GuidOpCode OPTIONAL, IN UINTN OpCodeSize)
EFI_HII_HANDLE *EFIAPI HiiGetHiiHandles(IN CONST EFI_GUID *PackageListGuid OPTIONAL)
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
EFI_STATUS EFIAPI HiiUpdateForm(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *FormSetGuid OPTIONAL, IN EFI_FORM_ID FormId, IN VOID *StartOpCodeHandle, IN VOID *EndOpCodeHandle OPTIONAL)
EFI_STRING_ID EFIAPI HiiSetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId OPTIONAL, IN CONST EFI_STRING String, IN CONST CHAR8 *SupportedLanguages OPTIONAL)
UINT8 *EFIAPI HiiCreateGotoExOpCode(IN VOID *OpCodeHandle, IN EFI_FORM_ID RefFormId, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN EFI_QUESTION_ID QuestionId, IN EFI_QUESTION_ID RefQuestionId, IN EFI_GUID *RefFormSetId OPTIONAL, IN EFI_STRING_ID RefDevicePath)
EFI_STATUS EFIAPI HiiGetFormSetFromHiiHandle(IN EFI_HII_HANDLE Handle, OUT EFI_IFR_FORM_SET **Buffer, OUT UINTN *BufferSize)
VOID EFIAPI HiiRemovePackages(IN EFI_HII_HANDLE HiiHandle)
#define EFI_IFR_EXTEND_OP_LABEL
RETURN_STATUS EFIAPI UnicodeValueToStringS(IN OUT CHAR16 *Buffer, IN UINTN BufferSize, IN UINTN Flags, IN INT64 Value, IN UINTN Width)
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
#define OFFSET_OF(TYPE, Field)
#define ASSERT_EFI_ERROR(StatusParameter)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
VOID EFIAPI EfiBootManagerConnectAll(VOID)
EFI_HII_DATABASE_PROTOCOL * gHiiDatabase
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess