summaryrefslogtreecommitdiff
path: root/Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableCommon.h
blob: b6554764b70db7666377bb3dbaafb96f0d3a1b58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/** @file
  Large Variable Lib Common Header

  These libraries is used to store large data sets using the UEFI Variable
  Services. At time of writing, most UEFI Variable Services implementations do
  not allow more than 64KB of data to be stored in a single UEFI variable. This
  library will split data sets across multiple variables as needed.

  In the case where more than one variable is needed to store the data, an
  integer number will be added to the end of the variable name. This number
  will be incremented for each variable as needed to retrieve the entire data
  set.

  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
  SPDX-License-Identifier: BSD-2-Clause-Patent

**/

#ifndef _LARGE_VARIABLE_COMMON_H_
#define _LARGE_VARIABLE_COMMON_H_

//
// 1024 was choosen because this is the size of the SMM communication buffer
// used by VariableDxeSmm to transfer the VariableName from DXE to SMM. Choosing
// the same size will prevent this library from limiting variable names any
// more than the MdeModulePkg implementation of UEFI Variable Services does.
//
#define MAX_VARIABLE_NAME_SIZE      1024

//
// The 2012 Windows Hardware Requirements specified a minimum variable size of
// 32KB. By setting the maximum allowed number of variables to 0x20000, this
// allows up to 4GB of data to be stored on most UEFI implementations in
// existence. Older UEFI implementations were known to only provide 8KB per
// variable. In this case, up to 1GB can be stored. Since 1GB vastly exceeds the
// size of any known NvStorage FV, choosing this number should effectively
// enable all available NvStorage space to be used to store the given data.
//
#define MAX_VARIABLE_SPLIT          131072  // 0x20000

//
// There are 6 digits in the number 131072, which means the length of the string
// representation of this number will be at most 6 characters long.
//
#define MAX_VARIABLE_SPLIT_DIGITS   6

#endif  // _LARGE_VARIABLE_COMMON_H_