/** @file\r
The device manager reference implementation\r
\r
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
{\r
END_DEVICE_PATH_TYPE,\r
END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
- { \r
+ {\r
(UINT8) (END_DEVICE_PATH_LENGTH),\r
(UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)\r
}\r
/**\r
Get the mac address string from the device path.\r
if the device path has the vlan, get the vanid also.\r
- \r
- @param MacAddressNode Device path begin with mac address \r
+\r
+ @param MacAddressNode Device path begin with mac address\r
@param PBuffer Output string buffer contain mac address.\r
\r
**/\r
-BOOLEAN \r
+BOOLEAN\r
GetMacAddressString(\r
IN MAC_ADDR_DEVICE_PATH *MacAddressNode,\r
OUT CHAR16 **PBuffer\r
*PBuffer = String;\r
StrCpyS(String, BufferLen / sizeof (CHAR16), L"MAC:");\r
String += 4;\r
- \r
+\r
//\r
// Convert the MAC address into a unicode string.\r
//\r
@retval EFI_SUCCESS Add the item is successful.\r
@return Other values if failed to Add the item.\r
**/\r
-BOOLEAN \r
+BOOLEAN\r
AddIdToMacDeviceList (\r
IN EFI_STRING MacAddrString\r
)\r
} else {\r
mMacDeviceList.MaxListLen += MAX_MAC_ADDRESS_NODE_LIST_LEN;\r
if (mMacDeviceList.CurListLen != 0) {\r
- TempDeviceList = (MENU_INFO_ITEM *)AllocateCopyPool (sizeof (MENU_INFO_ITEM) * mMacDeviceList.MaxListLen, (VOID *)mMacDeviceList.NodeList);\r
+ TempDeviceList = ReallocatePool (\r
+ sizeof (MENU_INFO_ITEM) * mMacDeviceList.CurListLen,\r
+ sizeof (MENU_INFO_ITEM) * mMacDeviceList.MaxListLen,\r
+ mMacDeviceList.NodeList\r
+ );\r
} else {\r
TempDeviceList = (MENU_INFO_ITEM *)AllocatePool (sizeof (MENU_INFO_ITEM) * mMacDeviceList.MaxListLen);\r
}\r
if (TempDeviceList == NULL) {\r
return FALSE;\r
}\r
- TempDeviceList[mMacDeviceList.CurListLen].PromptId = PromptId; \r
+ TempDeviceList[mMacDeviceList.CurListLen].PromptId = PromptId;\r
TempDeviceList[mMacDeviceList.CurListLen].QuestionId = (EFI_QUESTION_ID) (mMacDeviceList.CurListLen + NETWORK_DEVICE_LIST_KEY_OFFSET);\r
\r
- if (mMacDeviceList.CurListLen > 0) {\r
- FreePool(mMacDeviceList.NodeList);\r
- }\r
-\r
mMacDeviceList.NodeList = TempDeviceList;\r
}\r
mMacDeviceList.CurListLen ++;\r
if (DEVICE_MANAGER_FORM_ID == NextShowFormId) {\r
*NeedAddItem = TRUE;\r
break;\r
- } \r
- \r
+ }\r
+\r
if (!GetMacAddressString((MAC_ADDR_DEVICE_PATH*)DevicePath, &Buffer)) {\r
break;\r
}\r
\r
if (NETWORK_DEVICE_LIST_FORM_ID == NextShowFormId) {\r
//\r
- // Same handle may has two network child handle, so the questionid \r
+ // Same handle may has two network child handle, so the questionid\r
// has the offset of SAME_HANDLE_KEY_OFFSET.\r
//\r
if (AddIdToMacDeviceList (Buffer)) {\r
@return FALSE Do not need to add the menu about the network.\r
\r
**/\r
-BOOLEAN \r
+BOOLEAN\r
IsNeedAddNetworkMenu (\r
IN EFI_HII_HANDLE Handle,\r
IN EFI_FORM_ID NextShowFormId,\r
{\r
EFI_STATUS Status;\r
UINTN EntryCount;\r
- UINTN Index; \r
+ UINTN Index;\r
EFI_HANDLE DriverHandle;\r
EFI_HANDLE ControllerHandle;\r
EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
}\r
TmpDevicePath = DevicePath;\r
\r
- // \r
+ //\r
// Check whether this device path include mac address device path.\r
- // If this path has mac address path, get the value whether need \r
+ // If this path has mac address path, get the value whether need\r
// add this info to the menu and return.\r
// Else check more about the child handle devcie path.\r
//\r
}\r
\r
if (!IsDevicePathEnd (TmpDevicePath)) {\r
- return FALSE; \r
+ return FALSE;\r
}\r
\r
//\r
continue;\r
}\r
\r
- // \r
+ //\r
// Check whether this device path include mac address device path.\r
//\r
if (!IsMacAddressDevicePath(ChildDevicePath, NextShowFormId,&IsNeedAdd)) {\r
} else {\r
//\r
// If need to update other form, return whether need to add to the menu.\r
- // \r
+ //\r
goto Done;\r
}\r
}\r
\r
Done:\r
if (OpenInfoBuffer != NULL) {\r
- FreePool (OpenInfoBuffer); \r
+ FreePool (OpenInfoBuffer);\r
}\r
- return IsNeedAdd; \r
+ return IsNeedAdd;\r
}\r
\r
/**\r
EFI_STRING NewStringTitle;\r
CHAR16 *DevicePathStr;\r
EFI_STRING_ID DevicePathId;\r
- EFI_IFR_FORM_SET *Buffer; \r
- UINTN BufferSize; \r
- UINT8 ClassGuidNum; \r
- EFI_GUID *ClassGuid; \r
+ EFI_IFR_FORM_SET *Buffer;\r
+ UINTN BufferSize;\r
+ UINT8 ClassGuidNum;\r
+ EFI_GUID *ClassGuid;\r
UINTN TempSize;\r
UINT8 *Ptr;\r
EFI_STATUS Status;\r
if (((EFI_IFR_OP_HEADER *) Ptr)->Length <= OFFSET_OF (EFI_IFR_FORM_SET, Flags)){\r
Ptr += ((EFI_IFR_OP_HEADER *) Ptr)->Length;\r
continue;\r
- } \r
+ }\r
\r
ClassGuidNum = (UINT8) (((EFI_IFR_FORM_SET *)Ptr)->Flags & 0x3);\r
ClassGuid = (EFI_GUID *) (VOID *)(Ptr + sizeof (EFI_IFR_FORM_SET));\r
\r
//\r
// Network device process\r
- // \r
+ //\r
if (IsNeedAddNetworkMenu (HiiHandles[Index], NextShowFormId,&AddItemCount)) {\r
if (NextShowFormId == DEVICE_MANAGER_FORM_ID) {\r
//\r
0,\r
(EFI_QUESTION_ID) (Index + DEVICE_KEY_OFFSET),\r
0,\r
- &FormSetGuid, \r
+ &FormSetGuid,\r
DevicePathId\r
);\r
}\r
ASSERT (gDeviceManagerPrivate.HiiHandle != NULL);\r
\r
//\r
- // Update boot manager page \r
+ // Update boot manager page\r
//\r
CreateDeviceManagerForm (DEVICE_MANAGER_FORM_ID);\r
\r