]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/PCD/Dxe/Service.h
Pass the correct TokenNumber into a CallbackOnSet notification function. The value...
[mirror_edk2.git] / MdeModulePkg / Universal / PCD / Dxe / Service.h
index 7df533b8fcc71c2c7fb917df32967dfc1d35ba38..e2c25af08c13d24b4d831c602d3b7fa33e4830bd 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Private functions used by PCD DXE driver.\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2010, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -10,16 +10,15 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-\r
-Module Name: Service.h\r
-\r
 **/\r
 \r
 #ifndef _PCD_DXE_SERVICE_H_\r
 #define _PCD_DXE_SERVICE_H_\r
 \r
 #include <PiDxe.h>\r
+#include <Guid/PcdDataBaseHobGuid.h>\r
 #include <Protocol/Pcd.h>\r
+#include <Protocol/PiPcd.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiLib.h>\r
@@ -31,20 +30,6 @@ Module Name: Service.h
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 \r
-//\r
-// Please make sure the PCD Serivce PEIM Version is consistent with\r
-// the version of PCD Database generation tool\r
-//\r
-#define PCD_SERVICE_DXE_DRIVER_VERSION      2\r
-\r
-//\r
-// PCD_DXE_DATABASE_GENTOOL_VERSION is defined in Autogen.h\r
-// and generated by PCD Database generation tool.\r
-//\r
-//#if (PCD_SERVICE_DXE_DRIVER_VERSION != PCD_DXE_SERVICE_DRIVER_AUTOGEN_VERSION)\r
-//  #error "Please make sure the version of PCD Service DXE Driver and PCD DXE Database Generation Tool matches"\r
-//#endif\r
-\r
 //\r
 // Protocol Interface function declaration.\r
 //\r
@@ -153,7 +138,7 @@ DxePcdGet64 (
 \r
   @param[in]  TokenNumber The PCD token number. \r
 \r
-  @return The pointer to the buffer to be retrived.\r
+  @return The pointer to the buffer to be retrieved.\r
   \r
 **/\r
 VOID *\r
@@ -293,7 +278,7 @@ DxePcdGet64Ex (
   @param[in]  Guid The token space for the token number.\r
   @param[in]  TokenNumber The PCD token number. \r
 \r
-  @return The pointer to the buffer to be retrived.\r
+  @return The pointer to the buffer to be retrieved.\r
   \r
 **/\r
 VOID *\r
@@ -696,18 +681,28 @@ DxeUnRegisterCallBackOnSet (
   );\r
 \r
 /**\r
-  Retrieves the next valid PCD token for a given namespace.\r
-\r
-  @param[in]      Guid          The 128-bit unique value that designates the namespace from which to extract the value.\r
-  @param[in, out]  TokenNumber   A pointer to the PCD token number to use to find the subsequent token number.  \r
-                                If the input token namespace or token number does not exist on the platform, \r
-                                an error is returned and the value of *TokenNumber is undefined. To retrieve the "first" token, \r
-                                have the pointer reference a TokenNumber value of 0. If the input token number is 0 and \r
-                                there is no valid token number for this token namespace,  *TokenNumber will be assigned to \r
-                                0 and the function return EFI_SUCCESS. If the token number is the last valid token number, \r
-                                *TokenNumber will be assigned to 0 and the function return EFI_SUCCESS.\r
-\r
-  @retval EFI_SUCCESS  The PCD service retrieved the next valid token number. Or the input token number \r
+  Retrieves the next valid token number in a given namespace.  \r
+  \r
+  This is useful since the PCD infrastructure contains a sparse list of token numbers, \r
+  and one cannot a priori know what token numbers are valid in the database. \r
+  \r
+  If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.  \r
+  If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.  \r
+  If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.  \r
+  If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.  \r
+  The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.  \r
+  If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.  \r
+  If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.  \r
+  If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.\r
+\r
+\r
+  @param[in]      Guid    The 128-bit unique value that designates the namespace from which to retrieve the next token. \r
+                          This is an optional parameter that may be NULL.  If this parameter is NULL, then a request is \r
+                          being made to retrieve tokens from the default token space.\r
+  @param[in, out] TokenNumber \r
+                          A pointer to the PCD token number to use to find the subsequent token number.  \r
+\r
+  @retval EFI_SUCCESS   The PCD service retrieved the next valid token number. Or the input token number \r
                         is already the last valid token number in the PCD database. \r
                         In the later case, *TokenNumber is updated with the value of 0.\r
   @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.\r
@@ -746,7 +741,7 @@ typedef struct {
   PCD_PROTOCOL_CALLBACK   CallbackFn;\r
 } CALLBACK_FN_ENTRY;\r
 \r
-#define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) _CR(Record, Type, Field)\r
+#define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) BASE_CR(Record, Type, Field)\r
 \r
 //\r
 // Internal Functions\r
@@ -780,6 +775,7 @@ SetValueWorker (
 \r
   @retval EFI_INVALID_PARAMETER  If this PCD type is VPD, VPD PCD can not be set.\r
   @retval EFI_INVALID_PARAMETER  If Size can not be set to size table.\r
+  @retval EFI_INVALID_PARAMETER  If Size of non-Ptr type PCD does not match the size information in PCD database.  \r
   @retval EFI_NOT_FOUND          If value type of PCD entry is intergrate, but not in\r
                                  range of UINT8, UINT16, UINT32, UINT64\r
   @retval EFI_NOT_FOUND          Can not find the PCD type according to token number.                                \r
@@ -862,7 +858,7 @@ GetWorker (
   Wrapper function for get PCD value for dynamic-ex PCD.\r
 \r
   @param Guid            Token space guid for dynamic-ex PCD.\r
-  @param ExTokenNumber   Token number for dyanmic-ex PCD.\r
+  @param ExTokenNumber   Token number for dynamic-ex PCD.\r
   @param GetSize         The size of dynamic-ex PCD value.\r
 \r
   @return PCD entry in PCD database.\r
@@ -997,7 +993,7 @@ BuildPcdDxeDataBase (
   space guid: token number} to local token number.\r
   \r
   @param Guid            Token space guid for dynamic-ex PCD entry.\r
-  @param ExTokenNumber   EDES_TODO: Add parameter description\r
+  @param ExTokenNumber   Dynamic-ex PCD token number.\r
 \r
   @return local token number for dynamic-ex PCD.\r
 \r
@@ -1047,7 +1043,7 @@ ExGetNextTokeNumber (
   Get size of POINTER type PCD value.\r
 \r
   @param LocalTokenNumberTableIdx Index of local token number in local token number table.\r
-  @param MaxSize                  Maxmium size of POINTER type PCD value.\r
+  @param MaxSize                  Maximum size of POINTER type PCD value.\r
 \r
   @return size of POINTER type PCD value.\r
 \r
@@ -1059,7 +1055,7 @@ GetPtrTypeSize (
   );\r
 \r
 /**\r
-  Set size of POINTER type PCD value. The size should not exceed the maxmium size\r
+  Set size of POINTER type PCD value. The size should not exceed the maximum size\r
   of this PCD value.\r
 \r
   @param LocalTokenNumberTableIdx Index of local token number in local token number table.\r
@@ -1074,8 +1070,6 @@ SetPtrTypeSize (
   IN    OUT   UINTN             *CurrentSize\r
   );\r
 \r
-extern EFI_GUID gPcdDataBaseHobGuid;\r
-\r
 extern PCD_DATABASE * mPcdDatabase;\r
 \r
 extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit;\r
@@ -1083,3 +1077,4 @@ extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit;
 extern EFI_LOCK mPcdDatabaseLock;\r
 \r
 #endif\r
+\r