]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Refine the code.
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 18 Aug 2008 05:11:21 +0000 (05:11 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 18 Aug 2008 05:11:21 +0000 (05:11 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5654 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/DxePcdLib/DxePcdLib.c
MdePkg/Library/DxePcdLib/DxePcdLib.msa [deleted file]

index 3062df4fcd1876c43d40b09c679a53e179097fa7..cfde03a210869c06dadabf9a95d52f268f61c17d 100644 (file)
@@ -23,9 +23,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 \r
-#include "DxePcdLibInternal.h"\r
-\r
-STATIC PCD_PROTOCOL  *mPcd = NULL;\r
+PCD_PROTOCOL  *mPcd = NULL;\r
 \r
 /**\r
   Retrieves PCD protocol interface.\r
@@ -64,9 +62,10 @@ GetPcdProtocol (
 \r
 /**\r
   Sets the current SKU in the PCD database to the value specified by SkuId.  SkuId is returned.\r
-\r
-  @param[in]  SkuId The SKU value that will be used when the PCD service will retrieve and \r
-              set values associated with a PCD token.\r
+  If SkuId is not less than PCD_MAX_SKU_ID, then ASSERT().\r
+  \r
+  @param[in]  SkuId     System SKU ID. The SKU value that will be used when the PCD service will retrieve and \r
+                        set values.\r
 \r
   @retval SKU_ID Return the SKU ID that just be set.\r
 \r
@@ -77,7 +76,7 @@ LibPcdSetSku (
   IN UINTN  SkuId\r
   )\r
 {\r
-  ASSERT (SkuId < 0x100);\r
+  ASSERT (SkuId < PCD_MAX_SKU_ID);\r
 \r
   (GetPcdProtocol ())->SetSku (SkuId);\r
 \r
@@ -395,6 +394,7 @@ LibPcdGetExSize (
 /**\r
   Sets the 8-bit value for the token specified by TokenNumber \r
   to the value specified by Value.  Value is returned.\r
+  If fail to set pcd value, then ASSERT_EFI_ERROR().\r
   \r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
   @param[in]  Value The 8-bit value to set.\r
@@ -423,6 +423,7 @@ LibPcdSet8 (
 /**\r
   Sets the 16-bit value for the token specified by TokenNumber \r
   to the value specified by Value.  Value is returned.\r
+  If fail to set pcd value, then ASSERT_EFI_ERROR().\r
   \r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
   @param[in]  Value The 16-bit value to set.\r
@@ -451,6 +452,7 @@ LibPcdSet16 (
 /**\r
   Sets the 32-bit value for the token specified by TokenNumber \r
   to the value specified by Value.  Value is returned.\r
+  If fail to set pcd value, then ASSERT_EFI_ERROR().\r
   \r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
   @param[in]  Value The 32-bit value to set.\r
@@ -478,6 +480,7 @@ LibPcdSet32 (
 /**\r
   Sets the 64-bit value for the token specified by TokenNumber \r
   to the value specified by Value.  Value is returned.\r
+  If fail to set pcd value, then ASSERT_EFI_ERROR().\r
   \r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
   @param[in]  Value The 64-bit value to set.\r
@@ -505,13 +508,13 @@ LibPcdSet64 (
 \r
 /**\r
   Sets a buffer for the token specified by TokenNumber to \r
-  the value specified by Buffer and SizeOfValue.  Buffer to\r
+  the value specified by Buffer and SizeOfBuffer.  Buffer to\r
   be set is returned. The content of the buffer could be \r
   overwritten if a Callback on SET is registered with this\r
   TokenNumber.\r
   \r
-  If SizeOfValue is greater than the maximum \r
-  size support by TokenNumber, then set SizeOfValue to the \r
+  If SizeOfBuffer is greater than the maximum \r
+  size support by TokenNumber, then set SizeOfBuffer to the \r
   maximum size supported by TokenNumber and return NULL to \r
   indicate that the set operation was not actually performed. \r
   \r
@@ -519,6 +522,7 @@ LibPcdSet64 (
   \r
   @param[in]      TokenNumber   The PCD token number to set a current value for.\r
   @param[in, out] SizeOfBuffer  The size, in bytes, of Buffer.\r
+                                In out, returns actual size of buff is set. \r
   @param[in]      Buffer        A pointer to the buffer to set.\r
 \r
   @retval VOID* Return the pointer for the buffer been set.\r
@@ -554,6 +558,7 @@ LibPcdSetPtr (
 /**\r
   Sets the Boolean value for the token specified by TokenNumber \r
   to the value specified by Value.  Value is returned.\r
+  If fail to set pcd value, then ASSERT_EFI_ERROR().\r
   \r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
   @param[in]  Value       The boolean value to set.\r
@@ -583,6 +588,7 @@ LibPcdSetBool (
   Sets the 8-bit value for the token specified by TokenNumber and \r
   Guid to the value specified by Value. Value is returned.\r
   If Guid is NULL, then ASSERT().\r
+  If fail to set pcd value, then ASSERT_EFI_ERROR().\r
   \r
   @param[in]  Guid Pointer to a 128-bit unique value that \r
               designates which namespace to set a value from.\r
@@ -617,13 +623,14 @@ LibPcdSetEx8 (
   Sets the 16-bit value for the token specified by TokenNumber and \r
   Guid to the value specified by Value. Value is returned.\r
   If Guid is NULL, then ASSERT().\r
+  If fail to set pcd value, then ASSERT_EFI_ERROR().\r
   \r
   @param[in]  Guid Pointer to a 128-bit unique value that \r
               designates which namespace to set a value from.\r
   @param[in]  TokenNumber The PCD token number to set a current value for.\r
   @param[in]  Value The 16-bit value to set.\r
 \r
-  @retval UINT8 Return the value been set.\r
+  @retval UINT16 Return the value been set.\r
 \r
 **/\r
 UINT16\r
@@ -651,6 +658,7 @@ LibPcdSetEx16 (
   Sets the 32-bit value for the token specified by TokenNumber and \r
   Guid to the value specified by Value. Value is returned.\r
   If Guid is NULL, then ASSERT().\r
+  If fail to set pcd value, then ASSERT_EFI_ERROR().\r
   \r
   @param[in]  Guid Pointer to a 128-bit unique value that \r
               designates which namespace to set a value from.\r
@@ -717,18 +725,19 @@ LibPcdSetEx64 (
 \r
 /**\r
   Sets a buffer for the token specified by TokenNumber to the value specified by \r
-  Buffer and SizeOfValue.  Buffer is returned.  If SizeOfValue is greater than \r
-  the maximum size support by TokenNumber, then set SizeOfValue to the maximum size \r
+  Buffer and SizeOfBuffer.  Buffer is returned.  If SizeOfBuffer is greater than \r
+  the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size \r
   supported by TokenNumber and return NULL to indicate that the set operation \r
   was not actually performed. \r
   \r
-  If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r
+  If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
   \r
-  @param[in]  Guid Pointer to a 128-bit unique value that \r
-              designates which namespace to set a value from.\r
-  @param[in]  TokenNumber The PCD token number to set a current value for.\r
-  @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r
-  @param[in]  Buffer A pointer to the buffer to set.\r
+  @param[in]        Guid Pointer to a 128-bit unique value that \r
+                    designates which namespace to set a value from.\r
+  @param[in]        TokenNumber The PCD token number to set a current value for.\r
+  @param[in, out]   SizeOfBuffer The size, in bytes, of Buffer.\r
+                    In out, returns actual size of buffer is set.\r
+  @param[in]        Buffer A pointer to the buffer to set.\r
 \r
   @retval VOID * Return the pinter to the buffer been set.\r
 \r
@@ -767,6 +776,7 @@ LibPcdSetExPtr (
   Sets the Boolean value for the token specified by TokenNumber and \r
   Guid to the value specified by Value. Value is returned.\r
   If Guid is NULL, then ASSERT().\r
+  If fail to set pcd value, then ASSERT_EFI_ERROR().\r
   \r
   @param[in]  Guid Pointer to a 128-bit unique value that \r
               designates which namespace to set a value from.\r
@@ -802,7 +812,8 @@ LibPcdSetExBool (
   then notification function specified by NotificationFunction is called.  \r
   If Guid is NULL, then the default token space is used. \r
   If NotificationFunction is NULL, then ASSERT().\r
-\r
+  If fail to set callback function, then ASSERT_EFI_ERROR().\r
+  \r
   @param[in]  Guid Pointer to a 128-bit unique value that designates which \r
               namespace to set a value from.  If NULL, then the default \r
               token space is used.\r
@@ -837,7 +848,8 @@ LibPcdCallbackOnSet (
 /**\r
   Disable a notification function that was established with LibPcdCallbackonSet().\r
   If NotificationFunction is NULL, then ASSERT().\r
-\r
+  If fail to cancel callback function, then ASSERT_EFI_ERROR().\r
+  \r
   @param[in]  Guid Specify the GUID token space.\r
   @param[in]  TokenNumber Specify the token number.\r
   @param[in]  NotificationFunction The callback function to be unregistered.\r
@@ -873,6 +885,7 @@ LibPcdCancelCallback (
   follows TokenNumber in the token space is returned.  If TokenNumber is the last \r
   token number in the token space, then 0 is returned.  If TokenNumber is not 0 and \r
   is not in the token space specified by Guid, then ASSERT().\r
+  If Fail to get next token, then ASSERT_EFI_ERROR().\r
 \r
   @param[in]  Guid        Pointer to a 128-bit unique value that designates which namespace \r
                           to set a value from.  If NULL, then the default token space is used.\r
@@ -908,8 +921,7 @@ LibPcdGetNextToken (
   then NULL is returned. \r
 \r
   If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().\r
-\r
-\r
+  If fail to get next token space, then ASSERT_EFI_ERROR().\r
   \r
   @param[in]  Guid  Pointer to a 128-bit unique value that designates from which namespace \r
                     to start the search.\r
@@ -935,20 +947,21 @@ LibPcdGetNextTokenSpace (
 \r
 /**\r
   Sets the PCD entry specified by PatchVariable to the value specified by Buffer \r
-  and SizeOfValue.  Buffer is returned.  If SizeOfValue is greater than \r
-  MaximumDatumSize, then set SizeOfValue to MaximumDatumSize and return \r
+  and SizeOfBuffer.  Buffer is returned.  If SizeOfBuffer is greater than \r
+  MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return \r
   NULL to indicate that the set operation was not actually performed.  \r
-  If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to \r
+  If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to \r
   MaximumDatumSize and NULL must be returned.\r
   \r
   If PatchVariable is NULL, then ASSERT().\r
-  If SizeOfValue is NULL, then ASSERT().\r
-  If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r
+  If SizeOfBuffer is NULL, then ASSERT().\r
+  If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
 \r
   @param[in] PatchVariable      A pointer to the global variable in a module that is \r
                                 the target of the set operation.\r
   @param[in] MaximumDatumSize   The maximum size allowed for the PCD entry specified by PatchVariable.\r
   @param[in, out] SizeOfBuffer  A pointer to the size, in bytes, of Buffer.\r
+                                In out, returns actual size of buffer is set.\r
   @param[in] Buffer             A pointer to the buffer to used to set the target variable.\r
 \r
 **/\r
diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.msa b/MdePkg/Library/DxePcdLib/DxePcdLib.msa
deleted file mode 100644 (file)
index 6f95e2e..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
-  <MsaHeader>\r
-    <ModuleName>DxePcdLib</ModuleName>\r
-    <ModuleType>DXE_DRIVER</ModuleType>\r
-    <GuidValue>af97eb89-4cc6-45f8-a514-ca025b346480</GuidValue>\r
-    <Version>1.0</Version>\r
-    <Abstract>PCD Library instance implemented with PCD Protocol</Abstract>\r
-    <Description>This library instance implement the APIs listed 
-    in PCD library class defined in MDE library specification.
-    It is used by modules in DXE phase.</Description>\r
-    <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>\r
-    <License>All rights reserved. This program and the accompanying materials
-      are licensed and made available under the terms and conditions of the BSD License
-      which accompanies this distribution.  The full text of the license may be found at
-      http://opensource.org/licenses/bsd-license.php
-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>\r
-  </MsaHeader>\r
-  <ModuleDefinitions>\r
-    <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
-    <BinaryModule>false</BinaryModule>\r
-    <OutputFileBasename>DxePcdLib</OutputFileBasename>\r
-  </ModuleDefinitions>\r
-  <LibraryClassDefinitions>\r
-    <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">\r
-      <Keyword>PcdLib</Keyword>\r
-    </LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">\r
-      <Keyword>DebugLib</Keyword>\r
-    </LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">\r
-      <Keyword>UefiBootServicesTableLib</Keyword>\r
-    </LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">\r
-      <Keyword>BaseMemoryLib</Keyword>\r
-    </LibraryClass>\r
-  </LibraryClassDefinitions>\r
-  <SourceFiles>\r
-    <Filename>DxePcdLib.c</Filename>\r
-  </SourceFiles>\r
-  <PackageDependencies>\r
-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
-  </PackageDependencies>\r
-  <Protocols>\r
-    <Protocol Usage="ALWAYS_CONSUMED">\r
-      <ProtocolCName>gPcdProtocolGuid</ProtocolCName>\r
-    </Protocol>\r
-  </Protocols>\r
-  <Externs>\r
-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
-    <Extern>\r
-      <Constructor>PcdLibConstructor</Constructor>\r
-    </Extern>\r
-  </Externs>\r
-</ModuleSurfaceArea>
\ No newline at end of file