2 The device manager reference implementation
4 Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "DeviceManager.h"
17 DEVICE_MANAGER_CALLBACK_DATA gDeviceManagerPrivate
= {
18 DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE
,
22 DeviceManagerExtractConfig
,
23 DeviceManagerRouteConfig
,
28 #define MAX_MAC_ADDRESS_NODE_LIST_LEN 10
30 EFI_GUID mDeviceManagerGuid
= DEVICE_MANAGER_FORMSET_GUID
;
33 // Which Mac Address string is select
34 // it will decide what menu need to show in the NETWORK_DEVICE_FORM_ID form.
36 EFI_STRING mSelectedMacAddrString
;
39 // The Mac Address show in the NETWORK_DEVICE_LIST_FORM_ID
41 MAC_ADDRESS_NODE_LIST mMacDeviceList
;
43 HII_VENDOR_DEVICE_PATH mDeviceManagerHiiVendorDevicePath
= {
49 (UINT8
) (sizeof (VENDOR_DEVICE_PATH
)),
50 (UINT8
) ((sizeof (VENDOR_DEVICE_PATH
)) >> 8)
54 // {102579A0-3686-466e-ACD8-80C087044F4A}
56 { 0x102579a0, 0x3686, 0x466e, { 0xac, 0xd8, 0x80, 0xc0, 0x87, 0x4, 0x4f, 0x4a } }
60 END_ENTIRE_DEVICE_PATH_SUBTYPE
,
62 (UINT8
) (END_DEVICE_PATH_LENGTH
),
63 (UINT8
) ((END_DEVICE_PATH_LENGTH
) >> 8)
69 Extract device path for given HII handle and class guid.
71 @param Handle The HII handle.
73 @retval NULL Fail to get the device path string.
74 @return PathString Get the device path string.
78 DmExtractDevicePathFromHiiHandle (
79 IN EFI_HII_HANDLE Handle
83 EFI_HANDLE DriverHandle
;
85 ASSERT (Handle
!= NULL
);
91 Status
= gHiiDatabase
->GetPackageListHandle (gHiiDatabase
, Handle
, &DriverHandle
);
92 if (EFI_ERROR (Status
)) {
96 // Get device path string.
98 return ConvertDevicePathToText(DevicePathFromHandle (DriverHandle
), FALSE
, FALSE
);
102 Get the mac address string from the device path.
103 if the device path has the vlan, get the vanid also.
105 @param MacAddressNode Device path begin with mac address
106 @param PBuffer Output string buffer contain mac address.
111 IN MAC_ADDR_DEVICE_PATH
*MacAddressNode
,
118 EFI_DEVICE_PATH_PROTOCOL
*Node
;
125 ASSERT(MacAddressNode
!= NULL
);
127 HwAddressSize
= sizeof (EFI_MAC_ADDRESS
);
128 if (MacAddressNode
->IfType
== 0x01 || MacAddressNode
->IfType
== 0x00) {
133 // The output format is MAC:XX:XX:XX:...\XXXX
134 // The size is the Number size + ":" size + Vlan size(\XXXX) + End
136 BufferLen
= (4 + 2 * HwAddressSize
+ (HwAddressSize
- 1) + 5 + 1) * sizeof (CHAR16
);
137 String
= AllocateZeroPool (BufferLen
);
138 if (String
== NULL
) {
143 StrCpyS(String
, BufferLen
/ sizeof (CHAR16
), L
"MAC:");
147 // Convert the MAC address into a unicode string.
149 HwAddress
= &MacAddressNode
->MacAddress
.Addr
[0];
150 for (Index
= 0; Index
< HwAddressSize
; Index
++) {
151 UnicodeValueToStringS (
153 BufferLen
- ((UINTN
)String
- (UINTN
)*PBuffer
),
154 PREFIX_ZERO
| RADIX_HEX
,
158 String
+= StrnLenS (String
, (BufferLen
- ((UINTN
)String
- (UINTN
)*PBuffer
)) / sizeof (CHAR16
));
159 if (Index
< HwAddressSize
- 1) {
165 // If VLAN is configured, it will need extra 5 characters like "\0005".
166 // Plus one unicode character for the null-terminator.
168 Node
= (EFI_DEVICE_PATH_PROTOCOL
*)MacAddressNode
;
169 while (!IsDevicePathEnd (Node
)) {
170 if (Node
->Type
== MESSAGING_DEVICE_PATH
&& Node
->SubType
== MSG_VLAN_DP
) {
171 VlanId
= ((VLAN_DEVICE_PATH
*) Node
)->VlanId
;
173 Node
= NextDevicePathNode (Node
);
178 UnicodeValueToStringS (
180 BufferLen
- ((UINTN
)String
- (UINTN
)*PBuffer
),
181 PREFIX_ZERO
| RADIX_HEX
,
185 String
+= StrnLenS (String
, (BufferLen
- ((UINTN
)String
- (UINTN
)*PBuffer
)) / sizeof (CHAR16
));
189 // Null terminate the Unicode string
197 Save question id and prompt id to the mac device list.
198 If the same mac address has saved yet, no need to add more.
200 @param MacAddrString Mac address string.
202 @retval EFI_SUCCESS Add the item is successful.
203 @return Other values if failed to Add the item.
206 AddIdToMacDeviceList (
207 IN EFI_STRING MacAddrString
210 MENU_INFO_ITEM
*TempDeviceList
;
212 EFI_STRING StoredString
;
213 EFI_STRING_ID PromptId
;
214 EFI_HII_HANDLE HiiHandle
;
216 HiiHandle
= gDeviceManagerPrivate
.HiiHandle
;
217 TempDeviceList
= NULL
;
219 for (Index
= 0; Index
< mMacDeviceList
.CurListLen
; Index
++) {
220 StoredString
= HiiGetString (HiiHandle
, mMacDeviceList
.NodeList
[Index
].PromptId
, NULL
);
221 if (StoredString
== NULL
) {
226 // Already has save the same mac address to the list.
228 if (StrCmp (MacAddrString
, StoredString
) == 0) {
233 PromptId
= HiiSetString(HiiHandle
, 0, MacAddrString
, NULL
);
235 // If not in the list, save it.
237 if (mMacDeviceList
.MaxListLen
> mMacDeviceList
.CurListLen
+ 1) {
238 mMacDeviceList
.NodeList
[mMacDeviceList
.CurListLen
].PromptId
= PromptId
;
239 mMacDeviceList
.NodeList
[mMacDeviceList
.CurListLen
].QuestionId
= (EFI_QUESTION_ID
) (mMacDeviceList
.CurListLen
+ NETWORK_DEVICE_LIST_KEY_OFFSET
);
241 mMacDeviceList
.MaxListLen
+= MAX_MAC_ADDRESS_NODE_LIST_LEN
;
242 if (mMacDeviceList
.CurListLen
!= 0) {
243 TempDeviceList
= ReallocatePool (
244 sizeof (MENU_INFO_ITEM
) * mMacDeviceList
.CurListLen
,
245 sizeof (MENU_INFO_ITEM
) * mMacDeviceList
.MaxListLen
,
246 mMacDeviceList
.NodeList
249 TempDeviceList
= (MENU_INFO_ITEM
*)AllocatePool (sizeof (MENU_INFO_ITEM
) * mMacDeviceList
.MaxListLen
);
252 if (TempDeviceList
== NULL
) {
255 TempDeviceList
[mMacDeviceList
.CurListLen
].PromptId
= PromptId
;
256 TempDeviceList
[mMacDeviceList
.CurListLen
].QuestionId
= (EFI_QUESTION_ID
) (mMacDeviceList
.CurListLen
+ NETWORK_DEVICE_LIST_KEY_OFFSET
);
258 mMacDeviceList
.NodeList
= TempDeviceList
;
260 mMacDeviceList
.CurListLen
++;
266 Check the devcie path, try to find whether it has mac address path.
268 In this function, first need to check whether this path has mac address path.
269 second, when the mac address device path has find, also need to deicide whether
270 need to add this mac address relate info to the menu.
272 @param *Node Input device which need to be check.
273 @param NextShowFormId FormId Which need to be show.
274 @param *NeedAddItem Whether need to add the menu in the network device list.
276 @retval TRUE Has mac address device path.
277 @retval FALSE NOT Has mac address device path.
281 IsMacAddressDevicePath (
283 IN EFI_FORM_ID NextShowFormId
,
284 OUT BOOLEAN
*NeedAddItem
287 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
291 ASSERT (Node
!= NULL
);
292 *NeedAddItem
= FALSE
;
296 DevicePath
= (EFI_DEVICE_PATH_PROTOCOL
*) Node
;
299 // find the partition device path node
301 while (!IsDevicePathEnd (DevicePath
)) {
302 if ((DevicePathType (DevicePath
) == MESSAGING_DEVICE_PATH
) &&
303 (DevicePathSubType (DevicePath
) == MSG_MAC_ADDR_DP
)) {
306 if (DEVICE_MANAGER_FORM_ID
== NextShowFormId
) {
311 if (!GetMacAddressString((MAC_ADDR_DEVICE_PATH
*)DevicePath
, &Buffer
)) {
315 if (NETWORK_DEVICE_FORM_ID
== NextShowFormId
) {
316 if (StrCmp (Buffer
, mSelectedMacAddrString
) == 0) {
322 if (NETWORK_DEVICE_LIST_FORM_ID
== NextShowFormId
) {
324 // Same handle may has two network child handle, so the questionid
325 // has the offset of SAME_HANDLE_KEY_OFFSET.
327 if (AddIdToMacDeviceList (Buffer
)) {
333 DevicePath
= NextDevicePathNode (DevicePath
);
336 if (Buffer
!= NULL
) {
344 Check to see if the device path is for the network device.
346 @param Handle The HII handle which include the mac address device path.
347 @param NextShowFormId The FormId of the form which will be show next time.
348 @param ItemCount The new add Mac address item count.
350 @retval TRUE Need to add new item in the menu.
351 @return FALSE Do not need to add the menu about the network.
355 IsNeedAddNetworkMenu (
356 IN EFI_HII_HANDLE Handle
,
357 IN EFI_FORM_ID NextShowFormId
,
364 EFI_HANDLE DriverHandle
;
365 EFI_HANDLE ControllerHandle
;
366 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
367 EFI_DEVICE_PATH_PROTOCOL
*TmpDevicePath
;
368 EFI_DEVICE_PATH_PROTOCOL
*ChildDevicePath
;
369 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
*OpenInfoBuffer
;
373 OpenInfoBuffer
= NULL
;
374 if ((Handle
== NULL
) || (ItemCount
== NULL
)) {
379 Status
= gHiiDatabase
->GetPackageListHandle (gHiiDatabase
, Handle
, &DriverHandle
);
380 if (EFI_ERROR (Status
)) {
384 // Get the device path by the got Driver handle .
386 Status
= gBS
->HandleProtocol (DriverHandle
, &gEfiDevicePathProtocolGuid
, (VOID
**) &DevicePath
);
387 if (EFI_ERROR (Status
)) {
390 TmpDevicePath
= DevicePath
;
393 // Check whether this device path include mac address device path.
394 // If this path has mac address path, get the value whether need
395 // add this info to the menu and return.
396 // Else check more about the child handle devcie path.
398 if (IsMacAddressDevicePath(TmpDevicePath
, NextShowFormId
,&IsNeedAdd
)) {
399 if ((NETWORK_DEVICE_LIST_FORM_ID
== NextShowFormId
) && IsNeedAdd
) {
406 // Search whether this path is the controller path, not he child handle path.
407 // And the child handle has the network devcie connected.
409 TmpDevicePath
= DevicePath
;
410 Status
= gBS
->LocateDevicePath(&gEfiDevicePathProtocolGuid
, &TmpDevicePath
, &ControllerHandle
);
411 if (EFI_ERROR (Status
)) {
415 if (!IsDevicePathEnd (TmpDevicePath
)) {
420 // Retrieve the list of agents that are consuming the specific protocol
421 // on ControllerHandle.
422 // The buffer point by OpenInfoBuffer need be free at this function.
424 Status
= gBS
->OpenProtocolInformation (
426 &gEfiPciIoProtocolGuid
,
430 if (EFI_ERROR (Status
)) {
435 // Inspect if ChildHandle is one of the agents.
437 Status
= EFI_UNSUPPORTED
;
438 for (Index
= 0; Index
< EntryCount
; Index
++) {
440 // Query all the children created by the controller handle's driver
442 if ((OpenInfoBuffer
[Index
].Attributes
& EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
) != 0) {
443 Status
= gBS
->OpenProtocol (
444 OpenInfoBuffer
[Index
].ControllerHandle
,
445 &gEfiDevicePathProtocolGuid
,
446 (VOID
**) &ChildDevicePath
,
449 EFI_OPEN_PROTOCOL_GET_PROTOCOL
451 if (EFI_ERROR (Status
)) {
456 // Check whether this device path include mac address device path.
458 if (!IsMacAddressDevicePath(ChildDevicePath
, NextShowFormId
,&IsNeedAdd
)) {
460 // If this path not has mac address path, check the other.
465 // If need to update the NETWORK_DEVICE_LIST_FORM, try to get more.
467 if ((NETWORK_DEVICE_LIST_FORM_ID
== NextShowFormId
)) {
474 // If need to update other form, return whether need to add to the menu.
483 if (OpenInfoBuffer
!= NULL
) {
484 FreePool (OpenInfoBuffer
);
490 Dynamic create Hii information for Device Manager.
492 @param NextShowFormId The FormId which need to be show.
496 CreateDeviceManagerForm(
497 IN EFI_FORM_ID NextShowFormId
503 EFI_STRING_ID TokenHelp
;
504 EFI_HII_HANDLE
*HiiHandles
;
505 EFI_HII_HANDLE HiiHandle
;
506 EFI_GUID FormSetGuid
;
507 VOID
*StartOpCodeHandle
;
508 VOID
*EndOpCodeHandle
;
509 EFI_IFR_GUID_LABEL
*StartLabel
;
510 EFI_IFR_GUID_LABEL
*EndLabel
;
511 BOOLEAN AddNetworkMenu
;
514 EFI_STRING NewStringTitle
;
515 CHAR16
*DevicePathStr
;
516 EFI_STRING_ID DevicePathId
;
517 EFI_IFR_FORM_SET
*Buffer
;
529 HiiHandle
= gDeviceManagerPrivate
.HiiHandle
;
530 AddNetworkMenu
= FALSE
;
533 // If need show the Network device list form, clear the old save list first.
535 if ((NextShowFormId
== NETWORK_DEVICE_LIST_FORM_ID
) && (mMacDeviceList
.CurListLen
> 0)) {
536 mMacDeviceList
.CurListLen
= 0;
540 // Update the network device form titile.
542 if (NextShowFormId
== NETWORK_DEVICE_FORM_ID
) {
543 String
= HiiGetString (HiiHandle
, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE_HEAD
), NULL
);
544 if (String
== NULL
) {
547 NewStringLen
= StrLen (mSelectedMacAddrString
) * 2;
548 NewStringLen
+= (StrLen (String
) + 2) * 2;
549 NewStringTitle
= AllocatePool (NewStringLen
);
550 UnicodeSPrint (NewStringTitle
, NewStringLen
, L
"%s %s", String
, mSelectedMacAddrString
);
551 HiiSetString (HiiHandle
, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE
), NewStringTitle
, NULL
);
553 FreePool (NewStringTitle
);
557 // Allocate space for creation of UpdateData Buffer
559 StartOpCodeHandle
= HiiAllocateOpCodeHandle ();
560 ASSERT (StartOpCodeHandle
!= NULL
);
562 EndOpCodeHandle
= HiiAllocateOpCodeHandle ();
563 ASSERT (EndOpCodeHandle
!= NULL
);
566 // Create Hii Extend Label OpCode as the start opcode
568 StartLabel
= (EFI_IFR_GUID_LABEL
*) HiiCreateGuidOpCode (StartOpCodeHandle
, &gEfiIfrTianoGuid
, NULL
, sizeof (EFI_IFR_GUID_LABEL
));
569 StartLabel
->ExtendOpCode
= EFI_IFR_EXTEND_OP_LABEL
;
571 // According to the next show Form id(mNextShowFormId) to decide which form need to update.
573 StartLabel
->Number
= (UINT16
) (LABEL_FORM_ID_OFFSET
+ NextShowFormId
);
576 // Create Hii Extend Label OpCode as the end opcode
578 EndLabel
= (EFI_IFR_GUID_LABEL
*) HiiCreateGuidOpCode (EndOpCodeHandle
, &gEfiIfrTianoGuid
, NULL
, sizeof (EFI_IFR_GUID_LABEL
));
579 EndLabel
->ExtendOpCode
= EFI_IFR_EXTEND_OP_LABEL
;
580 EndLabel
->Number
= LABEL_END
;
583 // Get all the Hii handles
585 HiiHandles
= HiiGetHiiHandles (NULL
);
586 ASSERT (HiiHandles
!= NULL
);
589 // Search for formset of each class type
591 for (Index
= 0; HiiHandles
[Index
] != NULL
; Index
++) {
592 Status
= HiiGetFormSetFromHiiHandle(HiiHandles
[Index
], &Buffer
,&BufferSize
);
593 if (EFI_ERROR (Status
)){
596 Ptr
= (UINT8
*)Buffer
;
597 while(TempSize
< BufferSize
) {
598 TempSize
+= ((EFI_IFR_OP_HEADER
*) Ptr
)->Length
;
599 if (((EFI_IFR_OP_HEADER
*) Ptr
)->Length
<= OFFSET_OF (EFI_IFR_FORM_SET
, Flags
)){
600 Ptr
+= ((EFI_IFR_OP_HEADER
*) Ptr
)->Length
;
604 ClassGuidNum
= (UINT8
) (((EFI_IFR_FORM_SET
*)Ptr
)->Flags
& 0x3);
605 ClassGuid
= (EFI_GUID
*) (VOID
*)(Ptr
+ sizeof (EFI_IFR_FORM_SET
));
606 while (ClassGuidNum
-- > 0) {
607 if (CompareGuid (&gEfiHiiPlatformSetupFormsetGuid
, ClassGuid
)== 0) {
612 String
= HiiGetString (HiiHandles
[Index
], ((EFI_IFR_FORM_SET
*)Ptr
)->FormSetTitle
, NULL
);
613 if (String
== NULL
) {
614 String
= HiiGetString (HiiHandle
, STRING_TOKEN (STR_MISSING_STRING
), NULL
);
615 ASSERT (String
!= NULL
);
617 Token
= HiiSetString (HiiHandle
, 0, String
, NULL
);
620 String
= HiiGetString (HiiHandles
[Index
], ((EFI_IFR_FORM_SET
*)Ptr
)->Help
, NULL
);
621 if (String
== NULL
) {
622 String
= HiiGetString (HiiHandle
, STRING_TOKEN (STR_MISSING_STRING
), NULL
);
623 ASSERT (String
!= NULL
);
625 TokenHelp
= HiiSetString (HiiHandle
, 0, String
, NULL
);
628 FormSetGuid
= ((EFI_IFR_FORM_SET
*)Ptr
)->Guid
;
631 // Network device process
633 if (IsNeedAddNetworkMenu (HiiHandles
[Index
], NextShowFormId
,&AddItemCount
)) {
634 if (NextShowFormId
== DEVICE_MANAGER_FORM_ID
) {
636 // Only show one menu item "Network Config" in the device manger form.
638 if (!AddNetworkMenu
) {
639 AddNetworkMenu
= TRUE
;
640 HiiCreateGotoOpCode (
642 NETWORK_DEVICE_LIST_FORM_ID
,
643 STRING_TOKEN (STR_FORM_NETWORK_DEVICE_LIST_TITLE
),
644 STRING_TOKEN (STR_FORM_NETWORK_DEVICE_LIST_HELP
),
645 EFI_IFR_FLAG_CALLBACK
,
646 (EFI_QUESTION_ID
) QUESTION_NETWORK_DEVICE_ID
649 } else if (NextShowFormId
== NETWORK_DEVICE_LIST_FORM_ID
) {
651 // In network device list form, same mac address device only show one menu.
653 while (AddItemCount
> 0) {
654 HiiCreateGotoOpCode (
656 NETWORK_DEVICE_FORM_ID
,
657 mMacDeviceList
.NodeList
[mMacDeviceList
.CurListLen
- AddItemCount
].PromptId
,
658 STRING_TOKEN (STR_NETWORK_DEVICE_HELP
),
659 EFI_IFR_FLAG_CALLBACK
,
660 mMacDeviceList
.NodeList
[mMacDeviceList
.CurListLen
- AddItemCount
].QuestionId
664 } else if (NextShowFormId
== NETWORK_DEVICE_FORM_ID
) {
666 // In network device form, only the selected mac address device need to be show.
668 DevicePathStr
= DmExtractDevicePathFromHiiHandle(HiiHandles
[Index
]);
670 if (DevicePathStr
!= NULL
){
671 DevicePathId
= HiiSetString (HiiHandle
, 0, DevicePathStr
, NULL
);
672 FreePool(DevicePathStr
);
674 HiiCreateGotoExOpCode (
680 (EFI_QUESTION_ID
) (Index
+ DEVICE_KEY_OFFSET
),
688 // Not network device process, only need to show at device manger form.
690 if (NextShowFormId
== DEVICE_MANAGER_FORM_ID
) {
691 DevicePathStr
= DmExtractDevicePathFromHiiHandle(HiiHandles
[Index
]);
693 if (DevicePathStr
!= NULL
){
694 DevicePathId
= HiiSetString (HiiHandle
, 0, DevicePathStr
, NULL
);
695 FreePool(DevicePathStr
);
697 HiiCreateGotoExOpCode (
703 (EFI_QUESTION_ID
) (Index
+ DEVICE_KEY_OFFSET
),
713 Ptr
+= ((EFI_IFR_OP_HEADER
*) Ptr
)->Length
;
729 HiiFreeOpCodeHandle (StartOpCodeHandle
);
730 HiiFreeOpCodeHandle (EndOpCodeHandle
);
731 FreePool (HiiHandles
);
735 This function allows a caller to extract the current configuration for one
736 or more named elements from the target driver.
739 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
740 @param Request A null-terminated Unicode string in <ConfigRequest> format.
741 @param Progress On return, points to a character in the Request string.
742 Points to the string's null terminator if request was successful.
743 Points to the most recent '&' before the first failing name/value
744 pair (or the beginning of the string if the failure is in the
745 first name/value pair) if the request was not successful.
746 @param Results A null-terminated Unicode string in <ConfigAltResp> format which
747 has all values filled in for the names in the Request string.
748 String to be allocated by the called function.
750 @retval EFI_SUCCESS The Results is filled with the requested values.
751 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
752 @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
753 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
758 DeviceManagerExtractConfig (
759 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
760 IN CONST EFI_STRING Request
,
761 OUT EFI_STRING
*Progress
,
762 OUT EFI_STRING
*Results
765 if (Progress
== NULL
|| Results
== NULL
) {
766 return EFI_INVALID_PARAMETER
;
769 return EFI_NOT_FOUND
;
773 This function processes the results of changes in configuration.
775 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
776 @param Configuration A null-terminated Unicode string in <ConfigResp> format.
777 @param Progress A pointer to a string filled in with the offset of the most
778 recent '&' before the first failing name/value pair (or the
779 beginning of the string if the failure is in the first
780 name/value pair) or the terminating NULL if all was successful.
782 @retval EFI_SUCCESS The Results is processed successfully.
783 @retval EFI_INVALID_PARAMETER Configuration is NULL.
784 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
789 DeviceManagerRouteConfig (
790 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
791 IN CONST EFI_STRING Configuration
,
792 OUT EFI_STRING
*Progress
795 if (Configuration
== NULL
|| Progress
== NULL
) {
796 return EFI_INVALID_PARAMETER
;
799 *Progress
= Configuration
;
801 return EFI_NOT_FOUND
;
805 This function is invoked if user selected a interactive opcode from Device Manager's
806 Formset. If user set VBIOS, the new value is saved to EFI variable.
808 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
809 @param Action Specifies the type of action taken by the browser.
810 @param QuestionId A unique value which is sent to the original exporting driver
811 so that it can identify the type of data to expect.
812 @param Type The type of value for the question.
813 @param Value A pointer to the data being sent to the original exporting driver.
814 @param ActionRequest On return, points to the action requested by the callback function.
816 @retval EFI_SUCCESS The callback successfully handled the action.
817 @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
822 DeviceManagerCallback (
823 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
824 IN EFI_BROWSER_ACTION Action
,
825 IN EFI_QUESTION_ID QuestionId
,
827 IN EFI_IFR_TYPE_VALUE
*Value
,
828 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest
833 if (Action
!= EFI_BROWSER_ACTION_CHANGING
) {
835 // Do nothing for other UEFI Action. Only do call back when data is changed.
837 return EFI_UNSUPPORTED
;
839 if ((Value
== NULL
) || (ActionRequest
== NULL
)) {
840 return EFI_INVALID_PARAMETER
;
842 if ((QuestionId
< MAX_KEY_SECTION_LEN
+ NETWORK_DEVICE_LIST_KEY_OFFSET
) && (QuestionId
>= NETWORK_DEVICE_LIST_KEY_OFFSET
)) {
844 // If user select the mac address, need to record mac address string to support next form show.
846 for (CurIndex
= 0; CurIndex
< mMacDeviceList
.CurListLen
; CurIndex
++) {
847 if (mMacDeviceList
.NodeList
[CurIndex
].QuestionId
== QuestionId
) {
848 mSelectedMacAddrString
= HiiGetString (gDeviceManagerPrivate
.HiiHandle
, mMacDeviceList
.NodeList
[CurIndex
].PromptId
, NULL
);
851 CreateDeviceManagerForm(NETWORK_DEVICE_FORM_ID
);
852 } else if(QuestionId
== QUESTION_NETWORK_DEVICE_ID
){
853 CreateDeviceManagerForm(NETWORK_DEVICE_LIST_FORM_ID
);
860 Install Boot Manager Menu driver.
862 @param ImageHandle The image handle.
863 @param SystemTable The system table.
865 @retval EFI_SUCEESS Install Boot manager menu success.
866 @retval Other Return error status.
871 DeviceManagerUiLibConstructor (
872 IN EFI_HANDLE ImageHandle
,
873 IN EFI_SYSTEM_TABLE
*SystemTable
878 gDeviceManagerPrivate
.DriverHandle
= NULL
;
879 Status
= gBS
->InstallMultipleProtocolInterfaces (
880 &gDeviceManagerPrivate
.DriverHandle
,
881 &gEfiDevicePathProtocolGuid
,
882 &mDeviceManagerHiiVendorDevicePath
,
883 &gEfiHiiConfigAccessProtocolGuid
,
884 &gDeviceManagerPrivate
.ConfigAccess
,
887 ASSERT_EFI_ERROR (Status
);
890 // Publish our HII data.
892 gDeviceManagerPrivate
.HiiHandle
= HiiAddPackages (
894 gDeviceManagerPrivate
.DriverHandle
,
896 DeviceManagerUiLibStrings
,
899 ASSERT (gDeviceManagerPrivate
.HiiHandle
!= NULL
);
902 // Update boot manager page
904 CreateDeviceManagerForm (DEVICE_MANAGER_FORM_ID
);
910 Unloads the application and its installed protocol.
912 @param ImageHandle Handle that identifies the image to be unloaded.
913 @param SystemTable The system table.
915 @retval EFI_SUCCESS The image has been unloaded.
919 DeviceManagerUiLibDestructor(
920 IN EFI_HANDLE ImageHandle
,
921 IN EFI_SYSTEM_TABLE
*SystemTable
926 Status
= gBS
->UninstallMultipleProtocolInterfaces (
927 gDeviceManagerPrivate
.DriverHandle
,
928 &gEfiDevicePathProtocolGuid
,
929 &mDeviceManagerHiiVendorDevicePath
,
930 &gEfiHiiConfigAccessProtocolGuid
,
931 &gDeviceManagerPrivate
.ConfigAccess
,
934 ASSERT_EFI_ERROR (Status
);
936 HiiRemovePackages (gDeviceManagerPrivate
.HiiHandle
);