2 This file is for functins related to assign and free Framework HII handle number.
4 Copyright (c) 2008, Intel Corporation
5 All rights reserved. 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.
16 #include "HiiHandle.h"
19 // FRAMEWORK_EFI_HII_HANDLE
21 UINT8 mHandle
[1024 * 8] = {0};
24 InitHiiHandleDatabase (
29 // FRAMEWORK_EFI_HII_HANDLE 0 is reserved.
30 // Set Bit 0 in mHandle[0] to 1.
38 FRAMEWORK_EFI_HII_HANDLE
*Handle
43 for (Index
= 0; Index
< sizeof (mHandle
) * 8; Index
++) {
44 if ((mHandle
[Index
/ 8] & (1 << (Index
% 8))) == 0) {
45 mHandle
[Index
/ 8] |= (1 << (Index
% 8));
46 *Handle
= (FRAMEWORK_EFI_HII_HANDLE
) Index
;
47 ASSERT (*Handle
!= 0);
52 return EFI_OUT_OF_RESOURCES
;
57 FRAMEWORK_EFI_HII_HANDLE Handle
62 Num
= (UINT16
) Handle
;
64 ASSERT ((mHandle
[Num
/ 8] & (1 << (Num
% 8))) != 0);
65 mHandle
[Num
/ 8] &= (~(1 << (Num
% 8)));