Commit Graph

227 Commits

Author SHA1 Message Date
czhang46 d17c4eac56 Fix a potential SMM memory dump issue. If pass communication buffer with DataBuffer to SMM SetVariable which is big enough to cover SMM range. Then GetVariable can dump SMM memory contents. Add more range check for SetVariable
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by  : Dong Guo   <guo.dong@intel.com>
Reviewed-by  : Jiewen Yao <jiewen.yao@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14292 6f19259b-4bc3-4df7-8a09-765794883524
2013-04-19 01:35:02 +00:00
czhang46 3a146f2a7d Fix SMM Variable driver stack GetVariable return INVALID_PARAMETER when DataSize is bigger than SMM communication buffer.
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by  : Dong Guo   <guo.dong@intel.com>
Reviewed-by  : Fu Siyuan  <siyuan.fu@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14276 6f19259b-4bc3-4df7-8a09-765794883524
2013-04-15 01:56:31 +00:00
czhang46 0c55190f40 Update SMM variable DXE driver GetNextVariable interface to comply with UEFI spec
VariableNameSize is the returned buffer size. GetNextVariable should behavior correct if it is bigger than SMM communication buffer or less than string size of VariableName. 

Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by  : Dong Guo   <guo.dong@intel.com>
Reviewed-by  : Fu Siyuan  <siyuan.fu@intel.com>
Reviewed-by  : Zeng Star  <star.zeng@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14258 6f19259b-4bc3-4df7-8a09-765794883524
2013-04-12 05:59:11 +00:00
lzeng14 3588bb3529 If DataSize or VariableNameSize is near MAX_ADDRESS, this can cause the computed PayLoadSize to overflow to a small value and pass the check in InitCommunicateBuffer(). To protect against this vulnerability, check DataSize and VariableNameSize to make sure PayloadSize doesn't overflow.
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14252 6f19259b-4bc3-4df7-8a09-765794883524
2013-04-08 06:56:08 +00:00
lzeng14 932e0f6628 Variables with state VAR_ADDED&VAR_IN_DELETED_TRANSITION should be considered as valid variables if there is no duplicated ones with VAR_ADDED state.
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14085 6f19259b-4bc3-4df7-8a09-765794883524
2013-01-25 06:17:43 +00:00
lzeng14 0cc565deac Add NULL pointer check.
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14084 6f19259b-4bc3-4df7-8a09-765794883524
2013-01-25 04:48:41 +00:00
lzeng14 23b0693579 1. Update the logic of UpdateVariable() for updating variable from:
set old variable to IN_DELETED_TRANSITION -> check if reclaim is needed(If yes, do reclaim) -> add new variable -> set old variable to DELETED if no reclaim happened.
to:
set old variable to IN_DELETED_TRANSITION -> check if reclaim is needed(If yes, do reclaim) -> add new variable -> set old variable to DELETED.
2. Update UpdateVariable() to correctly handle the case "both ADDED and IN_DELETED_TRANSITION variable are present", and delete both old ADDED and IN_DELETED_TRANSITION variable when deleting or updating variable.
3. Update VariableServiceGetNextVariableName() to return the valid IN_DELETED_TRANSITION variable if only IN_DELETED_TRANSITION variable is present.

Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14065 6f19259b-4bc3-4df7-8a09-765794883524
2013-01-18 01:12:32 +00:00
lzeng14 aab9212fa9 Fix the issue that RuntimeServiceQueryVariableInfo() in VariableSmmRuntimeDxe always return EFI_SUCCESS.
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14050 6f19259b-4bc3-4df7-8a09-765794883524
2013-01-15 06:43:24 +00:00
lzeng14 6ed1ec5946 Add the TPL raise/restore code for VariableSmmRuntimeDxe to avoid variable services reentry.
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14038 6f19259b-4bc3-4df7-8a09-765794883524
2013-01-08 02:07:14 +00:00
lzeng14 335e268133 1. Don't assume that flush the HOB variable to flash must be successful.
2. When no DELETED variable found, no variable space could be reclaimed, so just give some debug info and return EFI_SUCCESS.

Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14029 6f19259b-4bc3-4df7-8a09-765794883524
2013-01-04 12:21:59 +00:00
lzeng14 3f5c168fa8 Use SMM_VARIABLE_COMMUNICATE_HEADER_SIZE instead of OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data).
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13993 6f19259b-4bc3-4df7-8a09-765794883524
2012-12-12 14:12:49 +00:00
erictian a326830d70 MdeModulePkg: eliminate all implicit library dependencies for all modules in MdeModulePkg on PcdLib
Signed-off-by: Tian Feng <feng.tian@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13909 6f19259b-4bc3-4df7-8a09-765794883524
2012-11-01 06:59:25 +00:00
erictian d294b9a4b7 MdeModulePkg/VariableSmm: Fix a VariableSmm bug when reading variable with size 0.
Signed-off-by: Tian, Feng <feng.tian@intel.com>
Reviewed-by: Zhang, Chao <chao.b.zhang@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13725 6f19259b-4bc3-4df7-8a09-765794883524
2012-09-12 08:24:10 +00:00
lzeng14 8f3a9e5862 LastVariableOffset is wrongly set to 0 when FtwVariableSpace() fails. Recalculate the HwErrVariableTotalSize, HwErrVariableTotalSize and LastVariableOffset when FtwVariableSpace() fails.
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13593 6f19259b-4bc3-4df7-8a09-765794883524
2012-08-06 03:20:10 +00:00
sfu5 876ac39540 Return EFI_UNSUPPORTED if READY_TO_BOOT function is invoked at SMM runtime.
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Dong Guo <guo.dong@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13535 6f19259b-4bc3-4df7-8a09-765794883524
2012-07-17 08:21:42 +00:00
sfu5 eb96e4f281 Fix a buffer overflow bug in VariableSmm driver.
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Dong Guo <guo.dong@intel.com>
Reviewed-by: Zhang, Chao <chao.b.zhang@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13534 6f19259b-4bc3-4df7-8a09-765794883524
2012-07-17 08:07:29 +00:00
czhang46 2445a70e62 Add SMRAM range check to variable SMM SMI handler.
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Fu, Siyuan<siyuan.fu@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13530 6f19259b-4bc3-4df7-8a09-765794883524
2012-07-13 05:15:06 +00:00
ydong10 96277f7402 Include read data buffer in CommBufferSize when calculate the buffer size.
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13512 6f19259b-4bc3-4df7-8a09-765794883524
2012-07-09 02:03:47 +00:00
lzeng14 a5f15e3025 According to UEFI spec 2.3.1a. hardware error record variable should use the EFI_HARDWARE_ERROR_VARIABLE VendorGuid and have the L"HwErrRec####" name convention, #### is a printed hex value and no 0x or h is included in the hex value.
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13373 6f19259b-4bc3-4df7-8a09-765794883524
2012-05-30 02:53:10 +00:00
lzeng14 021a1af927 Return EFI_WRITE_PROTECTED when setting HwErrRecSupport Global Variable at runtime.
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13372 6f19259b-4bc3-4df7-8a09-765794883524
2012-05-30 02:42:26 +00:00
lzeng14 9622df63df If setting variable in Runtime and there has been a same GUID and name variable existed in system without RT attribute, return EFI_WRITE_PROTECTED.
Signed-off-by: lzeng14
Reviewed-by: tye

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13156 6f19259b-4bc3-4df7-8a09-765794883524
2012-03-30 07:19:44 +00:00
niruiyu 222f8505cb Missing declaration of the GUID gEfiSystemNvDataFvGuid.
Signed-off-by: oliviermartin
Reviewed-by: rsun3

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12837 6f19259b-4bc3-4df7-8a09-765794883524
2011-12-13 06:00:27 +00:00
oliviermartin d65502601e MdeModulePkg/Variable: Check if there is a NV Variable Storage header prior to use its attributes
The Variable PEI and RuntimeDxe drivers were using the attribute 'HeaderLength' of
EFI_FIRMWARE_VOLUME_HEADER without checking if a Firmware Volume Header was existing at
the base address.
In case the Firmware Volume Header does not exist or is corrupted, the attribute 'HeaderLength'
is a non valid value that can lead to a non valid physical address when accessing produces an
access error.

Signed-off-by: oliviermartin
Reviewed-by: niruiyu



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12836 6f19259b-4bc3-4df7-8a09-765794883524
2011-12-12 19:00:59 +00:00
niruiyu 4efa9e594a Fix a typo in the comments
Signed-off-by: niruiyu

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12689 6f19259b-4bc3-4df7-8a09-765794883524
2011-11-14 02:41:04 +00:00
niruiyu fb849d0dc0 Add the missing (UINTN) type cast when calculating the end of variable store.
Signed-off-by: niruiyu
Reviewed-by: erictian

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12672 6f19259b-4bc3-4df7-8a09-765794883524
2011-11-08 08:42:34 +00:00
niruiyu 8cb3ed513e Roll back an incorrect change that causes EmuGetVariable always return EFI_NOT_FOUND.
Signed-off-by: niruiyu
Reviewed-by: lgao4

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12667 6f19259b-4bc3-4df7-8a09-765794883524
2011-11-08 03:00:56 +00:00
niruiyu d26727de5f Add the missing HEADER_ALIGN macro.
Signed-off-by: niruiyu
Reviewed-by: erictian

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12597 6f19259b-4bc3-4df7-8a09-765794883524
2011-10-28 09:35:10 +00:00
niruiyu f68af18ee9 Support Variable driver (EmuRuntimeDxe) to support the default variable data stored in HOB.
Signed-off-by: niruiyu
Reviewed-by: lgao4

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12553 6f19259b-4bc3-4df7-8a09-765794883524
2011-10-19 09:30:43 +00:00
niruiyu e3d5b59a65 Fix GCC build failure.
Signed-off-by: niruiyu

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12546 6f19259b-4bc3-4df7-8a09-765794883524
2011-10-18 07:12:35 +00:00
niruiyu de2a15eebb Fix the clang compilation failure to handle all the values in a case statement for enum type value.
Signed-off-by: Andrew Fish
Reviewed-by: niruiyu

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12539 6f19259b-4bc3-4df7-8a09-765794883524
2011-10-14 07:46:15 +00:00
niruiyu 0f7aff7249 Change Variable driver (Pei/RuntimeDxe) to support the default variable data stored in HOB.
Signed-off-by: niruiyu
Reviewed-by: erictian

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12538 6f19259b-4bc3-4df7-8a09-765794883524
2011-10-14 05:19:39 +00:00
ydong10 04eb20aa85 Add pointer check for NULL before dereference it.
Signed-off-by: ydong10
Reviewed-by: rsun3, lgao4

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12472 6f19259b-4bc3-4df7-8a09-765794883524
2011-09-29 06:33:23 +00:00
sfu5 9725730b65 Remove duplicated definitions EFI_VARIABLE_INDEX_TABLE_GUID in variable PEI drivers.
Reviewed-by: lgao4, gdong1
Signed-off-by: sfu5

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11755 6f19259b-4bc3-4df7-8a09-765794883524
2011-06-07 04:49:10 +00:00
erictian 3b4253677e Solve a wrong pointer reference in QueryVariableInfo().
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11593 6f19259b-4bc3-4df7-8a09-765794883524
2011-04-27 05:43:09 +00:00
erictian 4249fa760f judge recovery mode at ReadOnlyVariable2Ppi interface. if yes, then return EFI_NOT_FOUND
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11397 6f19259b-4bc3-4df7-8a09-765794883524
2011-03-14 09:57:55 +00:00
erictian 27ee669c69 if it's in recovery mode, variable region is unreliable, so the ReadOnlyVariable2Ppi should return EFI_NOT_FOUND
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11387 6f19259b-4bc3-4df7-8a09-765794883524
2011-03-14 05:53:05 +00:00
gdong1 d00ed85e0a Puts SMM variable common definitions in SmmVariableCommon.h.
Fixed a bug that SMM_VARIABLE_COMMUNICATE_VARIABLE_INFO_ENTRY was misused as SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11339 6f19259b-4bc3-4df7-8a09-765794883524
2011-02-28 07:31:45 +00:00
erictian b7bc11a4ff correct Intel's copyright date as the changes checked-in at r11273 & r11272 are contributed by third party.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11311 6f19259b-4bc3-4df7-8a09-765794883524
2011-02-12 03:29:24 +00:00
erictian d9303576cd fix word typo
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11273 6f19259b-4bc3-4df7-8a09-765794883524
2011-01-26 04:30:22 +00:00
erictian 858939cbda fix arm gcc build error
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11272 6f19259b-4bc3-4df7-8a09-765794883524
2011-01-26 04:24:54 +00:00
gdong1 b59ad7519f Fix an K9 issue in variable driver.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11245 6f19259b-4bc3-4df7-8a09-765794883524
2011-01-12 04:35:39 +00:00
gdong1 9ae0edbfa9 1. Invoke InstallConfigurationTable () in OnReadyToBoot() to avoid the new registered table may be NULL.
2. For SMM variable driver, it doesn’t need to mark the variable storage region of the FLASH as RUNTIME, so only keep it for non-SMM variable driver. 


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11212 6f19259b-4bc3-4df7-8a09-765794883524
2010-12-31 04:31:42 +00:00
gdong1 a81b1409f9 Remove ASSERT here for the zero attributes means deleting preexisting variable.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11199 6f19259b-4bc3-4df7-8a09-765794883524
2010-12-24 07:03:25 +00:00
gdong1 5456306fcf Fix a potential bug that SetVariable is invoked for NV variable prior to the installation of EFI_VARIABLE_WRITE_ARCH_PROTOCOL.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11190 6f19259b-4bc3-4df7-8a09-765794883524
2010-12-22 07:33:13 +00:00
gdong1 32732a333a Update inappropriate comments.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11170 6f19259b-4bc3-4df7-8a09-765794883524
2010-12-15 01:51:46 +00:00
gdong1 e90f27600f Remove the unnecessary package from VariableSmmRuntimeDxe.inf.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11157 6f19259b-4bc3-4df7-8a09-765794883524
2010-12-12 10:18:47 +00:00
gdong1 5c7fa42941 Add typecast to remove warning with ICC.
VariableSmm.inf: Remove SmmLib 

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11156 6f19259b-4bc3-4df7-8a09-765794883524
2010-12-11 11:17:47 +00:00
jljusten 5c54e90515 MdeModulePkg VariableRuntimeDxe: Fix build for GCC44 toolchain
Add typecast to remove warning with GCC 4.4.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11155 6f19259b-4bc3-4df7-8a09-765794883524
2010-12-10 23:57:42 +00:00
gdong1 8a2d49964e Add SMM Variable implementation.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11151 6f19259b-4bc3-4df7-8a09-765794883524
2010-12-10 09:27:54 +00:00
jljusten e1adae6084 DuetPkg, MdeModulePkg: Fix variable services hang with GCC44 X64
The C ellipses parameters are passed to functions differently
by default with GCC 4.4.  To make sure they are properly sent to
VariableGetBestLanguage, we add 'EFIAPI' to this function.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11119 6f19259b-4bc3-4df7-8a09-765794883524
2010-12-06 06:04:38 +00:00
niruiyu 5c0337668f Fix a bug in GetLangFromSupportedLangCodes()
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11091 6f19259b-4bc3-4df7-8a09-765794883524
2010-11-25 07:04:04 +00:00
niruiyu 1623ce4aad Fix AutoUpdateLangVariable() logic to handle the case PlatformLang/Lang is set before PlatformLangCodes/LangCodes.
Pre-allocate pool for runtime phase.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11087 6f19259b-4bc3-4df7-8a09-765794883524
2010-11-24 03:04:20 +00:00
niruiyu 255a3f33bd Fix AutoUpdateLangVariable() logic to handle the case PlatformLang/Lang is set before PlatformLangCodes/LangCodes.
Pre-allocate pool for runtime phase.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11075 6f19259b-4bc3-4df7-8a09-765794883524
2010-11-18 01:40:22 +00:00
andrewfish 92a4f6f3c7 Add 64-bit versions of FLASH Base addressess as it is legal to have them >4G. For backward compatability if the new 64-bit base addresses are zero use the old 32-bit base addressess.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10684 6f19259b-4bc3-4df7-8a09-765794883524
2010-07-22 21:18:25 +00:00
erictian 2ad29d0fe4 fix a bug that FindVariable() may set GoneThrough flag wrongly when a >64K variable exists.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10524 6f19259b-4bc3-4df7-8a09-765794883524
2010-05-20 09:12:12 +00:00
hhtian e5eed7d364 Update the copyright notice format
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10418 6f19259b-4bc3-4df7-8a09-765794883524
2010-04-24 09:33:45 +00:00
erictian 8e38f18ef7 variable driver doesn't support EFI_AUTHENTICATED_WRITE_ACCESS. we use:
1. EFI_INVALID_PARAMETER as a return value of SetVariable() to indicate it does not support this feature.
2. EFI_NOT_FOUND will be a return value of QueryVariableInfo() to indicate it does not support this feature.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10281 6f19259b-4bc3-4df7-8a09-765794883524
2010-03-18 08:58:48 +00:00
xli24 f7dab9fa6d Refine parameter description according to PI 1.2 errata A.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10109 6f19259b-4bc3-4df7-8a09-765794883524
2010-02-26 08:56:29 +00:00
lgao4 6bfbb5f0e0 1. Correct File header to ## @file
2. Remove unnecessary .common] postfix on section.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10052 6f19259b-4bc3-4df7-8a09-765794883524
2010-02-24 00:21:16 +00:00
mdkinney 188e4e8444 Remove unnecessary use of FixedPcdxxx() functions and [FixedPcd] INF sections. These should only be used for PCDs that are used to pre-init global variables, pre-init global structures, or size arrays.
Do some minor clean ups to INF files
 


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9868 6f19259b-4bc3-4df7-8a09-765794883524
2010-01-29 23:39:48 +00:00
rsun3 aa75dfeccd Fix some coding style issues in MdeModulePkg.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9774 6f19259b-4bc3-4df7-8a09-765794883524
2010-01-15 08:03:23 +00:00
eric_tian 18207db786 add DataSize check to avoid PlatformLang/Lang variable is auto-mapped when try to delete these variables.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9746 6f19259b-4bc3-4df7-8a09-765794883524
2010-01-14 07:16:22 +00:00
eric_tian 48a0e6bfbd add error handling for input parameter.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9583 6f19259b-4bc3-4df7-8a09-765794883524
2009-12-22 07:16:55 +00:00
xli24 255f993d70 Fix parameter name in function header.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9439 6f19259b-4bc3-4df7-8a09-765794883524
2009-11-17 15:12:11 +00:00
xli24 5a9403b8f3 Following 3 updates are for spec update published in PI 1.2.
1. Rename EFI_PEI_NEXT_VARIABLE_NAME2 to EFI_PEI_GET_NEXT_VARIABLE_NAME2, as PI 1.2 specifies.
2. Add return status description for PEI Service FfsGetVolumeInfo.
3. Update parameter description for EFI_PEI_READ_ONLY_VARIABLE2_PPI.NextVariableName().

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9438 6f19259b-4bc3-4df7-8a09-765794883524
2009-11-17 15:00:28 +00:00
eric_tian 9948c0b018 if PcdHwErrStorageSize is zero, it means HwErr variable store doesn't exist in Variable Region.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9252 6f19259b-4bc3-4df7-8a09-765794883524
2009-09-10 06:51:55 +00:00
jljusten 02328a57a2 EMU Variable: Add support for pre-reserved NV variable store.
Add PcdEmuVariableNvStoreReserved which allows a platform to declare a
memory address for the EMU Variable driver to use for the NV variable
store.  The EMU Variable driver will look to see if the contents of
this memory range appear to be a valid variable store, and if so
the EMU driver will use the variables.

If a platform can preserve a memory range across system resets, this
feature can allow the EMU Variable driver's NV variable store to be
preserved across a system reset.

In the default case this PCD will be set as a fixed PCD with a value
of 0.  In this case this new feature should have minimal impact on
the EMU Variable driver.  (Perhaps a slight increase in code size,
but no functional difference is expected.)

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9240 6f19259b-4bc3-4df7-8a09-765794883524
2009-09-07 20:18:14 +00:00
eric_tian 93c288f2fb due to EmuVariable driver only uses volatile memory to simulate the variable region, so PcdHwErrStorageSize should be less than or equal to PcdVariableStoreSize
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9204 6f19259b-4bc3-4df7-8a09-765794883524
2009-08-27 06:24:26 +00:00
eric_tian 48cd992ac7 add assertion to ensure HwErr type variable range is less than or equal to VariableStore range.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9199 6f19259b-4bc3-4df7-8a09-765794883524
2009-08-26 02:59:28 +00:00
eric_tian 1d5b25b715 add condition judgment to avoid accessing NULL address if not found existing variable.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9038 6f19259b-4bc3-4df7-8a09-765794883524
2009-08-11 05:24:12 +00:00
eric_tian f2a064736d add assertion to pass K8 check.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8679 6f19259b-4bc3-4df7-8a09-765794883524
2009-06-29 09:09:59 +00:00
eric_tian 841014ba97 refine VariablePei driver to unify the algorithm of access VariableIndexTable among various archs.
1. record the distance of two neighboring VAR_ADDED type variables rather than the offset of each variable. As the field recording this info is UINT16 width, the latter causes in IA32/X64 platform, it can only cache those variables from offset 0 to offset 2^16; in IPF platform, from offset 0 to offset 2^18(extend the scope by left-shift the offset two bits).
when taking the former algorithm, the max range of caching variable is from offset 0 to offset 122*(2^16)

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8625 6f19259b-4bc3-4df7-8a09-765794883524
2009-06-23 08:30:04 +00:00
lgao4 6a194b7f2d Remove the additional build options.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8498 6f19259b-4bc3-4df7-8a09-765794883524
2009-06-08 06:43:00 +00:00
eric_tian bcd7070d86 fix the issue of Inadequate Memory Allocation in Variable Services
In UpdateVariableInfo(), the code incorrectly allocate a small memory, whose size equate with the number of Unicode name. 
Should change it to be equal to the byte length of this Unicode name.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8457 6f19259b-4bc3-4df7-8a09-765794883524
2009-06-03 08:48:09 +00:00
qhuang8 a1373617d6 Fix a bug that L"PlatformLang" must be a null-terminated ASCII string according to UEFI spec.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8232 6f19259b-4bc3-4df7-8a09-765794883524
2009-05-04 05:55:56 +00:00
gikidy 0254efc01e Replace references to RFC 3066 with RFC 4646.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8212 6f19259b-4bc3-4df7-8a09-765794883524
2009-04-30 05:32:11 +00:00
jljusten 51967a5314 Acquire & Release the lock from the high level variable service
routines similar to MdeModulePkg/Universal/Variable/RuntimeDxe.
When the Acquire was in the FindVariable routine, is was
being called by both EmuSetVariable and again in
AutoUpdateLangVariable, which caused an ASSERT to fail.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8205 6f19259b-4bc3-4df7-8a09-765794883524
2009-04-29 20:22:38 +00:00
qhuang8 bd397350b4 Fix bug in variable driver about the incorrect usage for GetBestLanguage(), which expects the NULL to be the last var arg
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8195 6f19259b-4bc3-4df7-8a09-765794883524
2009-04-28 03:32:24 +00:00
eric_tian 0c420e26a9 update
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8194 6f19259b-4bc3-4df7-8a09-765794883524
2009-04-28 02:31:48 +00:00
eric_tian 72399daee4 update platformlangcodes and langcodes to adapt new language convert algorithm.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8184 6f19259b-4bc3-4df7-8a09-765794883524
2009-04-27 07:06:01 +00:00
eric_tian 2fcdca1d73 1. The original code has a bug on calculate the size of SCRATCH_SIZE. It should be maximum value between PcdMaxVariableSize and PcdMaxHardwareErrorVariableSize.
2. Boot time variable reclaim issue is caused by incorrect flash layout. Platform integrator should ensure that the size of variable region must less than FTW spare space size.
3. Per UEFI Specification, variables of attribute HARDWARE_ERROR_RECORD are guaranteed to have its own storage space size.original implementation doesn’t meet this requirement 

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8029 6f19259b-4bc3-4df7-8a09-765794883524
2009-04-07 06:42:12 +00:00
eric_tian 6f90dfbc0d update the QueryVariableInfo interface to first determine if the pointer checked is pointing to a memory address inside Variable area.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7969 6f19259b-4bc3-4df7-8a09-765794883524
2009-03-27 05:05:48 +00:00
jljusten bd682470fc Prefix variable services functions with 'Emu'. Specifically this is
done to avoid a conflict with the 'GetVariable' function defined
in edk2/MdePkg/Include/Library/UefiLib.h.


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7941 6f19259b-4bc3-4df7-8a09-765794883524
2009-03-24 18:42:18 +00:00
eric_tian fba0ee1f4c Fix tracker 202216:linux runtime test issue.
[Root Cause]
The root cause is that in FindVariable function, original code logic will traverse all variable stored in variable volatile/non-volatile area. If the non-variable area is full and Linux sets a new variable, the caller of GetNextVariablePtr will get the address of next memory block, but this block doesn't be reserved as RUNTIME attribute. Therefore its corresponding page translation table doesn't exist and causes linux kernel panic.

Note that, Variable Pei driver has not such issue as the flash area is accessed in pre-os environment.All page table entries are filled. The access to next memory block will not cause such issue.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7910 6f19259b-4bc3-4df7-8a09-765794883524
2009-03-19 08:50:41 +00:00
eric_tian 533020ef80 close notify event to avoid variable architectural protocol to be installed twice or more.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7904 6f19259b-4bc3-4df7-8a09-765794883524
2009-03-19 03:13:08 +00:00
eric_tian 7974918212 Fix tracker 202216:linux runtime test issue.
[Root Cause]
The root cause is that in FindVariable function, original code logic will traverse all variable stored in variable volatile/non-volatile area. If the non-variable area is full and Linux sets a new variable, the caller of GetNextVariablePtr will get the address of next memory block, but this block doesn't be reserved as RUNTIME attribute. Therefore its corresponding page translation table doesn't exist and causes linux kernel panic.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7890 6f19259b-4bc3-4df7-8a09-765794883524
2009-03-16 09:57:10 +00:00
lgao4 f0480ecf80 Fix K8 check error.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7849 6f19259b-4bc3-4df7-8a09-765794883524
2009-03-10 08:40:29 +00:00
lgao4 e51d07a670 remove unused local variable FvbHandle
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7839 6f19259b-4bc3-4df7-8a09-765794883524
2009-03-10 00:56:48 +00:00
eric_tian 00f3851372 retire FvbServiceLib class in MdeModulePkg, and also remove the two instances in MdeModulePkg and ItaniumPlatformPkg.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7837 6f19259b-4bc3-4df7-8a09-765794883524
2009-03-09 09:20:57 +00:00
eric_tian 8a9e0b7274 1. retire the FvbServiceLib. Directly locating FVB protocol to access interfaces.
2. modify the method of getting right FVB protocol interface. move the notification event of FVB installation into variable driver. and also move ExitBootService event into variable driver.
3. use EFI_FVB2_WRITE_STATUS flag to distinct whether the FVB protocol supports writing operation or not.Currently, DxeCore installs FVB which has ~EFI_FVB2_WRITE_STATUS(that is, disable write) attrbiute. FvbRuntimeDxe driver should provide a full FVB protocol, which returns EFI_FVB2_WRITE_STATUS attribute to signify itself provide writable FVB protocol. So other modules which need write data by FVB protocol can locate it correctly.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7835 6f19259b-4bc3-4df7-8a09-765794883524
2009-03-09 06:39:13 +00:00
eric_tian 5bb820af59 1. add missing free operation in conditional branch.
2. when variable store header is invalid status, we will return EFI_VOLUME_CORRUPTED to let code assert, which is helpful to find root cause quickly.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7804 6f19259b-4bc3-4df7-8a09-765794883524
2009-03-05 02:59:11 +00:00
eric_tian e4ddc00886 use pcd to enable/disable variableInfo statistic feature in EmuRuntimeDxe driver.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7797 6f19259b-4bc3-4df7-8a09-765794883524
2009-03-04 07:21:11 +00:00
lgao4 88a5561c66 Update Variable driver to depend on full version FaultTolerantWrite protocol, and remove the lite version FaultTolerantWrite Dxe Driver. New full version FaultTolerantWriteDxe driver is added in MdeModulePkg.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7788 6f19259b-4bc3-4df7-8a09-765794883524
2009-03-04 01:27:50 +00:00
eric_tian 3709c4cd5b 1. delete Include/Guid/VariableInfo.h
2. move VariableFormat.h into GUID directory and change the “Signature” field of the VARIABLE_STORE_HEADER to gEfiVariableGuid value.
3. merging VARIABLE_INFO_ENTRY structure into the new Include/Guid/VariableFormat.h
4. change gEfiVariableInfoGuid into gEfiVariableGuid.
5. modify FDF files to use new guid value instead of the original signature.
6. all code related to signature is changed to use guid value.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7728 6f19259b-4bc3-4df7-8a09-765794883524
2009-02-27 05:35:08 +00:00
eric_tian 18efbdff45 All UEFI applications in the MdeModukePkg should be placed in MdeModulePkg/Application
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7704 6f19259b-4bc3-4df7-8a09-765794883524
2009-02-26 05:29:29 +00:00
eric_tian 3dcdbe7a52 update
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7694 6f19259b-4bc3-4df7-8a09-765794883524
2009-02-25 13:08:46 +00:00
gikidy 88fa231e94 Meta-data verified.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7537 6f19259b-4bc3-4df7-8a09-765794883524
2009-02-18 03:13:32 +00:00
vanjeff 892b7f90c5 add NULL pointer check.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7506 6f19259b-4bc3-4df7-8a09-765794883524
2009-02-12 01:55:32 +00:00
qhuang8 96a5ac5b0d Adjust code to fix potential array out-bound issues.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7502 6f19259b-4bc3-4df7-8a09-765794883524
2009-02-11 07:05:43 +00:00
mdkinney ba5e88f965 Add parenthesis to expression to make order of operations clear
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7475 6f19259b-4bc3-4df7-8a09-765794883524
2009-02-06 20:40:48 +00:00