Reviewed-by: S, Ashraf Ali <ashraf.al...@intel.com>

Thanks.,
S, Ashraf Ali

-----Original Message-----
From: Guo, Gua <gua....@intel.com> 
Sent: Monday, April 22, 2024 7:07 AM
To: devel@edk2.groups.io
Cc: Guo, Gua <gua....@intel.com>; Chiu, Chasel <chasel.c...@intel.com>; 
Desimone, Nathaniel L <nathaniel.l.desim...@intel.com>; Duggapu, Chinni B 
<chinni.b.dugg...@intel.com>; Zeng, Star <star.z...@intel.com>; Kuo, Ted 
<ted....@intel.com>; S, Ashraf Ali <ashraf.al...@intel.com>; Susovan Mohapatra 
<susovan.mohapa...@intel.com>
Subject: [PATCH v1 2/2] IntelFsp2Pkg/PatchFv.py: Python 3.12 support

From: Gua Guo <gua....@intel.com>

Ref to https://docs.python.org/3/whatsnew/3.12.html
A backslash-character pair that is not a valid escape sequence now generates

Cc: Chasel Chiu <chasel.c...@intel.com>
Cc: Nate DeSimone <nathaniel.l.desim...@intel.com>
Cc: Duggapu Chinni B <chinni.b.dugg...@intel.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Ted Kuo <ted....@intel.com>
Cc: Ashraf Ali S <ashraf.al...@intel.com>
Cc: Susovan Mohapatra <susovan.mohapa...@intel.com>
Signed-off-by: Gua Guo <gua....@intel.com>
---
 IntelFsp2Pkg/Tools/PatchFv.py | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py 
index 73ab877c71..bd9aa71e3c 100644
--- a/IntelFsp2Pkg/Tools/PatchFv.py
+++ b/IntelFsp2Pkg/Tools/PatchFv.py
@@ -143,7 +143,7 @@ class Symbols:
         fdIn.close()         fvInfo['Base'] = 0         for rptLine in 
rptLines:-            match = 
re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", rptLine)+            match 
= re.match(r"^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", rptLine)             if 
match:                 fvInfo['Base'] = int(match.group(1), 16)                 
break@@ -312,7 +312,7 @@ class Symbols:
         self.fdBase = 0xFFFFFFFF         while (rptLine != "" ):             
#EFI_BASE_ADDRESS = 0xFFFDF400-            match = 
re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", rptLine)+            match 
= re.match(r"^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", rptLine)             if 
match is not None:                 self.fdBase = int(match.group(1), 16) - 
fvOffset                 break@@ -340,7 +340,7 @@ class Symbols:
         fdIn     = open(fvTxtFile, "r")         rptLine  = fdIn.readline()     
    while (rptLine != "" ):-            match = 
re.match("(0x[a-fA-F0-9]+)\s([0-9a-fA-F\-]+)", rptLine)+            match = 
re.match(r"(0x[a-fA-F0-9]+)\s([0-9a-fA-F\-]+)", rptLine)             if match 
is not None:                 if match.group(2) in self.dictFfsOffset:           
          self.dictFfsOffset[fvName + ':' + match.group(2)] = "0x%08X" % 
(int(match.group(1), 16) + fvOffset)@@ -374,10 +374,10 @@ class Symbols:
         while (rptLine != "" ):             if rptLine[0] != ' ':              
   #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310, 
EntryPoint=0x00fffb4958,Type=PE)-                match = 
re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+),\s*Type=\w+\)",
 rptLine)+                match = 
re.match(r"([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+),\s*Type=\w+\)",
 rptLine)                 if match is None:                     #DxeIpl (Fixed 
Flash Address, BaseAddress=0x00fffb4310, EntryPoint=0x00fffb4958)-              
      match = 
re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)",
 rptLine)+                    match = 
re.match(r"([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)",
 rptLine)                 if match is not None:                     foundModHdr 
= True                     modName = match.group(1)@@ -386,7 +386,7 @@ class 
Symbols:
                     self.dictModBase['%s:BASE'  % modName] = int 
(match.group(2), 16)                     self.dictModBase['%s:ENTRY' % modName] 
= int (match.group(3), 16)                 
#(GUID=86D70125-BAA3-4296-A62F-602BEBBB9081 .textbaseaddress=0x00fffb4398 
.databaseaddress=0x00fffb4178)-                match = 
re.match("\(GUID=([A-Z0-9\-]+)\s+\.textbaseaddress=(0x[0-9a-fA-F]+)\s+\.databaseaddress=(0x[0-9a-fA-F]+)\)",
 rptLine)+                match = 
re.match(r"\(GUID=([A-Z0-9\-]+)\s+\.textbaseaddress=(0x[0-9a-fA-F]+)\s+\.databaseaddress=(0x[0-9a-fA-F]+)\)",
 rptLine)                 if match is not None:                     if 
foundModHdr:                         foundModHdr = False@@ -399,7 +399,7 @@ 
class Symbols:
             else:                 #   0x00fff8016c    __ModuleEntryPoint       
          foundModHdr = False-                match = 
re.match("^\s+(0x[a-z0-9]+)\s+([_a-zA-Z0-9]+)", rptLine)+                match 
= re.match(r"^\s+(0x[a-z0-9]+)\s+([_a-zA-Z0-9]+)", rptLine)                 if 
match is not None:                     self.dictSymbolAddress["%s:%s"%(modName, 
match.group(2))] = match.group(1)             rptLine  = fdIn.readline()@@ 
-432,14 +432,14 @@ class Symbols:
         if reportLine.strip().find("Archive member included") != -1:           
  #GCC             #                0x0000000000001d55                IoRead8-  
          patchMapFileMatchString = 
"\s+(0x[0-9a-fA-F]{16})\s+([^\s][^0x][_a-zA-Z0-9\-]+)\s"+            
patchMapFileMatchString = 
r"\s+(0x[0-9a-fA-F]{16})\s+([^\s][^0x][_a-zA-Z0-9\-]+)\s"             
matchKeyGroupIndex = 2             matchSymbolGroupIndex  = 1             
prefix = '_'         else:             #MSFT             #0003:00000190       
_gComBase                  00007a50     SerialPo-            
patchMapFileMatchString =  
"^\s[0-9a-fA-F]{4}:[0-9a-fA-F]{8}\s+(\w+)\s+([0-9a-fA-F]{8,16}\s+)"+            
patchMapFileMatchString =  
r"^\s[0-9a-fA-F]{4}:[0-9a-fA-F]{8}\s+(\w+)\s+([0-9a-fA-F]{8,16}\s+)"            
 matchKeyGroupIndex = 1             matchSymbolGroupIndex  = 2             
prefix = ''@@ -458,11 +458,11 @@ class Symbols:
                 if handleNext:                     handleNext = False          
           pcdName = match.group(1)-                    match   = 
re.match("\s+(0x[0-9a-fA-F]{16})\s+", reportLine)+                    match   = 
re.match(r"\s+(0x[0-9a-fA-F]{16})\s+", reportLine)                     if match 
is not None:                         modSymbols[prefix + pcdName] = 
match.group(1)                 else:-                    match = 
re.match("^\s\.data\.(_gPcd_BinaryPatch[_a-zA-Z0-9\-]+)", reportLine)+          
          match = re.match(r"^\s\.data\.(_gPcd_BinaryPatch[_a-zA-Z0-9\-]+)", 
reportLine)                     if match is not None:                         
handleNext = True                         continue@@ -507,7 +507,7 @@ class 
Symbols:
         fdIn     = open(xrefFile, "r")         rptLine  = fdIn.readline()      
   while (rptLine != "" ):-            match = 
re.match("([0-9a-fA-F\-]+)\s([_a-zA-Z0-9]+)", rptLine)+            match = 
re.match(r"([0-9a-fA-F\-]+)\s([_a-zA-Z0-9]+)", rptLine)             if match is 
not None:                 self.dictGuidNameXref[match.group(1).upper()] = 
match.group(2)             rptLine  = fdIn.readline()-- 
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118067): https://edk2.groups.io/g/devel/message/118067
Mute This Topic: https://groups.io/mt/105662401/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to