+++ /dev/null
-/** @file\r
- This file is for functins related to assign and free Framework HII handle number.\r
- \r
-Copyright (c) 2008 - 2010, 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
-\r
-**/\r
-\r
-\r
-#include "HiiHandle.h"\r
-\r
-//\r
-// FRAMEWORK_EFI_HII_HANDLE\r
-//\r
-UINT8 mHandle[1024 * 8] = {0};\r
-\r
-/**\r
-\r
- Initialize the Framework Hii Handle database.\r
-\r
-**/\r
-VOID\r
-InitHiiHandleDatabase (\r
- VOID\r
- )\r
-{\r
- //\r
- // FRAMEWORK_EFI_HII_HANDLE 0 is reserved.\r
- // Set Bit 0 in mHandle[0] to 1.\r
- //\r
- mHandle[0] |= 1 << 0;\r
-}\r
-\r
-/**\r
- Allocate a new Framework HII handle. \r
-\r
- @param Handle Returns the new Framework HII Handle assigned.\r
-\r
- @retval EFI_SUCCESS A new Framework HII Handle is assigned.\r
- @retval EFI_OUT_OF_RESOURCE The Framework HII Handle database is depleted.\r
-\r
-**/\r
-EFI_STATUS\r
-AllocateHiiHandle (\r
- OUT FRAMEWORK_EFI_HII_HANDLE *Handle\r
- )\r
-{\r
- UINTN Index;\r
-\r
- for (Index = 0; Index < sizeof (mHandle) * 8; Index++) {\r
- if ((mHandle[Index / 8] & (1 << (Index % 8))) == 0) {\r
- mHandle[Index / 8] = (UINT8) (mHandle[Index / 8] | (1 << (Index % 8)));\r
- *Handle = (FRAMEWORK_EFI_HII_HANDLE) Index;\r
- ASSERT (*Handle != 0);\r
- return EFI_SUCCESS;\r
- }\r
- }\r
- \r
- return EFI_OUT_OF_RESOURCES;\r
-}\r
-\r
-/**\r
- Free Framework HII handle. \r
-\r
- @param Handle The Framework HII Handle to be freed.\r
-\r
-**/\r
-VOID\r
-FreeHiiHandle (\r
- IN FRAMEWORK_EFI_HII_HANDLE Handle\r
- )\r
-{\r
- UINT16 Num;\r
-\r
- Num = (UINT16) Handle;\r
-\r
- ASSERT ((mHandle [Num / 8] & (1 << (Num % 8))) != 0);\r
- mHandle [Num / 8] = (UINT8) (mHandle [Num / 8] & (~(1 << (Num % 8))));\r
-}\r