]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/PcdTools/org/tianocore/pcd/entity/DynamicTokenValue.java
2 DynamicTokenValue class.
4 This module contains the value type of a dynamic token.
6 Copyright (c) 2006, Intel Corporation
7 All rights reserved. This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 package org
.tianocore
.pcd
.entity
;
18 import java
.util
.List
;
19 import java
.util
.UUID
;
21 import org
.tianocore
.pcd
.exception
.EntityException
;
24 This class is to descript a value type of dynamic PCD.
25 For a dynamic or dynamicEx type PCD data, the value type can be:
26 1) Hii type: the value of dynamic or dynamicEx is stored into a variable.
27 2) Vpd type: the value of dynamic or dynamicEx is stored into somewhere set
29 3) Default type: the value of dynamic or dynamicEx is stored into PCD dynamic
32 public class DynamicTokenValue
{
34 /// Enumeration macro defintion for value type.
36 public static enum VALUE_TYPE
{HII_TYPE
, VPD_TYPE
, DEFAULT_TYPE
}
39 /// The value type maybe:
40 /// HII_TYPE: the value stored into variable area.
41 /// VPD_TYPE: the value stored into OEM specific area.
42 /// DEFAULT_TYPE: the value stored into PCD runtime database.
44 public VALUE_TYPE type
;
47 /// ---------------------------------------------------------------------
48 /// Following member is for HII case. The value of HII case will be put
49 /// into variable area in flash.
50 /// ---------------------------------------------------------------------
54 /// variableName is valid only when this token support Hii functionality. variableName
55 /// indicates the value of token is associated with what variable.
56 /// variableName is defined in FPD.
57 public List variableName
;
60 /// variableGuid is the GUID this token associated with.
62 public UUID variableGuid
;
65 /// Variable offset indicate the associated variable's offset in NV storage.
67 public String variableOffset
;
70 /// The default value for HII case.
72 public String hiiDefaultValue
;
75 /// ---------------------------------------------------------------------
76 /// Following member is for VPD case. The value of VPD case will be put into
77 /// some flash position pointed by OEM.
78 /// ---------------------------------------------------------------------
81 public String vpdOffset
;
83 /// ---------------------------------------------------------------------
84 /// Following member is for default case. The value of default type will
85 /// be put into PCD runtime database.
86 /// ---------------------------------------------------------------------
89 /// The default value of this PCD in default case.
94 Constructor function for DynamicTokenValue class.
97 public DynamicTokenValue() {
98 type
= VALUE_TYPE
.DEFAULT_TYPE
;
101 variableOffset
= null;
102 hiiDefaultValue
= null;
108 Set the HII case data.
110 @param variableName The variable name
111 @param variableGuid The variable guid
112 @param variableOffset The offset of value in this variable
113 @param hiiDefaultValue Default value for this PCD
115 public void setHiiData(List variableName
,
117 String variableOffset
,
118 String hiiDefaultValue
) {
119 this.type
= VALUE_TYPE
.HII_TYPE
;
121 this.variableName
= variableName
;
122 this.variableGuid
= variableGuid
;
123 this.variableOffset
= variableOffset
;
124 this.hiiDefaultValue
= hiiDefaultValue
;
128 Get the string like L"xxx" for a variable Name.
130 BUGBUG: In fact, it is not correctly, variable name should be
131 treated as unicode UINT16 array.
135 public String
getStringOfVariableName()
136 throws EntityException
{
142 size
= variableName
.size();
143 for (index
= 0; index
< size
; index
++) {
144 num
= Integer
.decode(variableName
.get(index
).toString());
145 if ((num
> 127 ) || (num
< 0)) {
146 throw new EntityException(String
.format("variable name contains >0x80 character, now is not support!"));
157 @param vpdOffset the value offset the start address of OEM specific.
159 public void setVpdData(String vpdOffset
) {
160 this.type
= VALUE_TYPE
.VPD_TYPE
;
162 this.vpdOffset
= vpdOffset
;
166 Set default case data.
170 public void setValue(String value
) {
171 this.type
= VALUE_TYPE
.DEFAULT_TYPE
;