TianoCore EDK2 master
Loading...
Searching...
No Matches
DeviceManager.c File Reference
#include "DeviceManager.h"

Go to the source code of this file.

Macros

#define MAX_MAC_ADDRESS_NODE_LIST_LEN   10
 

Functions

CHAR16 * DmExtractDevicePathFromHiiHandle (IN EFI_HII_HANDLE Handle)
 
BOOLEAN GetMacAddressString (IN MAC_ADDR_DEVICE_PATH *MacAddressNode, OUT CHAR16 **PBuffer)
 
BOOLEAN AddIdToMacDeviceList (IN EFI_STRING MacAddrString)
 
BOOLEAN IsMacAddressDevicePath (IN VOID *Node, IN EFI_FORM_ID NextShowFormId, OUT BOOLEAN *NeedAddItem)
 
BOOLEAN IsNeedAddNetworkMenu (IN EFI_HII_HANDLE Handle, IN EFI_FORM_ID NextShowFormId, OUT UINTN *ItemCount)
 
VOID CreateDeviceManagerForm (IN EFI_FORM_ID NextShowFormId)
 
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 DeviceManagerRouteConfig (IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
 
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 DeviceManagerUiLibConstructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
EFI_STATUS EFIAPI DeviceManagerUiLibDestructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

DEVICE_MANAGER_CALLBACK_DATA gDeviceManagerPrivate
 
EFI_GUID mDeviceManagerGuid = DEVICE_MANAGER_FORMSET_GUID
 
EFI_STRING mSelectedMacAddrString
 
MAC_ADDRESS_NODE_LIST mMacDeviceList
 
HII_VENDOR_DEVICE_PATH mDeviceManagerHiiVendorDevicePath
 

Detailed Description

The device manager reference implementation

Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file DeviceManager.c.

Macro Definition Documentation

◆ MAX_MAC_ADDRESS_NODE_LIST_LEN

#define MAX_MAC_ADDRESS_NODE_LIST_LEN   10

Definition at line 22 of file DeviceManager.c.

Function Documentation

◆ AddIdToMacDeviceList()

BOOLEAN AddIdToMacDeviceList ( IN EFI_STRING  MacAddrString)

Save question id and prompt id to the mac device list. If the same mac address has saved yet, no need to add more.

Parameters
MacAddrStringMac address string.
Return values
EFI_SUCCESSAdd the item is successful.
Returns
Other values if failed to Add the item.

Definition at line 203 of file DeviceManager.c.

◆ CreateDeviceManagerForm()

VOID CreateDeviceManagerForm ( IN EFI_FORM_ID  NextShowFormId)

Dynamic create Hii information for Device Manager.

Parameters
NextShowFormIdThe FormId which need to be show.

Definition at line 505 of file DeviceManager.c.

◆ DeviceManagerCallback()

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 
)

This function is invoked if user selected a interactive opcode from Device Manager's Formset. If user set VBIOS, the new value is saved to EFI variable.

Parameters
ThisPoints to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
ActionSpecifies the type of action taken by the browser.
QuestionIdA unique value which is sent to the original exporting driver so that it can identify the type of data to expect.
TypeThe type of value for the question.
ValueA pointer to the data being sent to the original exporting driver.
ActionRequestOn return, points to the action requested by the callback function.
Return values
EFI_SUCCESSThe callback successfully handled the action.
EFI_INVALID_PARAMETERThe setup browser call this function with invalid parameters.

Definition at line 840 of file DeviceManager.c.

◆ DeviceManagerExtractConfig()

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 
)

This function allows a caller to extract the current configuration for one or more named elements from the target driver.

Parameters
ThisPoints to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
RequestA null-terminated Unicode string in <ConfigRequest> format.
ProgressOn return, points to a character in the Request string. Points to the string's null terminator if request was successful. Points to the most recent '&' before the first failing name/value pair (or the beginning of the string if the failure is in the first name/value pair) if the request was not successful.
ResultsA null-terminated Unicode string in <ConfigAltResp> format which has all values filled in for the names in the Request string. String to be allocated by the called function.
Return values
EFI_SUCCESSThe Results is filled with the requested values.
EFI_OUT_OF_RESOURCESNot enough memory to store the results.
EFI_INVALID_PARAMETERRequest is illegal syntax, or unknown name.
EFI_NOT_FOUNDRouting data doesn't match any storage in this driver.

Definition at line 775 of file DeviceManager.c.

◆ DeviceManagerRouteConfig()

EFI_STATUS EFIAPI DeviceManagerRouteConfig ( IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL This,
IN CONST EFI_STRING  Configuration,
OUT EFI_STRING *  Progress 
)

This function processes the results of changes in configuration.

Parameters
ThisPoints to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
ConfigurationA null-terminated Unicode string in <ConfigResp> format.
ProgressA pointer to a string filled in with the offset of the most recent '&' before the first failing name/value pair (or the beginning of the string if the failure is in the first name/value pair) or the terminating NULL if all was successful.
Return values
EFI_SUCCESSThe Results is processed successfully.
EFI_INVALID_PARAMETERConfiguration is NULL.
EFI_NOT_FOUNDRouting data doesn't match any storage in this driver.

Definition at line 807 of file DeviceManager.c.

◆ DeviceManagerUiLibConstructor()

EFI_STATUS EFIAPI DeviceManagerUiLibConstructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Install Boot Manager Menu driver.

Parameters
ImageHandleThe image handle.
SystemTableThe system table.
Return values
EFI_SUCEESSInstall Boot manager menu success.
OtherReturn error status.

Definition at line 892 of file DeviceManager.c.

◆ DeviceManagerUiLibDestructor()

EFI_STATUS EFIAPI DeviceManagerUiLibDestructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Unloads the application and its installed protocol.

Parameters
ImageHandleHandle that identifies the image to be unloaded.
SystemTableThe system table.
Return values
EFI_SUCCESSThe image has been unloaded.

Definition at line 947 of file DeviceManager.c.

◆ DmExtractDevicePathFromHiiHandle()

CHAR16 * DmExtractDevicePathFromHiiHandle ( IN EFI_HII_HANDLE  Handle)

Extract device path for given HII handle and class guid.

Parameters
HandleThe HII handle.
Return values
NULLFail to get the device path string.
Returns
PathString Get the device path string.

Definition at line 73 of file DeviceManager.c.

◆ GetMacAddressString()

BOOLEAN GetMacAddressString ( IN MAC_ADDR_DEVICE_PATH MacAddressNode,
OUT CHAR16 **  PBuffer 
)

Get the mac address string from the device path. if the device path has the vlan, get the vanid also.

Parameters
MacAddressNodeDevice path begin with mac address
PBufferOutput string buffer contain mac address.

Definition at line 106 of file DeviceManager.c.

◆ IsMacAddressDevicePath()

BOOLEAN IsMacAddressDevicePath ( IN VOID *  Node,
IN EFI_FORM_ID  NextShowFormId,
OUT BOOLEAN *  NeedAddItem 
)

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.

Parameters
*NodeInput device which need to be check.
NextShowFormIdFormId Which need to be show.
*NeedAddItemWhether need to add the menu in the network device list.
Return values
TRUEHas mac address device path.
FALSENOT Has mac address device path.

Definition at line 280 of file DeviceManager.c.

◆ IsNeedAddNetworkMenu()

BOOLEAN IsNeedAddNetworkMenu ( IN EFI_HII_HANDLE  Handle,
IN EFI_FORM_ID  NextShowFormId,
OUT UINTN ItemCount 
)

Check to see if the device path is for the network device.

Parameters
HandleThe HII handle which include the mac address device path.
NextShowFormIdThe FormId of the form which will be show next time.
ItemCountThe new add Mac address item count.
Return values
TRUENeed to add new item in the menu.
Returns
FALSE Do not need to add the menu about the network.

Definition at line 358 of file DeviceManager.c.

Variable Documentation

◆ gDeviceManagerPrivate

DEVICE_MANAGER_CALLBACK_DATA gDeviceManagerPrivate
Initial value:
= {
DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE,
{
}
}
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 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 NULL
Definition: Base.h:319

Definition at line 11 of file DeviceManager.c.

◆ mDeviceManagerGuid

EFI_GUID mDeviceManagerGuid = DEVICE_MANAGER_FORMSET_GUID

Definition at line 24 of file DeviceManager.c.

◆ mDeviceManagerHiiVendorDevicePath

HII_VENDOR_DEVICE_PATH mDeviceManagerHiiVendorDevicePath
Initial value:
= {
{
{
{
(UINT8)(sizeof (VENDOR_DEVICE_PATH)),
(UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
}
},
{ 0x102579a0, 0x3686, 0x466e, { 0xac, 0xd8, 0x80, 0xc0, 0x87, 0x4, 0x4f, 0x4a }
}
},
{
END_DEVICE_PATH_TYPE,
END_ENTIRE_DEVICE_PATH_SUBTYPE,
{
(UINT8)(END_DEVICE_PATH_LENGTH),
(UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
}
}
}
#define HARDWARE_DEVICE_PATH
Definition: DevicePath.h:68
#define HW_VENDOR_DP
Definition: DevicePath.h:133

Definition at line 37 of file DeviceManager.c.

◆ mMacDeviceList

MAC_ADDRESS_NODE_LIST mMacDeviceList

Definition at line 35 of file DeviceManager.c.

◆ mSelectedMacAddrString

EFI_STRING mSelectedMacAddrString

Definition at line 30 of file DeviceManager.c.