Fix track EDKT106 & EDKT112: map LibPcdSetPtr function for PatchPcdSetPtr macro funct...
[mirror_edk2.git] / Tools / Source / PcdTools / org / tianocore / pcd / entity / UsageInstance.java
index e38bc91..03499e6 100644 (file)
@@ -368,9 +368,15 @@ public class UsageInstance {
                 // Example autogen string for following generation:\r
                 // "#define _PCD_SET_MODE_8_PcdSampleToken(SizeOfBuffer, Buffer) CopyMem (_gPcd_BinaryPatch_PcdSampleToken, (Buffer), (SizeOfBuffer))"\r
                 // \r
-                hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) CopyMem (_gPcd_BinaryPatch_%s, (Buffer), (SizeOfBuffer))\r\n",\r
+                hAutogenStr += String.format("#define _PCD_PATCHABLE_%s_SIZE %d\r\n",\r
+                                             parentToken.cName,\r
+                                             parentToken.datumSize);\r
+                hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) "+\r
+                                             "LibPatchPcdSetPtr (_gPcd_BinaryPatch_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, "+\r
+                                             "(SizeOfBuffer), (Buffer))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
+                                             parentToken.cName,\r
                                              parentToken.cName);\r
             } else {\r
                 //\r
@@ -396,8 +402,9 @@ public class UsageInstance {
                     // Example autogen string for following generation:\r
                     // "GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_PcdSampleToken[] = _PCD_VALUE_PcdSampleToken;"\r
                     // \r
-                    cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_%s[] = _PCD_VALUE_%s;\r\n",\r
+                    cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_%s[%d] = _PCD_VALUE_%s;\r\n",\r
                                                  parentToken.cName,\r
+                                                 parentToken.datumSize,\r
                                                  parentToken.cName);\r
                 } else {\r
                     //\r