pnor_partition_table: Handle toc addresses starting with 0x

With open-power/skiboot commit 36bab76, pflash added a prefix
of 0x to the partition addresses, which is used to generate
the toc.
Add an optional prefix of 0x to the regex to handle this change
while being backwards compatible.
Also add the optional prefix of 0x to the 3rd parameter as this
should also change to specify it's a hex number.
The std::stoul function to convert the string to hex handles
the string with and without the 0x prefix.

Resolves openbmc/openbmc#2124

Change-Id: I2273e28781d57ed8e3640fd287df1fad2e1da3bf
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/pnor_partition_table.cpp b/pnor_partition_table.cpp
index 58a750e..71510a2 100644
--- a/pnor_partition_table.cpp
+++ b/pnor_partition_table.cpp
@@ -152,16 +152,16 @@
     std::ifstream file(tocFile.c_str());
     static constexpr auto ID_MATCH = 1;
     static constexpr auto NAME_MATCH = 2;
-    static constexpr auto START_ADDR_MATCH = 3;
-    static constexpr auto END_ADDR_MATCH = 4;
-    static constexpr auto VERSION_MATCH = 5;
+    static constexpr auto START_ADDR_MATCH = 4;
+    static constexpr auto END_ADDR_MATCH = 6;
+    static constexpr auto VERSION_MATCH = 8;
     // Parse PNOR toc (table of contents) file, which has lines like :
-    // partition01=HBB,00010000,000a0000,80,ECC,PRESERVED, to indicate
+    // partition01=HBB,0x00010000,0x000a0000,0x80,ECC,PRESERVED, to indicate
     // partition information
     std::regex regex
     {
         "^partition([0-9]+)=([A-Za-z0-9_]+),"
-        "([0-9a-fA-F]+),([0-9a-fA-F]+),([A-Fa-f0-9]{2})",
+        "(0x)?([0-9a-fA-F]+),(0x)?([0-9a-fA-F]+),(0x)?([A-Fa-f0-9]{2})",
         std::regex::extended
     };
     std::smatch match;