Merge pull request #55 from bofferdn/patch-3

op-build pull request to support BIOS infrastructure
diff --git a/README b/README
index d566b16..e53754c 100644
--- a/README
+++ b/README
@@ -20,9 +20,9 @@
 
 1. Install Fedora 20 64-bit.
 2. Install the packages necessary for the build:
-> sudo yum install vim gcc-c++ flex bison git ctags cscope cpan expat-devel patch glibc-devel-i686 libgcc.i686 zlib-devel libstdc++.i686
+> sudo yum install vim gcc-c++ flex bison git ctags cscope expat-devel patch glibc-devel.i686 libgcc.i686 zlib-devel zlib-static libstdc++.i686
 3. Install PERL modules necessary for the build:
->  sudo cpan install XML::Simple YAML XML::SAX Fatal Thread/Queue.pm Env
+>  sudo yum install "perl(XML::Simple)" "perl(YAML)" "perl(XML::SAX)" "perl(Fatal)" "perl(Thread::Queue)" "perl(Env)"
 
 Troubleshooting
 ===============
diff --git a/openpower/configs/habanero_defconfig b/openpower/configs/habanero_defconfig
index f0178f5..8febc0c 100644
--- a/openpower/configs/habanero_defconfig
+++ b/openpower/configs/habanero_defconfig
@@ -18,7 +18,7 @@
 BR2_OPENPOWER_TARGETING_BIN_FILENAME="HABANERO_HB.targeting.bin"
 BR2_OPENPOWER_TARGETING_ECC_FILENAME="HABANERO_HB.targeting.bin.ecc"
 
-BR2_OPENPOWER_PNOR_XML_LAYOUT_FILENAME="HabaneroPnorLayout.xml"
+BR2_OPENPOWER_PNOR_XML_LAYOUT_FILENAME="defaultPnorLayoutWithGoldenSide.xml"
 BR2_OPENPOWER_PNOR_FILENAME="habanero.pnor"
 
 # skiboot requirements
diff --git a/openpower/configs/hostboot/habanero.config b/openpower/configs/hostboot/habanero.config
index f98554f..6c28995 100755
--- a/openpower/configs/hostboot/habanero.config
+++ b/openpower/configs/hostboot/habanero.config
@@ -38,3 +38,6 @@
 unset SET_NOMINAL_PSTATE
 set HTMGT
 set START_OCC_DURING_BOOT
+
+#PNOR flags
+set PNOR_TWO_SIDE_SUPPORT
diff --git a/openpower/configs/palmetto_defconfig b/openpower/configs/palmetto_defconfig
index 3a73288..c208972 100644
--- a/openpower/configs/palmetto_defconfig
+++ b/openpower/configs/palmetto_defconfig
@@ -18,7 +18,7 @@
 BR2_OPENPOWER_TARGETING_BIN_FILENAME="PALMETTO_HB.targeting.bin"
 BR2_OPENPOWER_TARGETING_ECC_FILENAME="PALMETTO_HB.targeting.bin.ecc"
 
-BR2_OPENPOWER_PNOR_XML_LAYOUT_FILENAME="PalmettoPnorLayout.xml"
+BR2_OPENPOWER_PNOR_XML_LAYOUT_FILENAME="defaultPnorLayoutSingleSide.xml"
 BR2_OPENPOWER_PNOR_FILENAME="palmetto.pnor"
 
 # skiboot requirements
diff --git a/openpower/package/hostboot/hostboot-0003-GCC-4.9-Make-compiler-use-ELFv1-ABI-and-use-O2.patch b/openpower/package/hostboot/hostboot-0003-GCC-4.9-Make-compiler-use-ELFv1-ABI-and-use-O2.patch
new file mode 100644
index 0000000..cc25c45
--- /dev/null
+++ b/openpower/package/hostboot/hostboot-0003-GCC-4.9-Make-compiler-use-ELFv1-ABI-and-use-O2.patch
@@ -0,0 +1,48 @@
+From 005cac73915ee6f6b67e9b01ae840b798c1fc80e Mon Sep 17 00:00:00 2001
+From: Andrew Geissler <andrewg@us.ibm.com>
+Date: Mon, 16 Feb 2015 13:43:51 -0600
+Subject: [PATCH] GCC 4.9: Make compiler use ELFv1 ABI and use -O2
+
+GCC4.9 defaults to ELFv2 ABI support but we do not have all
+of the needed tools to suppor this.
+GCC4.9 also does not work well with -O3 so I've had to
+knock us down to -O2 for now.
+
+Change-Id: Iacf49c46b1fb25776ba60d6506ccadff7b46bf60
+RTC: 123430
+---
+ src/build/mkrules/cflags.env.mk |    9 ++++++---
+ 1 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/src/build/mkrules/cflags.env.mk b/src/build/mkrules/cflags.env.mk
+index 8ca32b1..c729341 100644
+--- a/src/build/mkrules/cflags.env.mk
++++ b/src/build/mkrules/cflags.env.mk
+@@ -28,7 +28,8 @@
+ # Description:
+ #     Configuration of the compiler, linker, etc. flags.
+ 
+-OPT_LEVEL ?= -O3
++# TODO RTC 124305 - Get -O3 to work with gcc4.9
++OPT_LEVEL ?= -O2
+ 
+ ifdef MODULE
+ COMMONFLAGS += -fPIC -Bsymbolic -Bsymbolic-functions
+@@ -36,10 +37,12 @@ CFLAGS += -D__HOSTBOOT_MODULE=$(MODULE)
+ endif
+ 
+ COMMONFLAGS += $(OPT_LEVEL) -nostdlib
++# TODO RTC: 123994 - ELFv2 ABI support (-mabi=elfv1)
+ CFLAGS += $(COMMONFLAGS) -mcpu=power7 -nostdinc -g -mno-vsx -mno-altivec\
+           -Wall -Werror -mtraceback=no -pipe \
+-	  -ffunction-sections -fdata-sections -ffreestanding -mbig-endian
+-ASMFLAGS += $(COMMONFLAGS) -mcpu=power7 -mbig-endian
++	  -ffunction-sections -fdata-sections -ffreestanding -mbig-endian \
++      -mabi=elfv1
++ASMFLAGS += $(COMMONFLAGS) -mcpu=power7 -mbig-endian -mabi=elfv1
+ CXXFLAGS += $(CFLAGS) -nostdinc++ -fno-rtti -fno-exceptions -Wall \
+ 	    -fuse-cxa-atexit
+ LDFLAGS += --nostdlib --sort-common -EB $(COMMONFLAGS)
+-- 
+1.7.4.1
+
diff --git a/openpower/package/hostboot/hostboot-0003-Revert-redundent-copy-of-hb-code-in-pnor.patch b/openpower/package/hostboot/hostboot-0003-Revert-redundent-copy-of-hb-code-in-pnor.patch
deleted file mode 100644
index f938bac..0000000
--- a/openpower/package/hostboot/hostboot-0003-Revert-redundent-copy-of-hb-code-in-pnor.patch
+++ /dev/null
@@ -1,2809 +0,0 @@
-From a05bf62e7eb14354ca2d6ca45b149aac6dbd193c Mon Sep 17 00:00:00 2001
-From: Matt Ploetz <maploetz@us.ibm.com>
-Date: Wed, 11 Feb 2015 11:41:48 -0600
-Subject: [PATCH] Revert "Support for Redundant Copy of HB code in PNOR"
-
-This reverts commit 67c5a1ebe73f81bca1bb6608bbb8f204f0f37fa8.
----
- src/build/buildpnor/buildpnor.pl            | 590 +++++++++++-----------------
- src/build/buildpnor/defaultPnorLayout.xml   |  91 ++---
- src/build/mkrules/hbfw/img/makefile         |   4 +-
- src/include/usr/hwas/hwasPlatDeconfigGard.H |  19 +-
- src/include/usr/pnor/pnor_reasoncodes.H     |   2 -
- src/include/usr/pnor/pnorif.H               |  39 +-
- src/usr/hwas/hwasPlatDeconfigGard.C         |  89 +----
- src/usr/pnor/HBconfig                       |   5 -
- src/usr/pnor/common/ffs_hb.H                |   7 +-
- src/usr/pnor/makefile                       |   1 -
- src/usr/pnor/pnor_common.C                  | 182 ++-------
- src/usr/pnor/pnor_common.H                  |  19 +-
- src/usr/pnor/pnorrp.C                       | 152 +++----
- src/usr/pnor/pnorrp.H                       |  26 +-
- src/usr/pnor/pnorsbe.C                      |  87 ----
- src/usr/pnor/pnorvalid.C                    |   5 +-
- src/usr/pnor/runtime/rt_pnor.C              |  11 +-
- src/usr/pnor/runtime/rt_pnor.H              |   2 +-
- src/usr/pnor/test/pnorrptest.H              | 104 +----
- src/usr/sbe/sbe_update.C                    |  95 +++--
- src/usr/sbe/sbe_update.H                    |  38 +-
- src/usr/sbe/test/sbeupdatetest.H            |  24 +-
- 22 files changed, 535 insertions(+), 1057 deletions(-)
- delete mode 100644 src/usr/pnor/pnorsbe.C
-
-diff --git a/src/build/buildpnor/buildpnor.pl b/src/build/buildpnor/buildpnor.pl
-index f6df6c8..51b6922 100755
---- a/src/build/buildpnor/buildpnor.pl
-+++ b/src/build/buildpnor/buildpnor.pl
-@@ -6,7 +6,7 @@
- #
- # OpenPOWER HostBoot Project
- #
--# Contributors Listed Below - COPYRIGHT 2012,2015
-+# Contributors Listed Below - COPYRIGHT 2012,2014
- # [+] International Business Machines Corp.
- #
- #
-@@ -62,20 +62,16 @@ my $g_trace = 1;
- my $programName = File::Basename::basename $0;
- my %pnorLayout;
- my %binFiles;
-+
-+
- my $pnorLayoutFile;
- my $pnorBinName = "";
- my $tocVersion = 0x1;
- my $g_TOCEyeCatch = "part";
- my $emitTestSections = 0;
-+my $g_ffsCmd = "";
- my $g_fpartCmd = "";
- my $g_fcpCmd = "";
--my %sidelessSecFilled = ();
--
--my %SideOptions = (
--        A => "A",
--        B => "B",
--        sideless => "sideless",
--    );
- 
- if ($#ARGV < 0) {
-     usage();
-@@ -106,6 +102,9 @@ for (my $i=0; $i < $#ARGV + 1; $i++)
-         my $argVal = $ARGV[++$i];
-         saveInputFile("--binFile", $argName, $argVal, \%binFiles);
-     }
-+    elsif($ARGV[$i] =~ /--ffsCmd/) {
-+        $g_ffsCmd = $ARGV[++$i];
-+    }
-     elsif($ARGV[$i] =~ /--fpartCmd/) {
-         $g_fpartCmd = $ARGV[++$i];
-     }
-@@ -122,14 +121,12 @@ for (my $i=0; $i < $#ARGV + 1; $i++)
-     }
- }
- 
--############################## Begin Actions ##################################
--
--#Delete File (pnorBinName) if exists to prevent errors when making layout
--#changes
--if (-e $pnorBinName)
--{
--    unlink $pnorBinName or warn "Could not unlink $pnorBinName: $!";
--}
-+#Extract ffs version number from help text.
-+#Use to trigger using proper input parms..
-+#my $ffsParms = 0;
-+#my $ffsVersion = `$g_ffsCmd 2>&1  | grep "Partition Tool" `;
-+#$ffsVersion =~ s/.*(v[0-9\.]*).*/\1/;
-+#$ffsVersion = $1;
- 
- #Load PNOR Layout XML file
- my $rc = loadPnorLayout($pnorLayoutFile, \%pnorLayout);
-@@ -139,6 +136,9 @@ if($rc != 0)
-     exit 1;
- }
- 
-+#trace(1, Dumper(%pnorLayout->{1576960}));
-+#trace(1, Dumper(%binFiles));
-+
- #Verify all the section files exist
- my $rc = verifyFilesExist(\%pnorLayout, \%binFiles);
- if($rc != 0)
-@@ -161,48 +161,42 @@ if($rc != 0)
-     trace(0, "Error detected from call to checkSpaceConstraints().  Exiting");
-     exit 1;
- }
--trace(1, "Done checkSpaceConstraints");
--
--# @TODO RTC: 120062 - Determine which side is Golden, possibly handle a new
--#                    xml tag
--# Create all Partition Tables at each TOC offset
--# Each side has 2 TOC's created at different offsets for backup purposes.
--# Loop all side sections
--foreach my $sideId ( keys %{$pnorLayout{metadata}{sides}} )
-+
-+#create the PNOR image
-+#two copies of TOC created at different offsets
-+my $sideAOffset =  $pnorLayout{metadata}{sideAOffset};
-+my $sideBOffset =  $pnorLayout{metadata}{sideBOffset};
-+
-+$rc = createPnorImg($tocVersion, $pnorBinName, \%pnorLayout, $sideAOffset, 'A');
-+if($rc != 0)
- {
--    # Loop all tocs (primary and backup)
--    foreach my $toc ( keys %{$pnorLayout{metadata}{sides}{$sideId}{toc}})
--    {
--        my $tocOffset = $pnorLayout{metadata}{sides}{$sideId}{toc}{$toc};
-+    trace(0, "Error detected from createPnorImg() sideAOffset. Exiting");
-+    exit 1;
-+}
- 
--        $rc = createPnorPartition($tocVersion, $pnorBinName, \%pnorLayout,
--                                  $sideId, $tocOffset);
--        if($rc != 0)
--        {
--            trace(0, "Error detected from createPnorPartition() $tocOffset Exiting");
--            exit 1;
--        }
--    }
-+$rc = createPnorImg($tocVersion, $pnorBinName, \%pnorLayout, $sideBOffset, 'B');
-+if($rc != 0)
-+{
-+    trace(0, "Error detected from createPnorImg() sideBOffset. Exiting");
-+    exit 1;
- }
- 
--# Fill all sides
--foreach my $sideId ( keys %{$pnorLayout{metadata}{sides}} )
-+$rc = fillPnorImage($pnorBinName, \%pnorLayout, \%binFiles, $sideAOffset, 'A');
-+if($rc != 0)
- {
--    my $tocOffset = $pnorLayout{metadata}{sides}{$sideId}{toc}{primary};
-+    trace(0, "Error detected from call to fillPnorImage() sideAOffset. Exiting");
-+    exit 1;
-+}
- 
--    $rc = fillPnorImage($pnorBinName, \%pnorLayout, \%binFiles, $sideId,
--                        $tocOffset);
--    if($rc != 0)
--    {
--        trace(0, "Error detected from call to fillPnorImage() sideATocOffset. Exiting");
--        exit 1;
--    }
-+$rc = fillPnorImage($pnorBinName, \%pnorLayout, \%binFiles, $sideBOffset, 'B');
-+if($rc != 0)
-+{
-+    trace(0, "Error detected from call to fillPnorImage() sideBOffset. Exiting");
-+    exit 1;
- }
- 
- exit 0;
- 
--#########################  Begin Utility Subroutines ###########################
--
- ################################################################################
- # loadPnorLayout
- ################################################################################
-@@ -221,52 +215,33 @@ sub loadPnorLayout
-     my $xs = new XML::Simple(keyattr=>[], forcearray => 1);
-     my $xml = $xs->XMLin($i_pnorFile);
- 
-+    #trace(1, "pnorLayoutXML \n ".Dumper($xml));
-+
-     #Save the meatadata - imageSize, blockSize, etc.
--    # @TODO RTC:120062 enhance metadata section, fix metadataE1 to match xml
--    # and change TOC names accordingly
-     foreach my $metadataEl (@{$xml->{metadata}})
-     {
--        # Get meta data
-         my $imageSize = $metadataEl->{imageSize}[0];
-         my $blockSize = $metadataEl->{blockSize}[0];
-+        my $sideAOffset = $metadataEl->{sideAOffset}[0];
-+        my $sideBOffset = $metadataEl->{sideBOffset}[0];
-+
-+        trace(3, "$this_func: metadata: imageSize = $imageSize, blockSize=$blockSize, sideAOffset=$sideAOffset, sideBOffset=$sideBOffset");
-+
-         $imageSize = getNumber($imageSize);
-         $blockSize = getNumber($blockSize);
-+        $sideAOffset = getNumber($sideAOffset);
-+        $sideBOffset = getNumber($sideBOffset);
-+
-         $$i_pnorLayoutRef{metadata}{imageSize} = $imageSize;
-         $$i_pnorLayoutRef{metadata}{blockSize} = $blockSize;
--
--        # Get Side A
--        my $sideATocOffset = $metadataEl->{sideATocOffset}[0];
--        my $sideATocBackupOffset = $metadataEl->{sideATocBackupOffset}[0];
--        $sideATocOffset = getNumber($sideATocOffset);
--        $sideATocBackupOffset = getNumber($sideATocBackupOffset);
--        # @TODO RTC: 120062 change pnorLayoutRef hash to match new xml
--        $$i_pnorLayoutRef{metadata}{sides}{$SideOptions{A}}{toc}{primary} = $sideATocOffset;
--        $$i_pnorLayoutRef{metadata}{sides}{$SideOptions{A}}{toc}{backup} = $sideATocBackupOffset;
--
--        # Get side B info (if it exists)
--        if (exists $metadataEl->{sideBTocOffset}[0])
--        {
--            trace(1, "Adding Side B information ....");
--            my $sideBTocOffset = $metadataEl->{sideBTocOffset}[0];
--            my $sideBTocBackupOffset = $metadataEl->{sideBTocBackupOffset}[0];
--            $sideBTocOffset = getNumber($sideBTocOffset);
--            $sideBTocBackupOffset = getNumber($sideBTocBackupOffset);
--            # @TODO RTC: 120062 change pnorLayoutRef hash to match new xml
--            $$i_pnorLayoutRef{metadata}{sides}{$SideOptions{B}}{toc}{primary} = $sideBTocOffset;
--            $$i_pnorLayoutRef{metadata}{sides}{$SideOptions{B}}{toc}{backup} = $sideBTocBackupOffset;
--
--            trace(3, "$this_func: metadata: imageSize = $imageSize, blockSize=$blockSize, sideATocOffset=$sideATocOffset, sideATocBackupOffset=$sideATocBackupOffset, sideBTocOffset=$sideBTocOffset, sideBTocBackupOffset=$sideBTocBackupOffset");
--        }
--        else
--        {
--           trace(3, "$this_func: metadata: imageSize = $imageSize, blockSize=$blockSize, sideATocOffset=$sideATocOffset, sideATocBackupOffset=$sideATocBackupOffset");
--        }
--
-+        $$i_pnorLayoutRef{metadata}{sideAOffset} = $sideAOffset;
-+        $$i_pnorLayoutRef{metadata}{sideBOffset} = $sideBOffset;
-     }
- 
-     #Iterate over the <section> elements.
-     foreach my $sectionEl (@{$xml->{section}})
-     {
-+        #trace(1, "current Element: \n ".Dumper($sectionEl));
-         my $description = $sectionEl->{description}[0];
-         my $eyeCatch = $sectionEl->{eyeCatch}[0];
-         my $physicalOffset = $sectionEl->{physicalOffset}[0];
-@@ -276,9 +251,7 @@ sub loadPnorLayout
-         my $ecc = (exists $sectionEl->{ecc} ? "yes" : "no");
-         my $sha512Version = (exists $sectionEl->{sha512Version} ? "yes" : "no");
-         my $sha512perEC = (exists $sectionEl->{sha512perEC} ? "yes" : "no");
--        my $sideless = (exists $sectionEl->{sideless} ? "yes" : "no");
--        my $preserved = (exists $sectionEl->{preserved} ? "yes" : "no");
--        my $readOnly = (exists $sectionEl->{readOnly} ? "yes" : "no");
-+
-         if (($emitTestSections == 0) && ($sectionEl->{testonly}[0] eq "yes"))
-         {
-             next;
-@@ -289,6 +262,8 @@ sub loadPnorLayout
-         $physicalOffset = getNumber($physicalOffset);
-         $physicalRegionSize = getNumber($physicalRegionSize);
- 
-+        # trace(4, "$this_func: physicalOffset=$physicalOffset, physicalRegionSize=$physicalRegionSize");
-+
-         $$i_pnorLayoutRef{sections}{$physicalOffset}{description} = $description;
-         $$i_pnorLayoutRef{sections}{$physicalOffset}{eyeCatch} = $eyeCatch;
-         $$i_pnorLayoutRef{sections}{$physicalOffset}{physicalOffset} = $physicalOffset;
-@@ -297,9 +272,6 @@ sub loadPnorLayout
-         $$i_pnorLayoutRef{sections}{$physicalOffset}{ecc} = $ecc;
-         $$i_pnorLayoutRef{sections}{$physicalOffset}{sha512Version} = $sha512Version;
-         $$i_pnorLayoutRef{sections}{$physicalOffset}{sha512perEC} = $sha512perEC;
--        $$i_pnorLayoutRef{sections}{$physicalOffset}{sideless} = $sideless;
--        $$i_pnorLayoutRef{sections}{$physicalOffset}{preserved} = $preserved;
--        $$i_pnorLayoutRef{sections}{$physicalOffset}{readOnly} = $readOnly;
- 
-     }
- 
-@@ -307,16 +279,23 @@ sub loadPnorLayout
- }
- 
- ################################################################################
--# createPnorImg - Create PNOR image based on input data.
-+# createPnorImg - Create PNOR image and partitions based on input data.
- ################################################################################
- sub createPnorImg
- {
--    my ($i_tocVersion, $i_pnorBinName, $i_pnorLayoutRef, $i_offset) = @_;
-+    my ($i_tocVersion, $i_pnorBinName, $i_pnorLayoutRef, $offset, $side) = @_;
-     my $this_func = (caller(0))[3];
-     my $rc = 0;
-+    my $key;
-+    my $other_side = 'B';
-     trace(4, "$this_func: >>Enter");
- 
--    trace(1, "createPnorImg:: $i_offset");
-+    trace(1, "createPnorImg:: $offset");
-+
-+    if($side eq 'B')
-+    {
-+        $other_side = 'A';
-+    }
- 
-     #get Block size
-     my $blockSize = $$i_pnorLayoutRef{metadata}{blockSize};
-@@ -324,212 +303,154 @@ sub createPnorImg
-     #Get size of image in blocks
-     my $imageSize = $$i_pnorLayoutRef{metadata}{imageSize};
-     my $blockCount = $imageSize/$blockSize;
--    do{
--        if ($blockCount != int($blockCount))
--        {
--            trace(0, "$this_func: Image size ($imageSize) is not an even multiple of erase blocks ($blockSize).  This is not supported.  Aborting!");
--            $rc = 1;
--            last;
--        }
--
--        #f{fs,part} --create tuleta.pnor --partition-offset 0 --size 8MiB --block 4KiB --force
--        trace(2, "$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --create --size $imageSize --block $blockSize --force");
--        $rc = `$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --create --size $imageSize --block $blockSize --force`;
--        if($rc)
--        {
--            trace(0, "$this_func: Call to creating image failed.  rc=$rc.  Aborting!");
--            last;
--        }
--    }while(0);
--
--    return $rc;
--}
--
--################################################################################
--# addUserData - Add partition user data.
--################################################################################
--sub addUserData
--{
--    my $i_pnorBinName = shift;
--    my $i_offset = shift;
--    my $i_key = shift;
--    my %i_sectionHash = @_;
--
--    my $this_func = (caller(0))[3];
--    my $rc = 0;
--    trace(4, "$this_func: >>Enter");
--
--    my $eyeCatch = $i_sectionHash{$i_key}{eyeCatch};
--
--    # User data Flags based on FFS entry user data (ffs_hb_user_t)
--    my $chip = 0;
--    my $compressType = 0;
--    my $dataInteg = 0;
--    my $verCheck = 0;
--    my $miscFlags = 0;
--
--    # DataInteg flag
--    if( ($i_sectionHash{$i_key}{ecc} eq "yes") )
--    {
--        $dataInteg = 0x8000;
--    }
--
--    # VerCheck Flag
--    if( ($i_sectionHash{$i_key}{sha512Version} eq "yes") )
-+    if ($blockCount != int($blockCount))
-     {
--        $verCheck = 0x80;
--    }
--    elsif( ($i_sectionHash{$i_key}{sha512perEC} eq "yes") )
--    {
--        $verCheck = 0x40;
-+        trace(0, "$this_func: Image size ($imageSize) is not an even multiple of erase blocks ($blockSize).  This is not supported.  Aborting!");
-+        $rc = 1;
-+        return $rc;
-     }
- 
--    # Misc Flags
--    if( ($i_sectionHash{$i_key}{preserved} eq "yes") )
--    {
--        $miscFlags |= 0x80;
-+    #f{fs,part} --create tuleta.pnor --partition-offset 0 --size 8MiB --block 4KiB --force
-+    if ($g_ffsCmd eq "") {
-+        my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --create --size $imageSize --block $blockSize --force`;
-+    } else {
-+        my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $offset --create --size $imageSize --block $blockSize --force`;
-     }
--    if( ($i_sectionHash{$i_key}{readOnly} eq "yes") )
-+    $rc = $?;
-+    if($rc)
-     {
--        $miscFlags |= 0x40;
-+        trace(0, "$this_func: Call to creating image failed.  rc=$rc.  Aborting!");
-+        return $rc;
-     }
- 
-+    #key into hash data is the physical offset of section.  Need to sort the keys
-+    #so we put things in the correct order in toc.
-+    #Generally speaking, this loop is populating the FFS Header with records based on the
-+    #section data specified in the XML + actual sizes of the input binary files.
-+    my %sectionHash = %{$$i_pnorLayoutRef{sections}};
- 
--    #First User Data Word
--    #[1:chip][1:compressType][2:dataInteg]
--    my $userflags0 = ($chip << 24)
--      | ($compressType << 16)
--      | $dataInteg;
-+    for $key ( sort {$a<=> $b} keys %sectionHash)
-+    {
-+        my $eyeCatch = "UNDEF";
-+        my $physicalOffset = 0xFFFFFFFF;
-+        my $physicalRegionSize = 0xFFFFFFFF;
- 
--    #Second User Data Word
--    #[1:sha512Version/sha512perEC][1:miscFlags]
--    my $userflags1 = ($verCheck << 24)
--        | ($miscFlags << 16);
-+        # eyecatcher
-+        my $eyeCatch = $sectionHash{$key}{eyeCatch};
-+        my $myside = $sectionHash{$key}{side};
- 
--    do{
--        trace(2, "$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --user 0 --name $eyeCatch --value userflags0=$userflags0");
--        $rc = `$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --user 0 --name $eyeCatch --value $userflags0`;
--        if($rc)
--        {
--            trace(0, "$this_func: Call to add userdata to $eyeCatch failed.  rc=$rc.  Aborting!");
--            last;
--        }
--        trace(2, "$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --user 1 --name $eyeCatch --value userflags1=$userflags1");
--        $rc = `$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --user 1 --name $eyeCatch --value $userflags1`;
--        if($rc)
-+        #don't try to add the TOC, but need to update all other paritions
-+        #Add if side matches (or not set) -- so if it isn't equal to other side
-+        if(( $eyeCatch ne $g_TOCEyeCatch ) && ( $myside ne $other_side ))
-         {
--            trace(0, "$this_func: Call to add userdata to $eyeCatch failed.  rc=$rc.  Aborting!");
--            last;
--        }
--    }while(0);
--
--    return $rc;
--}
--
--################################################################################
--# createPnorPartition - Create PNOR partitions based on input data.
--################################################################################
--sub createPnorPartition
--{
--    my ($i_tocVersion, $i_pnorBinName, $i_pnorLayoutRef, $side, $offset) = @_;
--    my $this_func = (caller(0))[3];
--    my $rc = 0;
--    my $key;
--    my $other_side = getOtherSide($side);
- 
--    trace(4, "$this_func: >>Enter");
--
--    trace(1, "createPnorPartition:: $offset");
--
--    do{
--        # Create pnor image at partition offset
--        $rc = createPnorImg($i_tocVersion, $i_pnorBinName, $i_pnorLayoutRef,
--                            $offset);
--        if($rc)
--        {
--            last;
--        }
-+            # base/physical offset
-+            my $physicalOffset = $sectionHash{$key}{physicalOffset};
-+            #make sure offset is on a block boundary
-+            my $val = $physicalOffset/$blockSize;
-+            if ($val != int($val))
-+            {
-+                trace(0, "$this_func: Partition offset ($val) is does not fall on an erase block ($blockSize) boundary.  This is not supported.  Aborting!");
-+                $rc = -1;
-+                last;
-+            }
- 
--        #get Block size
--        my $blockSize = $$i_pnorLayoutRef{metadata}{blockSize};
-+            #physical size
-+            my $physicalRegionSize = $sectionHash{$key}{physicalRegionSize};
-+            $val = $physicalRegionSize/$blockSize;
-+            if($val != int($val))
-+            {
-+                trace(0, "$this_func: Partition size ($val) is not an even multiple of erase blocks ($blockSize).  This is not supported.  Aborting!");
-+                exit 1;
-+            }
- 
--        # key into hash data is the physical offset of section.  Need to sort the
--        # keys so we put things in the correct order in toc. Generally speaking,
--        # this loop is populating the FFS Header with records based on the section
--        # data specified in the XML + actual sizes of the input binary files.
--        my %sectionHash = %{$$i_pnorLayoutRef{sections}};
-+            #Add Partition
-+            #f{fs,part} --add --target tuleta.pnor --partition-offset 0 --offset 0x1000   --size 0x280000 --name HBI --flags 0x0
-+            if ($g_ffsCmd eq "") {
-+                trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0");
-+                my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0`;
-+            } else {
-+                my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $offset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0`;
-+            }
-+            $rc = $?;
-+            if($rc)
-+            {
-+                trace(0, "$this_func: Call to add partition $eyeCatch failed.  rc=$rc.  Aborting!");
-+                last;
-+            }
- 
--        for $key ( sort {$a<=> $b} keys %sectionHash)
--        {
--            my $eyeCatch = "UNDEF";
--            my $physicalOffset = 0xFFFFFFFF;
--            my $physicalRegionSize = 0xFFFFFFFF;
-+            # User data Flags
-+            my $chip = 0;
-+            my $compress = 0;
-+            my $ecc = 0;
-+            my $version = 0;
- 
--            # eyecatcher
--            my $eyeCatch = $sectionHash{$key}{eyeCatch};
-+            if( ($sectionHash{$key}{ecc} eq "yes") )
-+            {
-+                $ecc = 0x8000;
-+            }
-+            if( ($sectionHash{$key}{sha512Version} eq "yes") )
-+            {
-+                $version = 0x80;
-+            }
-+            elsif( ($sectionHash{$key}{sha512perEC} eq "yes") )
-+            {
-+                $version = 0x40;
-+            }
- 
--            my $sideInfo = getSideInfo($key, %sectionHash);
-+            #First User Data Word
-+            #[1:chip][1:compression][2:ecc]
-+            my $userflags0 = ($chip << 24)
-+              | ($compress << 16)
-+              | $ecc;
-+
-+            #Second User Data Word
-+            #[1:sha512Version/sha512perEC]
-+            my $userflags1 = ($version << 24);
-+
-+            trace(1,"userflags0 = $userflags0");
-+            trace(1,"userflags1 = $userflags1");
-+            if ($g_ffsCmd eq "") {
-+                trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --user 0 --name $eyeCatch --value $userflags0");
-+                my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --user 0 --name $eyeCatch --value $userflags0`;
-+                trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --user 1 --name $eyeCatch --value $userflags1");
-+                my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --user 1 --name $eyeCatch --value $userflags1`;
-+            }
-+            $rc = $?;
-+            if($rc)
-+            {
-+                trace(0, "$this_func: Call to add userdata to $eyeCatch failed.  rc=$rc.  Aborting!");
-+                last;
-+            }
- 
--            #don't try to add the TOC, but need to update all other paritions
--            #Add if side matches (or not set) -- so if it isn't equal to other side
--            #Also add if sideless
--            if( ($eyeCatch ne $g_TOCEyeCatch ) &&
--                ($sideInfo ne $other_side ))
-+            #Trunc Partition
-+            #f{fs,part} --target tuleta.pnor --partition-offset 0 --name HBI --trunc
-+            if ($g_ffsCmd eq "") {
-+                my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --trunc --name $eyeCatch`;
-+            } else {
-+                my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $offset --trunc --name $eyeCatch`;
-+            }
-+            $rc = $?;
-+            if($rc)
-             {
--                # base/physical offset
--                my $physicalOffset = $sectionHash{$key}{physicalOffset};
--                #make sure offset is on a block boundary
--                my $val = $physicalOffset/$blockSize;
--                if ($val != int($val))
--                {
--                    trace(0, "$this_func: Partition offset ($val) does not fall on an erase block ($blockSize) boundary.  This is not supported.  Aborting!");
--                    $rc = -1;
--                    last;
--                }
--
--                #physical size
--                my $physicalRegionSize = $sectionHash{$key}{physicalRegionSize};
--                $val = $physicalRegionSize/$blockSize;
--                if($val != int($val))
--                {
--                    trace(0, "$this_func: Partition size ($val) is not an even multiple of erase blocks ($blockSize).  This is not supported.  Aborting!");
--                    exit 1;
--                }
--
--                #Add Partition
--                #f{fs,part} --add --target tuleta.pnor --partition-offset 0 --offset 0x1000   --size 0x280000 --name HBI --flags 0x0
--                trace(2, "$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0");
--                $rc = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0`;
--                if($rc)
--                {
--                    trace(0, "$this_func: Call to add partition $eyeCatch failed.  rc=$rc.  Aborting!");
--                    last;
--                }
--
--                # Add User Partition data
--                $rc = addUserData($i_pnorBinName, $offset, $key, %sectionHash);
--                if($rc)
--                {
--                    trace(0, "$this_func: Call to add user data to partition $eyeCatch failed.  rc=$rc.  Aborting!");
--                    last;
--                }
--
--                #Trunc Partition
--                #f{fs,part} --target tuleta.pnor --partition-offset 0 --name HBI --trunc
--                $rc = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --trunc --name $eyeCatch`;
--                if($rc)
--                {
--                    trace(0, "$this_func: Call to trunc partition $eyeCatch failed.  rc=$rc.  Aborting!");
--                    last;
--                }
-+                trace(0, "$this_func: Call to trunc partition $eyeCatch failed.  rc=$rc.  Aborting!");
-+                last;
-             }
-         }
--        # Added in case more functionality added before while ends
--        if ($rc)
--        {
--            last;
--        }
--    }while(0);
-+
-+        #Disable usewords for now.  Will get re-enabled and fixed up as
-+        #we add support for underlying functions
-+
-+#        my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset
-+#        		--user 0 --name $eyeCatch --value $actualRegionSize`;
-+#        $rc = $?;
-+#        if($rc)
-+#        {
-+#            trace(0, "$this_func: Call to fpart setting user 0 for partition $eyeCatch failed.  rc=$rc.  Aborting!");
-+#            last;
-+#        }
-+
-+    }
- 
-     return $rc;
- }
-@@ -649,13 +570,21 @@ sub checkSpaceConstraints
- ################################################################################
- sub fillPnorImage
- {
--    my ($i_pnorBinName, $i_pnorLayoutRef, $i_binFiles, $side, $offset) = @_;
-+    my ($i_pnorBinName, $i_pnorLayoutRef, $i_binFiles, $offset, $side) = @_;
-     my $this_func = (caller(0))[3];
-     my $rc = 0;
-     my $key;
--    my $other_side = getOtherSide($side);
-+    my $other_side = 'B';
-+
-+
-+    if($side eq 'B')
-+    {
-+        $other_side = 'A';
-+    }
-+
- 
-     trace(1, "fillPnorImage:: $offset");
-+
-     #key is the physical offset into the file, however don't need to sort
-     #since FFS allows populating partitions in any order
-     my %sectionHash = %{$$i_pnorLayoutRef{sections}};
-@@ -676,26 +605,27 @@ sub fillPnorImage
-             next;
-         }
- 
--        my $sideInfo = getSideInfo($key, %sectionHash);
-+        my $myside = $sectionHash{$key}{side};
- 
--        # Add if side matches (or not set) -- so if it isn't equal to other side
--        # Only fill sideless sections once
--        if( ($sideInfo ne $other_side) &&
--            (!exists($sidelessSecFilled{$eyeCatch})))
-+        #Add if side matches (or not set) -- so if it isn't equal to other side
-+        if( $myside ne $other_side )
-         {
--            if($sideInfo eq $SideOptions{sideless})
--            {
--                $sidelessSecFilled{$eyeCatch} = 1;
--            }
--            trace(5, "$this_func: populating section $sideInfo:$eyeCatch, filename=$inputFile");
-+            trace(5, "$this_func: populating section $myside:$eyeCatch, filename=$inputFile");
-+
-             #fcp --target tuleta.pnor --partition-offset 0 --name HBI --write hostboot_extended.bin
--            $rc = `$g_fcpCmd $inputFile $i_pnorBinName:$eyeCatch --offset $offset --write --buffer 0x40000000`;
-+            if ($g_ffsCmd eq "") {
-+                my $Out = `$g_fcpCmd $inputFile $i_pnorBinName:$eyeCatch --offset $offset --write --buffer 0x40000000`;
-+            } else {
-+                my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $offset --name $eyeCatch  --write $inputFile`;
-+            }
-+            $rc = $?;
-             if($rc)
-             {
-                 trace(0, "$this_func: Call to fcp adding data to partition $eyeCatch failed.  rc=$rc.  Aborting!");
-                 last;
-             }
-          }
-+
-     }
- 
-     return $rc;
-@@ -723,6 +653,28 @@ sub saveInputFile
- }
- 
- #################################################
-+# getFFSEntrySize: Returns number of bytes in an ffs_entry based on specified version
-+#################################################
-+sub getFFSEntrySize
-+{
-+    my($i_tocVersion, $i_pnorLayoutRef) = @_;
-+    my $this_func = (caller(0))[3];
-+    my $ffsEntrySize = 0;
-+
-+    if($i_tocVersion == 0x1)
-+    {
-+        #16 char name + 12 fixed words + 16 user data words
-+        $ffsEntrySize = 16+(12*4)+(16*4);
-+    }
-+    else
-+    {
-+        trace(0, "$this_func:  Layout Version Unsupported!  i_tocVersion=$i_tocVersion");
-+        exit 1;
-+    }
-+    return $ffsEntrySize;
-+}
-+
-+#################################################
- # Insert specifed number of pad bytes into file
- #
- #################################################
-@@ -780,70 +732,6 @@ sub trace
-     }
- }
- 
--################################################################################
--# getSideInfo - return side info of certain sections and determine if value is
--#               a supported value
--################################################################################
--sub getSideInfo
--{
--    my $i_key = shift;
--    my %i_sectionHash = @_;
--
--    my $side = "";
--    my $eyeCatch = $i_sectionHash{$i_key}{eyeCatch};
--
--
--    if($i_sectionHash{$i_key}{sideless} eq "yes")
--    {
--        return $SideOptions{sideless};
--    }
--    else
--    {
--        $side = $i_sectionHash{$i_key}{side};
--    }
--
--    # Error paths
--    if ($side eq "")
--    {
--        trace(0, "Error detected from call to getSideInfo() - $eyeCatch has no side info specified Exiting");
--        exit 1;
--    }
--    elsif (!exists($SideOptions{$side}))
--    {
--        trace(0, "Error detected from call to getSideInfo() - $eyeCatch has sideInfo = $side which is not supported Exiting");
--        exit 1;
--    }
--
--    return $side;
--}
--
--################################################################################
--# getOtherSide - return other side of the given side
--#                does not default to main side in case more sides are added
--################################################################################
--sub getOtherSide
--{
--    my $i_side = shift;
--    my $other_side = "";
--
--    if($i_side eq $SideOptions{A})
--    {
--        $other_side = $SideOptions{B};
--    }
--    elsif($i_side eq $SideOptions{B})
--    {
--        $other_side = $SideOptions{A};
--    }
--
--    # Error paths
--    if ($other_side eq "")
--    {
--        trace(0, "Error detected from call to getOtherSide() - Could not get other side of side = $i_side Exiting");
--        exit 1;
--    }
--
--    return $other_side;
--}
- 
- 
- ################################################################################
-diff --git a/src/build/buildpnor/defaultPnorLayout.xml b/src/build/buildpnor/defaultPnorLayout.xml
-index 249bdb4..e34f0fe 100644
---- a/src/build/buildpnor/defaultPnorLayout.xml
-+++ b/src/build/buildpnor/defaultPnorLayout.xml
-@@ -5,9 +5,7 @@
- <!--                                                                        -->
- <!-- OpenPOWER HostBoot Project                                             -->
- <!--                                                                        -->
--<!-- Contributors Listed Below - COPYRIGHT 2012,2015                        -->
--<!-- [+] International Business Machines Corp.                              -->
--<!--                                                                        -->
-+<!-- COPYRIGHT International Business Machines Corp. 2012,2014              -->
- <!--                                                                        -->
- <!-- Licensed under the Apache License, Version 2.0 (the "License");        -->
- <!-- you may not use this file except in compliance with the License.       -->
-@@ -24,50 +22,48 @@
- <!-- IBM_PROLOG_END_TAG                                                     -->
- <!--
- Layout Description
--<metadata> Element -> Contains high-level information about the PNOR layout.
--    <imageSize>           -> Size of PNOR image in bytes.
--    <blockSize>           -> size of erase blocks in bytes.
--    <sideATocOffset>      -> Location of Side A Partition Table
--    <sideATocBackupOffset>-> Location of Side A Backup Partition Table
--    <sideBTocOffset>      -> Location of Side B Partition Table
--    <sideBTocBackupOffset>-> Location of Side B Backup Partition Table
--</metadata>
--<section> Element -> Contains information about a PNOR Partition
--    <description>   -> Text description of the partition.
--                       Does not have to be machine readable.
--    <eyeCatch>      -> Name of the Partition
--    <physicalOffset>-> Offset of the Partition in PNOR
--                       in bytes.
--    <physicalSize>  -> Size of the Partition in bytes.
--    <side>          -> Side the Partition should be associated with. This
--                       determines if the partition should be added to the
--                       partition table at <sideATocOffset> or <sideBTocOffset>
--    <sideless/>     -> Indicates partition will be in both TOCs but only one
--                       copy of the partition should be created
--    <testonly/>     -> Indicates partition is used for internal testing only.
--                       Partition should be skipped in production environments.
--    <ecc/>          -> Indicates Partition should be ECC protected
--    <sha512Version/>-> Indicates Partition uses SHA512 for version information.
--    <sha512perEC/>  -> Indicates SHA512 is used to indicate version for each
--                       EC-specific image within the Partition.
--    <preserved/>    -> Indicates Partition is preserved across code updates.
--</section>
-+<metadata> Element -> Contains high-level information about
-+   the PNOR layout.
-+    <imageSize> -> Size of PNOR image in bytes.
-+    <blockSize> -> size of erase blocks in bytes.
-+    <sideAOffset> -> Location of Side A Partition Table
-+    <sideBOffset> -> Location of Side B Partition Table
-+<section> -> Contains information about a PNOR Partition
-+    <description> -> Text description of the partition.
-+                     Does not have to be machine readable.
-+    <eyeCatch> -> Name of the Partition
-+    <physicalOffset> -> Offset of the Partition in PNOR
-+                        in bytes.
-+    <physicalSize> -> Size of the Partition in bytes.
-+    <side> -> Side the partition should be associated with.
-+              This determines if the partition should be
-+              added to the partition table at <sideAOffset>
-+              or <sideBOffset>
-+    <testonly/> Indicates partition is used for internal
-+                testing only.  Partition should be skipped
-+                 in production environments.
-+    <ecc/>  Indicates Partition should be ECC protected
-+    <sha512Version/> Indicates Partition uses SHA512 for
-+                     version information.
-+    <sha512perEC/> Indicates SHA512 is used to indicate
-+                   version for each EC-specific image
-+                   within the Partition.
-+    <preserved/>   Indicates Partition is preserved
-+                   across code updates.
- -->
- 
- <pnor>
-     <metadata>
-         <imageSize>0x4000000</imageSize>
-         <blockSize>0x1000</blockSize>
--        <!-- @TODO RTC: 120062 - Enhance meta info -->
--        <sideATocOffset>0x0</sideATocOffset>
--        <sideATocBackupOffset>0x8000</sideATocBackupOffset>
-+        <sideAOffset>0x0</sideAOffset>
-+        <sideBOffset>0x8000</sideBOffset>
-     </metadata>
-     <section>
-         <description>Hostboot Error Logs (144K)</description>
-         <eyeCatch>HBEL</eyeCatch>
-         <physicalOffset>0x10000</physicalOffset>
-         <physicalRegionSize>0x24000</physicalRegionSize>
--        <sideless/>
-         <ecc/>
-     </section>
-     <section>
-@@ -75,7 +71,6 @@ Layout Description
-         <eyeCatch>GUARD</eyeCatch>
-         <physicalOffset>0x58000</physicalOffset>
-         <physicalRegionSize>0x5000</physicalRegionSize>
--        <sideless/>
-         <ecc/>
-     </section>
-     <section>
-@@ -83,7 +78,6 @@ Layout Description
-         <eyeCatch>HBD</eyeCatch>
-         <physicalOffset>0x5D000</physicalOffset>
-         <physicalRegionSize>0x120000</physicalRegionSize>
--        <sideless/>
-         <ecc/>
-     </section>
-     <section>
-@@ -92,7 +86,6 @@ Layout Description
-         <!--NOTE: MUST update standalone.simics if offset changes -->
-          <physicalOffset>0x17D000</physicalOffset>
-         <physicalRegionSize>0x48000</physicalRegionSize>
--        <sideless/>
-         <ecc/>
-     </section>
-     <section>
-@@ -101,7 +94,6 @@ Layout Description
-         <!--NOTE: MUST update standalone.simics if offset changes -->
-         <physicalOffset>0x1C5000</physicalOffset>
-         <physicalRegionSize>0x90000</physicalRegionSize>
--        <sideless/>
-         <ecc/>
-     </section>
-     <section>
-@@ -110,7 +102,6 @@ Layout Description
-         <!--NOTE: MUST update standalone.simics if offset changes -->
-         <physicalOffset>0x255000</physicalOffset>
-         <physicalRegionSize>0x48000</physicalRegionSize>
--        <sideless/>
-         <ecc/>
-     </section>
-     <section>
-@@ -119,7 +110,6 @@ Layout Description
-         <physicalOffset>0x29D000</physicalOffset>
-         <physicalRegionSize>0x5A0000</physicalRegionSize>
-         <sha512Version/>
--        <sideless/>
-         <ecc/>
-     </section>
-     <section>
-@@ -128,7 +118,6 @@ Layout Description
-         <physicalOffset>0x83D000</physicalOffset>
-         <physicalRegionSize>0x90000</physicalRegionSize>
-         <sha512perEC/>
--        <sideless/>
-         <ecc/>
-     </section>
-     <section>
-@@ -137,7 +126,6 @@ Layout Description
-         <physicalOffset>0x8CD000</physicalOffset>
-         <physicalRegionSize>0x48000</physicalRegionSize>
-         <sha512perEC/>
--        <sideless/>
-         <ecc/>
-     </section>
-     <section>
-@@ -146,7 +134,6 @@ Layout Description
-         <physicalOffset>0x915000</physicalOffset>
-         <physicalRegionSize>0x120000</physicalRegionSize>
-         <sha512Version/>
--        <sideless/>
-         <ecc/>
-     </section>
-     <section>
-@@ -155,7 +142,6 @@ Layout Description
-         <physicalOffset>0xA35000</physicalOffset>
-         <physicalRegionSize>0x240000</physicalRegionSize>
-         <sha512Version/>
--        <sideless/>
-         <ecc/>
-     </section>
-     <section>
-@@ -163,7 +149,6 @@ Layout Description
-         <eyeCatch>PAYLOAD</eyeCatch>
-         <physicalOffset>0xC75000</physicalOffset>
-         <physicalRegionSize>0x1680000</physicalRegionSize>
--        <sideless/>
-         <ecc/>
-     </section>
-     <section>
-@@ -172,18 +157,6 @@ Layout Description
-         <physicalOffset>0x3590000</physicalOffset>
-         <physicalRegionSize>0x9000</physicalRegionSize>
-         <testonly/>
--        <sideless/>
--        <ecc/>
--    </section>
--    <section>
--        <description>Special PNOR Test Space (36K)</description>
--        <eyeCatch>TESTRO</eyeCatch>
--        <physicalOffset>0x3599000</physicalOffset>
--        <physicalRegionSize>0x9000</physicalRegionSize>
--        <testonly/>
--        <sideless/>
--        <preserved/>
--        <readOnly/>
-         <ecc/>
-     </section>
-     <section>
-@@ -193,7 +166,6 @@ Layout Description
-         <physicalOffset>0x3F67000</physicalOffset>
-         <physicalRegionSize>0x90000</physicalRegionSize>
-         <sha512Version/>
--        <sideless/>
-         <ecc/>
-     </section>
-     <section>
-@@ -201,7 +173,6 @@ Layout Description
-         <eyeCatch>GLOBAL</eyeCatch>
-         <physicalOffset>0x3FF7000</physicalOffset>
-         <physicalRegionSize>0x9000</physicalRegionSize>
--        <sideless/>
-         <ecc/>
-     </section>
- </pnor>
-diff --git a/src/build/mkrules/hbfw/img/makefile b/src/build/mkrules/hbfw/img/makefile
-index 925061e..c0b0900 100755
---- a/src/build/mkrules/hbfw/img/makefile
-+++ b/src/build/mkrules/hbfw/img/makefile
-@@ -5,7 +5,7 @@
- #
- # OpenPOWER HostBoot Project
- #
--# Contributors Listed Below - COPYRIGHT 2012,2015
-+# Contributors Listed Below - COPYRIGHT 2012,2014
- # [+] International Business Machines Corp.
- #
- #
-@@ -226,7 +226,7 @@ PNOR_BUILD_SCRIPT = ${buildpnor.pl:P}
- #so need to use tryinclude for now.
- .tryinclude <${.PATH:Ffips_pnor.mk}>
- 
--HOSTBOOT_DEFAULT_SECTIONS = HBB=${BASE_W_HEADER_ECC_IMAGE},HBI=${EXT_ECC_HEADER_IMAGE},HBRT=${HBRT_ECC_HEADER_IMAGE},TEST=${TESTDATA_ECC},TESTRO=${TESTDATA_ECC},HBEL=${HBEL_ECC_IMAGE},GUARD=${GUARD_ECC_IMAGE},GLOBAL=${GLOBAL_ECC_IMAGE},PAYLOAD=${PAYLOAD_ECC_IMAGE},CVPD=${CVPD_ECC_IMAGE},MVPD=${MVPD_ECC_IMAGE},DJVPD=${DJVPD_ECC_IMAGE}
-+HOSTBOOT_DEFAULT_SECTIONS = HBB=${BASE_W_HEADER_ECC_IMAGE},HBI=${EXT_ECC_HEADER_IMAGE},HBRT=${HBRT_ECC_HEADER_IMAGE},TEST=${TESTDATA_ECC},HBEL=${HBEL_ECC_IMAGE},GUARD=${GUARD_ECC_IMAGE},GLOBAL=${GLOBAL_ECC_IMAGE},PAYLOAD=${PAYLOAD_ECC_IMAGE},CVPD=${CVPD_ECC_IMAGE},MVPD=${MVPD_ECC_IMAGE},DJVPD=${DJVPD_ECC_IMAGE}
- 
- 
- HBFW_OBJPATH = ${.PATH:M*obj*}
-diff --git a/src/include/usr/hwas/hwasPlatDeconfigGard.H b/src/include/usr/hwas/hwasPlatDeconfigGard.H
-index c439a42..4b89353 100644
---- a/src/include/usr/hwas/hwasPlatDeconfigGard.H
-+++ b/src/include/usr/hwas/hwasPlatDeconfigGard.H
-@@ -5,9 +5,7 @@
- /*                                                                        */
- /* OpenPOWER HostBoot Project                                             */
- /*                                                                        */
--/* Contributors Listed Below - COPYRIGHT 2012,2015                        */
--/* [+] International Business Machines Corp.                              */
--/*                                                                        */
-+/* COPYRIGHT International Business Machines Corp. 2012,2014              */
- /*                                                                        */
- /* Licensed under the Apache License, Version 2.0 (the "License");        */
- /* you may not use this file except in compliance with the License.       */
-@@ -32,8 +30,6 @@
- #ifndef HWASPLATDECONFIGGARD_H_
- #define HWASPLATDECONFIGGARD_H_
- 
--#include <pnor/pnorif.H>
--
- /**
-  *  @brief Adapt common singleton declaration to specific platform
-  *
-@@ -68,19 +64,6 @@ struct HBDeconfigGard
-     void *iv_pGardRecords;          // Pointer to the GARD Records in PNOR
- };
- 
--/**
-- *  @brief Gets iv_gardSectionInfo and sets it if first time called.
-- *         Sets o_sectionInfo based on iv_gardSectionInfo for the caller
-- *
-- *  @param[out] Guard PNOR section info
-- *
-- *  @return errlHndl_t Error log handle, depending on config options will
-- *          ignore error because no Guard section exists in PNOR
-- *          (e.g. CONFIG_GOLDEN_PNOR_SIDE_SUPPORT)
-- *
-- */
--errlHndl_t getGardSectionInfo(PNOR::SectionInfo_t& o_sectionInfo);
--
- } // namespace HWAS
- 
- #endif // HWASPLATDECONFIGGARD_H_
-diff --git a/src/include/usr/pnor/pnor_reasoncodes.H b/src/include/usr/pnor/pnor_reasoncodes.H
-index 4857c1b..a9854a4 100644
---- a/src/include/usr/pnor/pnor_reasoncodes.H
-+++ b/src/include/usr/pnor/pnor_reasoncodes.H
-@@ -136,8 +136,6 @@ namespace PNOR
-         RC_PNOR_READ_NOT_SUPPORTED   = PNOR_COMP_ID | 0x1F,
-         RC_PNOR_WRITE_NOT_SUPPORTED  = PNOR_COMP_ID | 0x20,
-         RC_NON_ECC_PROTECTED_SECTION = PNOR_COMP_ID | 0x21,
--        RC_WRITABLE_PERM_FAIL        = PNOR_COMP_ID | 0x22,
--        RC_WRITE_TRACKED_PERM_FAIL   = PNOR_COMP_ID | 0x23,
-     };
- 
-     enum UserDetailsTypes
-diff --git a/src/include/usr/pnor/pnorif.H b/src/include/usr/pnor/pnorif.H
-index 2689077..a9856f8 100644
---- a/src/include/usr/pnor/pnorif.H
-+++ b/src/include/usr/pnor/pnorif.H
-@@ -29,7 +29,6 @@
- #include <stdint.h>
- #include <builtins.h>
- #include <errl/errlentry.H>
--#include <utility>
- 
- namespace PNOR
- {
-@@ -62,7 +61,6 @@ enum SectionId
-     ATTR_PERM,      /**< Permanent Attribute Override */
-     CAPP,           /**< CAPP lid */
-     TEST,           /**< Scratch space for PNOR test cases */
--    TESTRO,         /**< Scratch space for PNOR ReadOnly test cases */
- 
-     NUM_SECTIONS,   /**< Number of defined sections */
- 
-@@ -84,8 +82,7 @@ struct SectionInfo_t
-     uint64_t size;      /**< Size of partition in bytes */
-     bool eccProtected;  /**< Section is ECC protected */
-     bool sha512Version; /**< Version Checking */
--    bool sha512perEC; /**< Version Checking perEC */
--    bool readOnly; /**< Section is read only */
-+    bool sha512perEC;   /**< Version Checking perEC */
- };
- 
- /**
-@@ -124,7 +121,6 @@ errlHndl_t fixECC (SectionId i_section);
-  *         true = PNOR DD is using L3 Cache for fake PNOR
-  *         false = PNOR DD not using L3 Cache for fake PNOR
-  */
-- bool usingL3Cache();
- 
- /**
-  * @brief  Clears the specified PNOR section with all FF's (w/ good ECC)
-@@ -135,6 +131,8 @@ errlHndl_t fixECC (SectionId i_section);
-  */
- errlHndl_t clearSection(PNOR::SectionId i_section);
- 
-+bool usingL3Cache();
-+
- /**
-  * @brief Validate the Alternative Master Processor's LPC
-  *        Connection to PNOR
-@@ -143,14 +141,6 @@ errlHndl_t clearSection(PNOR::SectionId i_section);
-  */
- errlHndl_t validateAltMaster( void );
- 
--//@ TODO RTC: 120061 add golden info
--//@ TODO RTC: 109703 make golden changes for informing OPAL
--struct TocInfo_t
--{
--    std::pair<uint64_t, uint64_t> activeTocOffsets;
--    std::pair<uint64_t, uint64_t> altTocOffsets;
--};
--
- /** @brief PNOR::TEST section offsets for test cases to prevent
-  *         concurrency problems
-  */
-@@ -160,29 +150,6 @@ enum TestSectionOffset{
-     pnorTestSec_rt_readwrite_offset = 0x6000,
- };
- 
--////////////////////////////////////////////////////////////////////////////////
--// SBE functionality that lives in PNOR
--
--// Used to keep track of perm/temp, and cur/alt
--enum sbeSeepromSide_t
--{
--    SBE_SEEPROM0         = 0x00,   // corresponds to EEPROM::SBE_PRIMARY
--    SBE_SEEPROM1         = 0x01,   // corresponts to EEPROM::SBE_BACKUP
--    SBE_SEEPROM_INVALID  = 0xFF,
--};
--
--/**
-- * @brief Determines which Seeprom was used to boot the SBE
-- *
-- * @param[in] i_target      Target processor to customize
-- *
-- * @param[out] o_bootSide   The Seeprom the SBE booted from
-- *
-- * @return errlHndl_t       Error log handle on failure.
-- */
--errlHndl_t getSbeBootSeeprom(TARGETING::Target* i_target,
--                             sbeSeepromSide_t& o_bootSide);
--
- }
- 
- #endif
-diff --git a/src/usr/hwas/hwasPlatDeconfigGard.C b/src/usr/hwas/hwasPlatDeconfigGard.C
-index 2911cf3..912f7d4 100644
---- a/src/usr/hwas/hwasPlatDeconfigGard.C
-+++ b/src/usr/hwas/hwasPlatDeconfigGard.C
-@@ -5,7 +5,7 @@
- /*                                                                        */
- /* OpenPOWER HostBoot Project                                             */
- /*                                                                        */
--/* Contributors Listed Below - COPYRIGHT 2013,2015                        */
-+/* Contributors Listed Below - COPYRIGHT 2013,2014                        */
- /* [+] Google Inc.                                                        */
- /* [+] International Business Machines Corp.                              */
- /*                                                                        */
-@@ -52,15 +52,6 @@ using namespace HWAS::COMMON;
- using namespace TARGETING;
- 
- const uint32_t EMPTY_GARD_RECORDID = 0xFFFFFFFF;
--/**
-- * @brief Guard PNOR section info, obtained once for efficiency
-- */
--static PNOR::SectionInfo_t g_GardSectionInfo;
--
--/**
-- * @brief Flag indicating if getGardSectionInfo() was called previously
-- */
--static bool getGardSectionInfoCalled;
- 
- void _flush(void *i_addr);
- errlHndl_t _GardRecordIdSetup(void *&io_platDeconfigGard);
-@@ -99,7 +90,7 @@ errlHndl_t DeconfigGard::platClearGardRecords(
- 
-     HWAS_MUTEX_LOCK(iv_mutex);
-     l_pErr = _GardRecordIdSetup(iv_platDeconfigGard);
--    if (!l_pErr && iv_platDeconfigGard)
-+    if (!l_pErr)
-     {
-         uint32_t l_gardRecordsCleared = 0;
-         HBDeconfigGard *l_hbDeconfigGard =
-@@ -136,6 +127,10 @@ errlHndl_t DeconfigGard::platClearGardRecords(
- 
-         HWAS_INF("GARD Records Cleared: %d", l_gardRecordsCleared);
-     }
-+    else
-+    {
-+        HWAS_ERR("Error from _GardRecordIdSetup");
-+    }
- 
-     HWAS_MUTEX_UNLOCK(iv_mutex);
- #endif // CONFIG_NO_GARD_SUPPORT
-@@ -158,7 +153,7 @@ errlHndl_t DeconfigGard::platGetGardRecords(
- 
-     HWAS_MUTEX_LOCK(iv_mutex);
-     l_pErr = _GardRecordIdSetup(iv_platDeconfigGard);
--    if (!l_pErr && iv_platDeconfigGard)
-+    if (!l_pErr)
-     {
-         HBDeconfigGard *l_hbDeconfigGard =
-                 (HBDeconfigGard *)iv_platDeconfigGard;
-@@ -188,6 +183,10 @@ errlHndl_t DeconfigGard::platGetGardRecords(
-             }
-         } // for
-     }
-+    else
-+    {
-+        HWAS_ERR("Error from _GardRecordIdSetup");
-+    }
- 
-     HWAS_MUTEX_UNLOCK(iv_mutex);
-     HWAS_INF("Get returning %d GARD Records", o_records.size());
-@@ -270,8 +269,9 @@ errlHndl_t DeconfigGard::platCreateGardRecord(
-         }
- 
-         l_pErr = _GardRecordIdSetup(iv_platDeconfigGard);
--        if (l_pErr && iv_platDeconfigGard)
-+        if (l_pErr)
-         {
-+            HWAS_ERR("Error from _GardRecordIdSetup");
-             break;
-         }
- 
-@@ -394,27 +394,20 @@ errlHndl_t _GardRecordIdSetup( void *&io_platDeconfigGard)
-             break;
-         }
- 
--        // Get the PNOR Guard information
-+        // allocate our memory and set things up
-+        io_platDeconfigGard = malloc(sizeof(HBDeconfigGard));
-+        HBDeconfigGard *l_hbDeconfigGard =
-+                (HBDeconfigGard *)io_platDeconfigGard;
-+
-+        // get the PNOR address.
-         PNOR::SectionInfo_t l_section;
--        l_pErr = getGardSectionInfo(l_section);
-+        l_pErr = PNOR::getSectionInfo(PNOR::GUARD_DATA, l_section);
-         if (l_pErr)
-         {
--            HWAS_ERR("_GardRecordIdSetup: getGardSectionInfo failed!!!");
-+            HWAS_ERR("PNOR::getSectionInfo failed!!!");
-             // no support for GARD in this configuration.
-             break;
-         }
--        // Check if guard section exists, as certain configs ignore the above
--        // error (e.g. golden side has no GARD section)
--        if (l_section.size == 0)
--        {
--            HWAS_ERR("_GardRecordIdSetup: No guard section skipping function");
--            break;
--        }
--
--        // allocate our memory and set things up
--        io_platDeconfigGard = malloc(sizeof(HBDeconfigGard));
--        HBDeconfigGard *l_hbDeconfigGard =
--                (HBDeconfigGard *)io_platDeconfigGard;
- 
-         l_hbDeconfigGard->iv_pGardRecords =
-             reinterpret_cast<DeconfigGard::GardRecord *> (l_section.vaddr);
-@@ -473,44 +466,4 @@ void _flush(void *i_addr)
-     }
- }
- 
--errlHndl_t getGardSectionInfo(PNOR::SectionInfo_t& o_sectionInfo)
--{
--    errlHndl_t l_errl = NULL;
--    do
--    {
--        // getSectionInfo has already been called for GUARD_DATA
--        if(getGardSectionInfoCalled)
--        {
--            o_sectionInfo = g_GardSectionInfo;
--            break;
--        }
--
--        // Get Guard Section Info and set gardSectionInfo
--        l_errl = PNOR::getSectionInfo(PNOR::GUARD_DATA, g_GardSectionInfo);
--        if (l_errl)
--        {
--            g_GardSectionInfo.size = 0;
--// @TODO RTC: 120061 - replace config flag with a pnor interface call to say if
--//                     there is a guard section on the current (active) side
--//                     of pnor
--#ifdef CONFIG_TWO_SIDE_SUPPORT
--            HWAS_INF("getGardSectionInfo: No guard section disabling guard support");
--            l_errl = NULL;
--#else
--            HWAS_ERR("getGardSectionInfo:getSectionInfo failed");
--#endif
--        }
--        else
--        {
--            HWAS_INF("getGardSectionInfo: Section %s found, size %d",
--                      g_GardSectionInfo.name, g_GardSectionInfo.size);
--        }
--
--        o_sectionInfo = g_GardSectionInfo;
--        getGardSectionInfoCalled = true;
--    } while(0);
--
--    return l_errl;
--}
--
- } // namespace HWAS
-diff --git a/src/usr/pnor/HBconfig b/src/usr/pnor/HBconfig
-index 21082f4..298144c 100644
---- a/src/usr/pnor/HBconfig
-+++ b/src/usr/pnor/HBconfig
-@@ -37,8 +37,3 @@ config PNOR_IS_32MB
-     default n
-     help
-         Size of the attached flash chip is 32MB, if not set then 64MB is default
--
--config TWO_SIDE_SUPPORT
--    default n
--    help
--        This is used to turn on/off two sided pnor support
-diff --git a/src/usr/pnor/common/ffs_hb.H b/src/usr/pnor/common/ffs_hb.H
-index c96911b..b638021 100644
---- a/src/usr/pnor/common/ffs_hb.H
-+++ b/src/usr/pnor/common/ffs_hb.H
-@@ -5,9 +5,7 @@
- /*                                                                        */
- /* OpenPOWER HostBoot Project                                             */
- /*                                                                        */
--/* Contributors Listed Below - COPYRIGHT 2012,2015                        */
--/* [+] International Business Machines Corp.                              */
--/*                                                                        */
-+/* COPYRIGHT International Business Machines Corp. 2012,2014              */
- /*                                                                        */
- /* Licensed under the Apache License, Version 2.0 (the "License");        */
- /* you may not use this file except in compliance with the License.       */
-@@ -27,7 +25,7 @@
- 
- /*
-  * FSP Destination: src/hbfw/fsp/pnor/common/ffs_hb.H
-- *
-+ * 
-  * NOTE: Do NOT modify this file in CMVC directly!  It comes from the Hostboot
-  *      repository and will be overwritten.
- */
-@@ -65,7 +63,6 @@ enum
- 
-     /* Miscellaneous Bits : 1 byte */
-     FFS_MISC_PRESERVED     = 0x80,    /**< Preserved across code updates */
--    FFS_MISC_READ_ONLY     = 0x40,    /**< Read only section */
-     FFS_MISC_UNUSED        = 0x1F,    /**< Unused MISC Flags */
- };
- 
-diff --git a/src/usr/pnor/makefile b/src/usr/pnor/makefile
-index 2f0a4e1..31087a4 100644
---- a/src/usr/pnor/makefile
-+++ b/src/usr/pnor/makefile
-@@ -32,7 +32,6 @@ OBJS += pnor_common.o
- OBJS += pnorvalid.o
- OBJS += ecc.o
- OBJS += sfcdd.o
--OBJS += pnorsbe.o
- 
- #SFC Implementations
- OBJS += $(if $(CONFIG_SFC_IS_IBM_DPSS),sfc_ibm.o)
-diff --git a/src/usr/pnor/pnor_common.C b/src/usr/pnor/pnor_common.C
-index 00931ec..e8972e2 100644
---- a/src/usr/pnor/pnor_common.C
-+++ b/src/usr/pnor/pnor_common.C
-@@ -24,15 +24,14 @@
- /* IBM_PROLOG_END_TAG                                                     */
- 
- #include "pnor_common.H"
-+#include <pnor/pnorif.H>
- #include <pnor/pnor_reasoncodes.H>
- 
- #include "ffs.h"           //Common header file with BuildingBlock.
- #include "common/ffs_hb.H" //Hostboot def of user data in ffs_entry struct
--#include <sys/mm.h>
- 
- #include <initservice/initserviceif.H>
- #include <util/align.H>
--#include <errl/errlmanager.H>
- 
- // Trace definition
- trace_desc_t* g_trac_pnor = NULL;
-@@ -46,29 +45,28 @@ TRAC_INIT(&g_trac_pnor, PNOR_COMP_NAME, 4*KILOBYTE, TRACE::BUFFER_SLOW); //4K
-  * Eyecatcher strings for PNOR TOC entries
-  */
- const char* cv_EYECATCHER[] = {
--    "part",      /**< PNOR::TOC            : Table of Contents */
--    "HBI",       /**< PNOR::HB_EXT_CODE    : Hostboot Extended Image */
--    "GLOBAL",    /**< PNOR::GLOBAL_DATA    : Global Data */
--    "HBB",       /**< PNOR::HB_BASE_CODE   : Hostboot Base Image */
--    "SBEC",      /**< PNOR::CENTAUR_SBE    : Centaur Self-Boot Engine image */
--    "SBE",       /**< PNOR::SBE_IPL        : Self-Boot Enginer IPL image */
--    "WINK",      /**< PNOR::WINK           : Sleep Winkle Reference image */
--    "PAYLOAD",   /**< PNOR::PAYLOAD        : HAL/OPAL */
--    "HBRT",      /**< PNOR::HB_RUNTIME     : Hostboot Runtime (for Sapphire) */
--    "HBD",       /**< PNOR::HB_DATA        : Hostboot Data */
--    "GUARD",     /**< PNOR::GUARD_DATA     : Hostboot Data */
--    "HBEL",      /**< PNOR::HB_ERRLOGS     : Hostboot Error log Repository */
--    "DJVPD",     /**< PNOR::DIMM_JEDEC_VPD : Dimm JEDEC VPD */
--    "MVPD",      /**< PNOR::MODULE_VPD     : Module VPD */
--    "CVPD",      /**< PNOR::CENTAUR_VPD    : Centaur VPD */
--    "NVRAM",     /**< PNOR::NVRAM          : OPAL Storage */
--    "OCC",       /**< PNOR::OCC            : OCC LID */
--    "FIRDATA",   /**< PNOR::FIRDATA        : FIRDATA */
-+    "part",     /**< PNOR::TOC            : Table of Contents */
-+    "HBI",      /**< PNOR::HB_EXT_CODE    : Hostboot Extended Image */
-+    "GLOBAL",   /**< PNOR::GLOBAL_DATA    : Global Data */
-+    "HBB",      /**< PNOR::HB_BASE_CODE   : Hostboot Base Image */
-+    "SBEC",     /**< PNOR::CENTAUR_SBE    : Centaur Self-Boot Engine image */
-+    "SBE",      /**< PNOR::SBE_IPL        : Self-Boot Enginer IPL image */
-+    "WINK",     /**< PNOR::WINK           : Sleep Winkle Reference image */
-+    "PAYLOAD",  /**< PNOR::PAYLOAD        : HAL/OPAL */
-+    "HBRT",     /**< PNOR::HB_RUNTIME     : Hostboot Runtime (for Sapphire) */
-+    "HBD",      /**< PNOR::HB_DATA        : Hostboot Data */
-+    "GUARD",    /**< PNOR::GUARD_DATA     : Hostboot Data */
-+    "HBEL",     /**< PNOR::HB_ERRLOGS     : Hostboot Error log Repository */
-+    "DJVPD",    /**< PNOR::DIMM_JEDEC_VPD : Dimm JEDEC VPD */
-+    "MVPD",     /**< PNOR::MODULE_VPD     : Module VPD */
-+    "CVPD",     /**< PNOR::CENTAUR_VPD    : Centaur VPD */
-+    "NVRAM",    /**< PNOR::NVRAM          : OPAL Storage */
-+    "OCC",      /**< PNOR::OCC            : OCC LID */
-+    "FIRDATA",  /**< PNOR::FIRDATA        : FIRDATA */
-     "ATTR_TMP",  /**< PNOR::ATTR_TMP       : Temporary Attribute Overrides */
-     "ATTR_PERM", /**< PNOR::ATTR_PERM      : Permanent Attribute Overrides */
--    "CAPP",      /**< PNOR::CAPP            : CAPP LID */
--    "TEST",      /**< PNOR::TEST           : Test space for PNOR*/
--    "TESTRO",    /**< PNOR::TESTRO         : ReadOnly Test space for PNOR */
-+    "CAPP",     /**< PNOR::CAPP           : CAPP LID */
-+    "TEST",     /**< PNOR::TEST           : Test space for PNOR*/
-     //Not currently used
- //    "XXX",    /**< NUM_SECTIONS       : Used as invalid entry */
- };
-@@ -91,7 +89,7 @@ uint32_t PNOR::pnor_ffs_checksum(void* data, size_t size)
- }
- 
- errlHndl_t PNOR::parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer,
--           TOCS & o_TOC_used, SectionData_t * o_TOC, uint64_t i_baseVAddr)
-+           uint32_t & o_TOC_used, SectionData_t * o_TOC, uint64_t i_baseVAddr)
- {
-     TRACUCOMP(g_trac_pnor,"PNOR::parseTOC>");
-     errlHndl_t l_errhdl = NULL;
-@@ -99,10 +97,9 @@ errlHndl_t PNOR::parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer,
-     bool TOC_0_failed = false;
- 
-     do{
--        o_TOC_used = TOC_0;
-+        o_TOC_used = 0;
- 
--        for (TOCS cur_TOC = TOC_0; cur_TOC < NUM_TOCS;
--            cur_TOC = (TOCS)(cur_TOC+1))
-+        for (uint32_t cur_TOC = 0; cur_TOC < NUM_TOCS; ++cur_TOC)
-         {
-             TRACFCOMP(g_trac_pnor, "PNOR::parseTOC verifying TOC: %d",cur_TOC);
-             uint64_t nextVAddr = i_baseVAddr;
-@@ -137,10 +134,10 @@ errlHndl_t PNOR::parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer,
-                 {
-                     TRACFCOMP(g_trac_pnor, "PNOR::parseTOC TOC 0 failed header checksum");
-                     TOC_0_failed = true;
--                    o_TOC_used = TOC_1;
-+                    o_TOC_used = 1;
-                     continue;
-                 }
--                else if (cur_TOC == TOC_1 && TOC_0_failed)
-+                else if (cur_TOC == 1 && TOC_0_failed)
-                 {
-                     // Both TOC's failed
-                     TRACFCOMP(g_trac_pnor, "PNOR::parseTOC both TOCs are corrupted");
-@@ -167,7 +164,7 @@ errlHndl_t PNOR::parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer,
-             }
- 
-             // Only check header if on first TOC or the first TOC failed
--            if (cur_TOC == TOC_0 || TOC_0_failed)
-+            if (cur_TOC == 0 || TOC_0_failed)
-             {
-                 TRACFCOMP(g_trac_pnor, "PNOR::parseTOC: FFS Block size=0x%.8X,"
-                  " Partition Table Size = 0x%.8x, entry_count=%d",
-@@ -273,15 +270,15 @@ errlHndl_t PNOR::parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer,
-                     // in SP-less config
-                     TRACFCOMP(g_trac_pnor, "PNOR::parseTOC pnor_ffs_checksum"
-                             " entry checksums do not match");
--                    if (cur_TOC == TOC_0)
-+                    if (cur_TOC == 0)
-                     {
-                         TRACFCOMP(g_trac_pnor,"PNOR::parseTOC TOC 0 entry"
-                                 " checksum failed");
-                         TOC_0_failed = true;
--                        o_TOC_used = TOC_1;
-+                        o_TOC_used = 1;
-                         break;
-                     }
--                    else if (cur_TOC == TOC_1 && TOC_0_failed)
-+                    else if (cur_TOC == 1 && TOC_0_failed)
-                     {
-                         // Both TOC's failed
-                         TRACFCOMP(g_trac_pnor, "PNOR::parseTOC both TOC's are"
-@@ -309,7 +306,7 @@ errlHndl_t PNOR::parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer,
-                 }
- 
-                 // Only set data if on first TOC or the first TOC failed
--                if (cur_TOC == TOC_0 || TOC_0_failed)
-+                if (cur_TOC == 0 || TOC_0_failed)
-                 {
-                     //Figure out section enum
-                     for(uint32_t eyeIndex=PNOR::TOC;eyeIndex<PNOR::NUM_SECTIONS;
-@@ -396,120 +393,25 @@ errlHndl_t PNOR::parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer,
-                                               0, 0, true);
-                         break;
-                     }
--
--# ifndef __HOSTBOOT_RUNTIME
--                    // Handle section permissions
--                    if (o_TOC[secId].misc & FFS_MISC_READ_ONLY)
--                    {
--                        // Need to set permissions to allow writing to virtual
--                        // addresses, but prevents the kernel from ejecting
--                        // dirty pages (no WRITE_TRACKED).
--                        int rc = mm_set_permission(
--                                                (void*)o_TOC[secId].virtAddr,
--                                                o_TOC[secId].size,
--                                                WRITABLE);
--                        if (rc)
--                        {
--                            TRACFCOMP(g_trac_pnor, "E>PnorRP::readTOC: Failed to set block permissions to WRITABLE for section %s.",
--                                      cv_EYECATCHER[secId]);
--                            /*@
--                            * @errortype
--                            * @moduleid PNOR::MOD_PNORRP_READTOC
--                            * @reasoncode PNOR::RC_WRITABLE_PERM_FAIL
--                            * @userdata1 PNOR section id
--                            * @userdata2 PNOR section vaddr
--                            * @devdesc Could not set permissions of the
--                            * given PNOR section to WRITABLE
--                            * @custdesc A problem occurred while reading PNOR partition table
--                            */
--                            l_errhdl = new ERRORLOG::ErrlEntry(
--                                            ERRORLOG::ERRL_SEV_UNRECOVERABLE,
--                                            PNOR::MOD_PNORRP_READTOC,
--                                            PNOR::RC_WRITABLE_PERM_FAIL,
--                                            secId,
--                                            o_TOC[secId].virtAddr,
--                                            true /*Add HB SW Callout*/);
--                            l_errhdl->collectTrace(PNOR_COMP_NAME);
--                        }
--                    }
--                    else
--                    {
--                        // Need to set permissions to R/W
--                        int rc = mm_set_permission(
--                                            (void*)o_TOC[secId].virtAddr,
--                                            o_TOC[secId].size,
--                                            WRITABLE | WRITE_TRACKED);
--                        if (rc)
--                        {
--                            TRACFCOMP(g_trac_pnor, "E>PnorRP::readTOC: Failed to set block permissions to WRITABLE/WRITE_TRACKED for section %s.",
--                                      cv_EYECATCHER[secId]);
--                            /*@
--                            * @errortype
--                            * @moduleid PNOR::MOD_PNORRP_READTOC
--                            * @reasoncode PNOR::RC_WRITE_TRACKED_PERM_FAIL
--                            * @userdata1 PNOR section id
--                            * @userdata2 PNOR section vaddr
--                            * @devdesc Could not set permissions of the
--                            * given PNOR section to
--                            * WRITABLE/WRITE_TRACKED
--                            * @custdesc A problem occurred while reading
--                            * PNOR partition table
--                            */
--                            l_errhdl = new ERRORLOG::ErrlEntry(
--                                            ERRORLOG::ERRL_SEV_UNRECOVERABLE,
--                                            PNOR::MOD_PNORRP_READTOC,
--                                            PNOR::RC_WRITE_TRACKED_PERM_FAIL,
--                                            secId,
--                                            o_TOC[secId].virtAddr,
--                                            true /*Add HB SW Callout*/);
--                            l_errhdl->collectTrace(PNOR_COMP_NAME);
--                        }
--                    }
--#endif
--                    if( l_errhdl )
--                    {
--                        // If both toc0 and toc1 fail break and return the error
--                        if ( (cur_TOC == TOC_1) && (TOC_0_failed) )
--                        {
--                            TRACFCOMP(g_trac_pnor, "PNOR::parseTOC readFromDevice Failed on both TOCs");
--                            break;
--                        }
--
--                        // Toc 1 has not been read yet or Toc 0 was read
--                        // successfully
--                        // Commit error and break to continue checking the next
--                        // TOC
--                        else
--                        {
--                            TRACFCOMP(g_trac_pnor, "PNOR::parseTOC readFromDevice Failed on TOC %d, commit error",
--                                      cur_TOC);
--                            errlCommit(l_errhdl,PNOR_COMP_ID);
--                            l_errhdl = NULL;
--                            break;
--                        }
--                    }
-                 }
--            } // For TOC Entries
-+            }
-             if (l_errhdl)
-             {
-+                TRACFCOMP(g_trac_pnor, ERR_MRK"PNOR::parseTOC: error parsing");
-                 break;
-             }
--        } // For TOC's
--        if (l_errhdl)
--        {
--            break;
-+
-+            for(PNOR::SectionId tmpId = PNOR::FIRST_SECTION;
-+                tmpId < PNOR::NUM_SECTIONS;
-+                tmpId = (PNOR::SectionId) (tmpId + 1) )
-+            {
-+                TRACFCOMP(g_trac_pnor, "%s:    size=0x%.8X  flash=0x%.8X  "
-+                       "virt=0x%.16X", cv_EYECATCHER[tmpId], o_TOC[tmpId].size,
-+                       o_TOC[tmpId].flashAddr, o_TOC[tmpId].virtAddr );
-+            }
-         }
-     } while(0);
- 
--    for(PNOR::SectionId tmpId = PNOR::FIRST_SECTION;
--        tmpId < PNOR::NUM_SECTIONS;
--        tmpId = (PNOR::SectionId) (tmpId + 1) )
--    {
--        TRACFCOMP(g_trac_pnor, "%s:    size=0x%.8X  flash=0x%.8X  "
--               "virt=0x%.16X", cv_EYECATCHER[tmpId], o_TOC[tmpId].size,
--               o_TOC[tmpId].flashAddr, o_TOC[tmpId].virtAddr );
--    }
--
-     TRACUCOMP(g_trac_pnor, "< PNOR::parseTOC" );
-     return l_errhdl;
- }
-diff --git a/src/usr/pnor/pnor_common.H b/src/usr/pnor/pnor_common.H
-index 5eb8934..3944e27 100644
---- a/src/usr/pnor/pnor_common.H
-+++ b/src/usr/pnor/pnor_common.H
-@@ -41,22 +41,11 @@ namespace PNOR {
-         uint8_t misc; /**< Misc Flags */
-     } PACKED;
- 
--    // Simple enum of TOC's per PNOR side
--    enum TOCS
--    {
--        TOC_0 = 0,
--        TOC_1 = 1,
--        NUM_TOCS,
--    };
--
-     enum
-     {
--        // @TODO RTC: 120061 - Determine TOC locations
--        // TOC offsets based on pnor layout
--        SIDE_A_TOC_0_OFFSET = 0,
--        SIDE_A_TOC_1_OFFSET = 0x8000,
--        SIDE_B_TOC_0_OFFSET = 0x2000000,
--        SIDE_B_TOC_1_OFFSET = 0x2008000,
-+        NUM_TOCS = 2,
-+        TOC_0_OFFSET = 0,
-+        TOC_1_OFFSET = 0x8000,
- 
-         /** Real number of bytes required to read 1 logical page */
-         PAGESIZE_PLUS_ECC = ((PAGESIZE * 9)/8),  // 8B data + 1B of ECC
-@@ -90,7 +79,7 @@ namespace PNOR {
-      * @return Error
-      */
-     errlHndl_t parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer,
--           TOCS & o_TOC_used, SectionData_t * o_TOC, uint64_t i_baseVAddr);
-+           uint32_t & o_TOC_used, SectionData_t * o_TOC, uint64_t i_baseVAddr);
- }
- 
- #endif
-diff --git a/src/usr/pnor/pnorrp.C b/src/usr/pnor/pnorrp.C
-index aeaeb22..299a063 100644
---- a/src/usr/pnor/pnorrp.C
-+++ b/src/usr/pnor/pnorrp.C
-@@ -44,7 +44,6 @@
- #include <endian.h>
- #include <util/align.H>
- #include <config.h>
--#include "pnor_common.H"
- 
- 
- extern trace_desc_t* g_trac_pnor;
-@@ -193,9 +192,7 @@ void* wait_for_message( void* unused )
-  * @brief  Constructor
-  */
- PnorRP::PnorRP()
--: iv_activeTocOffsets(SIDE_A_TOC_0_OFFSET,SIDE_A_TOC_1_OFFSET)
--,iv_altTocOffsets(SIDE_B_TOC_0_OFFSET,SIDE_B_TOC_1_OFFSET)
--,iv_TOC_used(TOC_0)
-+: iv_TOC_used(0)
- ,iv_msgQ(NULL)
- ,iv_startupRC(0)
- {
-@@ -234,28 +231,12 @@ void PnorRP::initDaemon()
- 
-     do
-     {
--        // @TODO RTC: 120062 - Determine which side is Golden
--        // Default TOC offsets set to side A. If two side support is enabled,
--        // check which SEEPROM hostboot booted from
--#ifdef CONFIG_TWO_SIDE_SUPPORT
--        TARGETING::Target* pnor_target = TARGETING::
--                                         MASTER_PROCESSOR_CHIP_TARGET_SENTINEL;
--        // Get correct TOC
--        PNOR::sbeSeepromSide_t l_bootSide;
--        PNOR::getSbeBootSeeprom(pnor_target, l_bootSide);
--        if (l_bootSide == PNOR::SBE_SEEPROM1)
--        {
--            TRACFCOMP( g_trac_pnor, "PnorRP::initDaemon> Booting from Side B");
--            iv_activeTocOffsets.first = SIDE_B_TOC_0_OFFSET;
--            iv_activeTocOffsets.second = SIDE_B_TOC_1_OFFSET;
--            iv_altTocOffsets.first = SIDE_A_TOC_0_OFFSET;
--            iv_altTocOffsets.second = SIDE_A_TOC_0_OFFSET;
--        }
--        else
-+        // read the TOC in the PNOR to compute the sections
-+        l_errhdl = readTOC();
-+        if( l_errhdl )
-         {
--            TRACFCOMP( g_trac_pnor, "PnorRP::initDaemon> Booting from Side A");
-+            break;
-         }
--#endif
- 
-         // create a message queue
-         iv_msgQ = msg_q_create();
-@@ -272,7 +253,7 @@ void PnorRP::initDaemon()
-              * @userdata1    Requested Address
-              * @userdata2    rc from mm_alloc_block
-              * @devdesc      PnorRP::initDaemon> Error from mm_alloc_block
--             * @custdesc     A problem occurred while accessing the boot flash.
-+             * @custdesc    A problem occurred while accessing the boot flash.
-              */
-             l_errhdl = new ERRORLOG::ErrlEntry(
-                            ERRORLOG::ERRL_SEV_UNRECOVERABLE,
-@@ -289,14 +270,9 @@ void PnorRP::initDaemon()
-         INITSERVICE::registerBlock(reinterpret_cast<void*>(BASE_VADDR),
-                                    TOTAL_SIZE,PNOR_PRIORITY);
- 
--        // Read the TOC in the PNOR to compute the sections and set their
--        // correct permissions
--        l_errhdl = readTOC();
--        if( l_errhdl )
--        {
--            TRACFCOMP(g_trac_pnor, ERR_MRK"PnorRP::initDaemon: Failed to readTOC");
--            break;
--        }
-+        // Need to set permissions to R/W
-+        rc = mm_set_permission((void*) BASE_VADDR,TOTAL_SIZE,
-+                               WRITABLE | WRITE_TRACKED);
- 
-         // start task to wait on the queue
-         task_create( wait_for_message, NULL );
-@@ -343,7 +319,7 @@ errlHndl_t PnorRP::getSectionInfo( PNOR::SectionId i_section,
-              * @userdata1    Requested Section
-              * @userdata2    Startup RC
-              * @devdesc      PnorRP::getSectionInfo> RP not properly initialized
--             * @custdesc     A problem occurred while accessing the boot flash.
-+             * @custdesc    A problem occurred while accessing the boot flash.
-              */
-             l_errhdl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
-                                                PNOR::MOD_PNORRP_GETSECTIONINFO,
-@@ -370,7 +346,7 @@ errlHndl_t PnorRP::getSectionInfo( PNOR::SectionId i_section,
-              * @userdata1    Requested Section
-              * @userdata2    TOC used
-              * @devdesc      PnorRP::getSectionInfo> Invalid Address for read/write
--             * @custdesc     A problem occurred while accessing the boot flash.
-+             * @custdesc    A problem occurred while accessing the boot flash.
-             */
-             l_errhdl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
-                                                PNOR::MOD_PNORRP_GETSECTIONINFO,
-@@ -402,13 +378,12 @@ errlHndl_t PnorRP::getSectionInfo( PNOR::SectionId i_section,
-                                  != 0) ? true : false;
-         o_info.sha512perEC = ((iv_TOC[id].version & FFS_VERS_SHA512_PER_EC)
-                                != 0) ? true : false;
--        o_info.readOnly = ((iv_TOC[id].misc & FFS_MISC_READ_ONLY)
--                               != 0) ? true : false;
-     }
- 
-     return l_errhdl;
- }
- 
-+
- /**
-  * @brief Read the TOC and store section information
-  */
-@@ -420,7 +395,7 @@ errlHndl_t PnorRP::readTOC()
-     uint8_t* toc1Buffer = new uint8_t[PAGESIZE];
-     uint64_t fatal_error = 0;
-     do {
--        l_errhdl = readFromDevice( iv_activeTocOffsets.first, 0, false,
-+        l_errhdl = readFromDevice( TOC_0_OFFSET, 0, false,
-                                 toc0Buffer, fatal_error );
-         if (l_errhdl)
-         {
-@@ -428,7 +403,7 @@ errlHndl_t PnorRP::readTOC()
-             break;
-         }
- 
--        l_errhdl = readFromDevice( iv_activeTocOffsets.second, 0, false,
-+        l_errhdl = readFromDevice( TOC_1_OFFSET, 0, false,
-                                    toc1Buffer, fatal_error );
-         if (l_errhdl)
-         {
-@@ -437,7 +412,7 @@ errlHndl_t PnorRP::readTOC()
-         }
- 
-         l_errhdl = PNOR::parseTOC(toc0Buffer, toc1Buffer, iv_TOC_used, iv_TOC,
--                                  BASE_VADDR);
-+                   BASE_VADDR);
-         if (l_errhdl)
-         {
-             TRACFCOMP(g_trac_pnor, "readTOC: parseTOC failed");
-@@ -762,63 +737,59 @@ errlHndl_t PnorRP::computeDeviceAddr( void* i_vaddr,
-     o_chip = 99;
-     uint64_t l_vaddr = (uint64_t)i_vaddr;
- 
--    do
-+    // make sure this is one of our addresses
-+    if( !((l_vaddr >= BASE_VADDR)
-+          && (l_vaddr < LAST_VADDR)) )
-     {
--        // make sure this is one of our addresses
--        if( !((l_vaddr >= BASE_VADDR)
--              && (l_vaddr < LAST_VADDR)) )
--        {
--            TRACFCOMP( g_trac_pnor, "PnorRP::computeDeviceAddr> Virtual Address outside known PNOR range : i_vaddr=%p", i_vaddr );
--            /*@
--             * @errortype
--             * @moduleid     PNOR::MOD_PNORRP_WAITFORMESSAGE
--             * @reasoncode   PNOR::RC_INVALID_ADDRESS
--             * @userdata1    Virtual Address
--             * @userdata2    Base PNOR Address
--             * @devdesc      PnorRP::computeDeviceAddr> Virtual Address outside
--             *               known PNOR range
--             * @custdesc    A problem occurred while accessing the boot flash.
--             */
--            l_errhdl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
--                                            PNOR::MOD_PNORRP_COMPUTEDEVICEADDR,
--                                            PNOR::RC_INVALID_ADDRESS,
--                                            l_vaddr,
--                                            BASE_VADDR,
--                                            true /*Add HB SW Callout*/);
--            l_errhdl->collectTrace(PNOR_COMP_NAME);
--            break;
--        }
-+        TRACFCOMP( g_trac_pnor, "PnorRP::computeDeviceAddr> Virtual Address outside known PNOR range : i_vaddr=%p", i_vaddr );
-+        /*@
-+         * @errortype
-+         * @moduleid     PNOR::MOD_PNORRP_WAITFORMESSAGE
-+         * @reasoncode   PNOR::RC_INVALID_ADDRESS
-+         * @userdata1    Virtual Address
-+         * @userdata2    Base PNOR Address
-+         * @devdesc      PnorRP::computeDeviceAddr> Virtual Address outside
-+         *               known PNOR range
-+         * @custdesc    A problem occurred while accessing the boot flash.
-+         */
-+        l_errhdl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
-+                                        PNOR::MOD_PNORRP_COMPUTEDEVICEADDR,
-+                                        PNOR::RC_INVALID_ADDRESS,
-+                                        l_vaddr,
-+                                        BASE_VADDR,
-+                                        true /*Add HB SW Callout*/);
-+        l_errhdl->collectTrace(PNOR_COMP_NAME);
-+        return l_errhdl;
-+    }
- 
--        // find the matching section
--        PNOR::SectionId id = PNOR::INVALID_SECTION;
--        l_errhdl = computeSection( l_vaddr, id );
--        if( l_errhdl )
--        {
--            TRACFCOMP( g_trac_pnor, "PnorRP::computeDeviceAddr> Virtual address does not match any pnor sections : i_vaddr=%p", i_vaddr );
--            break;
--        }
-+    // find the matching section
-+    PNOR::SectionId id = PNOR::INVALID_SECTION;
-+    l_errhdl = computeSection( l_vaddr, id );
-+    if( l_errhdl )
-+    {
-+        return l_errhdl;
-+    }
- 
--        // pull out the information we need to return from our global copy
--        o_chip = iv_TOC[id].chip;
--        o_ecc = (bool)(iv_TOC[id].integrity & FFS_INTEG_ECC_PROTECT);
--        o_offset = l_vaddr - iv_TOC[id].virtAddr; //offset into section
-+    // pull out the information we need to return from our global copy
-+    o_chip = iv_TOC[id].chip;
-+    o_ecc = (bool)(iv_TOC[id].integrity & FFS_INTEG_ECC_PROTECT);
-+    o_offset = l_vaddr - iv_TOC[id].virtAddr; //offset into section
- 
--        // for ECC we need to figure out where the ECC-enhanced offset is
--        //  before tacking on the offset to the section
--        if( o_ecc )
--        {
--            o_offset = (o_offset * 9) / 8;
--        }
--        // add on the offset of the section itself
--        o_offset += iv_TOC[id].flashAddr;
--    } while(0);
-+    // for ECC we need to figure out where the ECC-enhanced offset is
-+    //  before tacking on the offset to the section
-+    if( o_ecc )
-+    {
-+        o_offset = (o_offset * 9) / 8;
-+    }
-+    // add on the offset of the section itself
-+    o_offset += iv_TOC[id].flashAddr;
- 
-     TRACUCOMP( g_trac_pnor, "< PnorRP::computeDeviceAddr: i_vaddr=%X, o_offset=0x%X, o_chip=%d", l_vaddr, o_offset, o_chip );
-     return l_errhdl;
- }
- 
- /**
-- * @brief Static instance function
-+ * @brief Static instance function for testcase only
-  */
- PnorRP& PnorRP::getInstance()
- {
-@@ -1016,10 +987,3 @@ errlHndl_t PnorRP::fixECC (PNOR::SectionId i_section)
-     TRACFCOMP(g_trac_pnor, EXIT_MRK"PnorRP::fixECC");
-     return l_err;
- }
--
--uint64_t PnorRP::getTocOffset(TOCS i_toc) const
--{
--    // Can use a ternary operator because there are only 2 TOCs per side
--    return (i_toc == TOC_0) ? iv_activeTocOffsets.first :
--                              iv_activeTocOffsets.second;
--}
-diff --git a/src/usr/pnor/pnorrp.H b/src/usr/pnor/pnorrp.H
-index 509cf14..3703afe 100644
---- a/src/usr/pnor/pnorrp.H
-+++ b/src/usr/pnor/pnorrp.H
-@@ -76,18 +76,9 @@ class PnorRP
-      */
-     errlHndl_t fixECC(PNOR::SectionId i_section);
- 
--    /**
--     * @brief  Get TOC offset of specified TOC on active side
--     *
--     * @param[in] i_toc     TOC offset desired on active side
--     *
--     * @return uint64_t     TOC offset
--     */
--    uint64_t getTocOffset(PNOR::TOCS i_toc) const;
--
-   protected:
-     /**
--     * @brief  Constructor, default TOC offsets to side A
-+     * @brief  Constructor
-      */
-     PnorRP();
- 
-@@ -98,23 +89,16 @@ class PnorRP
- 
- 
-   private:
--
--    // TOC 0 and 1 offsets of both PNOR sides. The active PNOR side determined
--    // by the Seeprom the SBE booted from
--    std::pair<uint64_t, uint64_t> iv_activeTocOffsets;
--    std::pair<uint64_t, uint64_t> iv_altTocOffsets;
--
-     enum
-     {
-         BASE_VADDR = VMM_VADDR_PNOR_RP, /**< 2GB = 0x80000000*/
-         TOTAL_SIZE = 64*MEGABYTE, /**< Allocate 64 MB (0x4000000)*/
-         LAST_VADDR = BASE_VADDR + TOTAL_SIZE,  /**< End of our VA range */
-     };
--
-     /**
-      * Which TOC (0 or 1) is used after verifying both.
-      */
--    PNOR::TOCS iv_TOC_used;
-+    uint32_t iv_TOC_used;
- 
-     /**
-      * Flash statistics
-@@ -154,8 +138,7 @@ class PnorRP
- 
-     /**
-      * @brief Verify both TOC's and store section information from one of the
--     *        verified TOC's. Additionally set each section permissions
--     *        (e.g. readOnly)
-+     *        verified TOC's
-      *
-      * @return Error from device
-      */
-@@ -241,6 +224,7 @@ class PnorRP
-         return false;
-     };
- 
-+
-     // allow local helper function to call private methods
-     friend void* wait_for_message( void* unused );
- 
-@@ -253,7 +237,7 @@ class PnorRP
-     friend errlHndl_t PNOR::validateAltMaster( void );
- 
-     /**
--     * @brief Static instance function
-+     * @brief Static instance function for testcase only
-      */
-     static PnorRP& getInstance();
- };
-diff --git a/src/usr/pnor/pnorsbe.C b/src/usr/pnor/pnorsbe.C
-deleted file mode 100644
-index 0b61173..0000000
---- a/src/usr/pnor/pnorsbe.C
-+++ /dev/null
-@@ -1,87 +0,0 @@
--/* IBM_PROLOG_BEGIN_TAG                                                   */
--/* This is an automatically generated prolog.                             */
--/*                                                                        */
--/* $Source: src/usr/pnor/pnorsbe.C $                                      */
--/*                                                                        */
--/* OpenPOWER HostBoot Project                                             */
--/*                                                                        */
--/* Contributors Listed Below - COPYRIGHT 2014,2015                        */
--/* [+] International Business Machines Corp.                              */
--/*                                                                        */
--/*                                                                        */
--/* Licensed under the Apache License, Version 2.0 (the "License");        */
--/* you may not use this file except in compliance with the License.       */
--/* You may obtain a copy of the License at                                */
--/*                                                                        */
--/*     http://www.apache.org/licenses/LICENSE-2.0                         */
--/*                                                                        */
--/* Unless required by applicable law or agreed to in writing, software    */
--/* distributed under the License is distributed on an "AS IS" BASIS,      */
--/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
--/* implied. See the License for the specific language governing           */
--/* permissions and limitations under the License.                         */
--/*                                                                        */
--/* IBM_PROLOG_END_TAG                                                     */
--/**
-- *  @file pnorsbe.C
-- *
-- *  @brief Implements PNOR::getSbeBootSeeprom(), which Determines which
-- *         Seeprom was used to boot the SB
-- */
--
--#include <pnor/pnorif.H>
--#include <trace/interface.H>
--#include <errl/errlmanager.H>
--#include <errl/errlentry.H>
--#include <devicefw/userif.H>
--
--extern trace_desc_t* g_trac_pnor;
--
--namespace PNOR
--{
--
--//Used to read SBE Boot Side from processor
--const uint64_t SBE_VITAL_REG_0x0005001C = 0x005001C;
--const uint64_t SBE_BOOT_SELECT_MASK = 0x0080000000000000;
--
--errlHndl_t getSbeBootSeeprom(TARGETING::Target* i_target,
--                             sbeSeepromSide_t& o_bootSide)
--{
--    TRACFCOMP( g_trac_pnor, ENTER_MRK"PNOR::getSbeBootSeeprom()" );
--
--    errlHndl_t err = NULL;
--    uint64_t scomData = 0x0;
--
--    o_bootSide = SBE_SEEPROM0;
--
--    do{
--
--        size_t op_size = sizeof(scomData);
--        err = deviceRead( i_target,
--                          &scomData,
--                          op_size,
--                          DEVICE_SCOM_ADDRESS(SBE_VITAL_REG_0x0005001C) );
--        if( err )
--        {
--            TRACFCOMP( g_trac_pnor, ERR_MRK"PNOR::getSbeBootSeeprom() -Error "
--                       "reading SBE VITAL REG (0x%.8X) from Target :"
--                       "HUID=0x%.8X",
--                       SBE_VITAL_REG_0x0005001C,
--                       TARGETING::get_huid(i_target));
--            break;
--        }
--        if(scomData & SBE_BOOT_SELECT_MASK)
--        {
--            o_bootSide = SBE_SEEPROM1;
--        }
--
--    }while(0);
--
--    TRACFCOMP( g_trac_pnor,
--               EXIT_MRK"PNOR::getSbeBootSeeprom(): o_bootSide=0x%X (reg=0x%X)",
--               o_bootSide, scomData );
--
--    return err;
--}
--
--} // end namespace
-\ No newline at end of file
-diff --git a/src/usr/pnor/pnorvalid.C b/src/usr/pnor/pnorvalid.C
-index 46204ca..1bc09a2 100644
---- a/src/usr/pnor/pnorvalid.C
-+++ b/src/usr/pnor/pnorvalid.C
-@@ -102,7 +102,7 @@ errlHndl_t validateAltMaster( void )
-     // When reading PNOR TOC assume a single page and no ECC
-     uint8_t* tocBuffer = new uint8_t[PAGESIZE];
-     size_t read_size = PAGESIZE;
--    const uint64_t toc0_offset = PnorRP::getInstance().getTocOffset(TOC_0);
-+    const uint64_t toc0_offset = PNOR::TOC_0_OFFSET;
- 
-     do{
- 
-@@ -176,7 +176,8 @@ errlHndl_t validateAltMaster( void )
-             pnordd = new PnorDD(procList[i]);
- 
-             // Read Flash
--            l_err = pnordd->readFlash(tocBuffer, read_size, toc0_offset);
-+            l_err = pnordd->readFlash(tocBuffer, read_size,
-+                                      PNOR::TOC_0_OFFSET);
-             if ( l_err )
-             {
-                 // Commit Error Log, but continue the test
-diff --git a/src/usr/pnor/runtime/rt_pnor.C b/src/usr/pnor/runtime/rt_pnor.C
-index c61aa1d..c43160f 100644
---- a/src/usr/pnor/runtime/rt_pnor.C
-+++ b/src/usr/pnor/runtime/rt_pnor.C
-@@ -297,7 +297,7 @@ errlHndl_t RtPnor::flush( PNOR::SectionId i_section)
- }
- /*******Protected Methods**************/
- RtPnor::RtPnor()
--:iv_TOC_used(PNOR::TOC_0)
-+:iv_TOC_used(0)
- {
-     errlHndl_t l_err = readTOC();
-     if (l_err)
-@@ -588,10 +588,7 @@ errlHndl_t RtPnor::readTOC ()
-             break;
-         }
- 
--        // @TODO RTC:120733
--        // RT code needs a way to get the active side tocs vs just defaulting
--        // to SIDE_A
--        l_err = readFromDevice (l_procId, PNOR::TOC, PNOR::SIDE_A_TOC_0_OFFSET,
-+        l_err = readFromDevice (l_procId, PNOR::TOC, PNOR::TOC_0_OFFSET,
-                 PAGESIZE,false,toc0Buffer);
-         if (l_err)
-         {
-@@ -599,7 +596,7 @@ errlHndl_t RtPnor::readTOC ()
-                       " for TOC0");
-             break;
-         }
--        l_err = readFromDevice (l_procId, PNOR::TOC, PNOR::SIDE_A_TOC_1_OFFSET,
-+        l_err = readFromDevice (l_procId, PNOR::TOC, PNOR::TOC_1_OFFSET,
-                 PAGESIZE, false,toc1Buffer);
-         if (l_err)
-         {
-@@ -608,7 +605,7 @@ errlHndl_t RtPnor::readTOC ()
-             break;
-         }
- 
--        l_err = PNOR::parseTOC(toc0Buffer, toc1Buffer, iv_TOC_used, iv_TOC, 0);
-+        l_err = PNOR::parseTOC(toc0Buffer, toc1Buffer, iv_TOC_used, iv_TOC,0);
-         if (l_err)
-         {
-             TRACFCOMP(g_trac_pnor, "RtPnor::readTOC: parseTOC failed");
-diff --git a/src/usr/pnor/runtime/rt_pnor.H b/src/usr/pnor/runtime/rt_pnor.H
-index f3a03a5..43041fc 100644
---- a/src/usr/pnor/runtime/rt_pnor.H
-+++ b/src/usr/pnor/runtime/rt_pnor.H
-@@ -81,7 +81,7 @@ class RtPnor
-         /**
-         * Which TOC (0 or 1) is used after verifying both.
-         */
--        PNOR::TOCS iv_TOC_used;
-+        uint32_t iv_TOC_used;
- 
-         /**
-          * Cached copy of section data
-diff --git a/src/usr/pnor/test/pnorrptest.H b/src/usr/pnor/test/pnorrptest.H
-index 427227b..04ca729 100644
---- a/src/usr/pnor/test/pnorrptest.H
-+++ b/src/usr/pnor/test/pnorrptest.H
-@@ -517,30 +517,22 @@ class PnorRpTest : public CxxTest::TestSuite
-         uint8_t* corruptBuffer = new uint8_t[PAGESIZE];
- 
-         // Corrupt both ffs header and first entry for each TOC
--        for (PNOR::TOCS cur_TOC = PNOR::TOC_0; cur_TOC < PNOR::NUM_TOCS;
--             cur_TOC = (PNOR::TOCS)(cur_TOC+1))
-+        for (uint32_t cur_TOC = 0; cur_TOC < PNOR::NUM_TOCS; ++cur_TOC)
-         {
--            PNOR::TOCS TOC_used = cur_TOC;
-+            uint32_t TOC_used = cur_TOC;
- 
-             if (cur_TOC == 0)
-             {
--              offset =  PnorRP::getInstance().getTocOffset(PNOR::TOC_0);
-+              offset =  PNOR::TOC_0_OFFSET;
-             }
-             else
-             {
--              offset =  PnorRP::getInstance().getTocOffset(PNOR::TOC_1);
-+              offset =  PNOR::TOC_1_OFFSET;
-             }
- 
-             // Read cur_TOC header data
--            PnorRP::getInstance().readFromDevice( offset, 0, false,
--                                                  tocHeader, fatal_error );
--            if (fatal_error)
--            {
--                TRACFCOMP(g_trac_pnor, "PnorRpTest::test_TOC> ERROR : Could not read TOC header data at offset 0x%X RC=%X",
--                          offset, fatal_error);
--                TS_FAIL("PnorRpTest::test_TOC> ERROR : Could not read TOC header data at offset 0x%X RC=%X",
--                          offset, fatal_error);
--            }
-+            PnorRP::getInstance().readFromDevice( offset, 0, false, tocHeader,
-+                                                  fatal_error );
- 
-             // Corrupt cur_TOC header data
-             memcpy(corruptBuffer, tocHeader, PAGESIZE);
-@@ -567,13 +559,6 @@ class PnorRpTest : public CxxTest::TestSuite
-             PnorRP::getInstance().readFromDevice( offset + FFS_HDR_SIZE, 0,
-                                                   false, tocEntry,
-                                                   fatal_error );
--            if (fatal_error)
--            {
--                TRACFCOMP(g_trac_pnor, "PnorRpTest::test_TOC> ERROR : Could not read first TOC entry data at offset 0x%X RC=%X",
--                          offset, fatal_error);
--                TS_FAIL("PnorRpTest::test_TOC> ERROR : Could not read first TOC entry data at offset 0x%X RC=%X",
--                          offset, fatal_error);
--            }
- 
-             // Corrupt cur_TOC header data
-             memcpy(corruptBuffer, tocEntry, PAGESIZE);
-@@ -606,83 +591,6 @@ class PnorRpTest : public CxxTest::TestSuite
-         TRACFCOMP(g_trac_pnor, "PnorRpTest::test_TOC End");
-     }
- 
--    /**
--     * @brief PNOR RP test - ReadOnlyTag
--     *        Tests if readOnly tag on a section is being processed correctly
--     *
--     */
--    void test_ReadOnlyTag(void)
--    {
--        TRACFCOMP(g_trac_pnor, "PnorRpTest::test_ReadOnlyTag Start" );
--        PNOR::SectionInfo_t l_info;
--        errlHndl_t l_errhdl = NULL;
--        uint64_t chip_select = 0xF;
--        bool needs_ecc = false;
--
--        l_errhdl = PNOR::getSectionInfo(PNOR::TESTRO, l_info);
--        if( l_errhdl )
--        {
--            TRACFCOMP(g_trac_pnor, "PnorRpTest::test_ReadOnlyTag> ERROR : getSectionInfo returned error for %d : RC=%X",
--                      PNOR::TESTRO, l_errhdl->reasonCode());
--            ERRORLOG::errlCommit(l_errhdl, PNOR_COMP_ID);
--            TS_FAIL( "PnorRpTest::test_ReadOnlyTag> ERROR : could not read pnor section %d", PNOR::TESTRO);
--        }
--
--        // Write some data
--        const uint64_t l_writeData = 0x1122334455667788;
--        uint64_t* l_dataptr = reinterpret_cast<uint64_t*> (l_info.vaddr);
--        l_dataptr[0] = l_writeData;
--
--        // Flush the page to make sure it gets out to the device
--        // Due to ReadOnly permissions set on TESTRO should be a no-op
--        int rc = mm_remove_pages( RELEASE, l_dataptr, PAGESIZE );
--        if( rc )
--        {
--            TRACFCOMP( g_trac_pnor, "PnorRpTest::test_ReadOnlyTag> ERROR : error on RELEASE : rc=%X", rc );
--            TS_FAIL( "PnorRpTest::test_ReadOnlyTag> ERROR : error on RELEASE" );
--        }
--
--        // Get physical address of pnor section
--        uint64_t l_address = 0;
--        l_errhdl = PnorRP::getInstance().computeDeviceAddr((void*)l_info.vaddr,
--                                                        l_address,
--                                                        chip_select,
--                                                        needs_ecc);
--        if(l_errhdl)
--        {
--            TRACFCOMP(g_trac_pnor, "PnorRpTest::test_ReadOnlyTag> ERROR : computeDeviceAddr vaddr = 0x%X",l_info.vaddr);
--            errlCommit(l_errhdl,PNOR_COMP_ID);
--            TS_FAIL( "PnorRpTest::test_ReadOnlyTag> ERROR : computeDeviceAddr vaddr = 0x%X",l_info.vaddr);
--        }
--
--        // Read pnor section and check if write did not occur
--        uint64_t l_readData = 0;
--        size_t l_size = sizeof(uint64_t);
--        l_errhdl = deviceRead(TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL,
--                              &l_readData,
--                              l_size,
--                              DEVICE_PNOR_ADDRESS(0, l_address));
--        TRACFCOMP(g_trac_pnor, "PnorRpTest::test_ReadOnlyTag> Read Data = 0x%X",l_readData);
--        if(l_errhdl)
--        {
--            TS_FAIL("PnorRpTest::test_ReadOnlyTag: deviceRead() failed! Error committed.");
--            ERRORLOG::errlCommit(l_errhdl, PNOR_COMP_ID);
--        }
--        if(l_readData == l_writeData)
--        {
--            TS_FAIL("PnorRpTest::test_ReadOnlyTag: Data was written to readOnly section = %s",
--                     l_info.name);
--        }
--        if(l_size != sizeof(uint64_t))
--        {
--            TS_FAIL("PnorRpTest::test_ReadOnlyTag: deviceRead() Read length not expected value. Addr: 0x%llx, Exp: %d, Act: %d",
--                    l_address, sizeof(uint64_t), l_size);
--        }
--
--        TRACFCOMP(g_trac_pnor, "PnorRpTest::test_ReadOnlyTag End");
--    }
--
--
-     //@todo - import config data from build and compare to section info
- 
-     /**
-diff --git a/src/usr/sbe/sbe_update.C b/src/usr/sbe/sbe_update.C
-index 698d41a..9dd9e0a 100644
---- a/src/usr/sbe/sbe_update.C
-+++ b/src/usr/sbe/sbe_update.C
-@@ -1214,6 +1214,49 @@ namespace SBE
-     }
- 
- /////////////////////////////////////////////////////////////////////
-+    errlHndl_t getSbeBootSeeprom(TARGETING::Target* i_target,
-+                                 sbeSeepromSide_t& o_bootSide)
-+    {
-+        TRACUCOMP( g_trac_sbe,
-+                   ENTER_MRK"getSbeBootSeeprom()" );
-+
-+        errlHndl_t err = NULL;
-+        uint64_t scomData = 0x0;
-+
-+        o_bootSide = SBE_SEEPROM0;
-+
-+        do{
-+
-+            size_t op_size = sizeof(scomData);
-+            err = deviceRead( i_target,
-+                              &scomData,
-+                              op_size,
-+                              DEVICE_SCOM_ADDRESS(SBE_VITAL_REG_0x0005001C) );
-+            if( err )
-+            {
-+                TRACFCOMP( g_trac_sbe, ERR_MRK"getSbeBootSeeprom() -Error "
-+                           "reading SBE VITAL REG (0x%.8X) from Target :"
-+                           "HUID=0x%.8X",
-+                           SBE_VITAL_REG_0x0005001C,
-+                           TARGETING::get_huid(i_target));
-+                break;
-+            }
-+            if(scomData & SBE_BOOT_SELECT_MASK)
-+            {
-+                o_bootSide = SBE_SEEPROM1;
-+            }
-+
-+        }while(0);
-+
-+        TRACUCOMP( g_trac_sbe,
-+                   EXIT_MRK"getSbeBootSeeprom(): o_bootSide=0x%X (reg=0x%X)",
-+                   o_bootSide, scomData );
-+
-+        return err;
-+    }
-+
-+
-+/////////////////////////////////////////////////////////////////////
-     errlHndl_t getSbeInfoState(sbeTargetState_t& io_sbeState)
-     {
- 
-@@ -1308,11 +1351,11 @@ namespace SBE
-             if(SEEPROM_0_PERMANENT_VALUE ==
-                (io_sbeState.mvpdSbKeyword.flags & PERMANENT_FLAG_MASK))
-             {
--                io_sbeState.permanent_seeprom_side = PNOR::SBE_SEEPROM0;
-+                io_sbeState.permanent_seeprom_side = SBE_SEEPROM0;
-             }
-             else // Side 1 must be permanent
-             {
--                io_sbeState.permanent_seeprom_side = PNOR::SBE_SEEPROM1;
-+                io_sbeState.permanent_seeprom_side = SBE_SEEPROM1;
-             }
- 
- 
-@@ -1361,21 +1404,21 @@ namespace SBE
-             /*  Determine which SEEPROM System Booted On   */
-             /***********************************************/
-             //Get Current (boot) Side
--            PNOR::sbeSeepromSide_t tmp_cur_side = PNOR::SBE_SEEPROM_INVALID;
--            err = PNOR::getSbeBootSeeprom(io_sbeState.target, tmp_cur_side);
-+            sbeSeepromSide_t tmp_cur_side = SBE_SEEPROM_INVALID;
-+            err = getSbeBootSeeprom(io_sbeState.target, tmp_cur_side);
-             if(err)
-             {
-                 TRACFCOMP( g_trac_sbe, ERR_MRK"getSbeInfoState() - Error returned from getSbeBootSeeprom()");
-                 break;
-             }
-             io_sbeState.cur_seeprom_side = tmp_cur_side;
--            if (io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM0)
-+            if (io_sbeState.cur_seeprom_side == SBE_SEEPROM0)
-             {
--                io_sbeState.alt_seeprom_side = PNOR::SBE_SEEPROM1;
-+                io_sbeState.alt_seeprom_side = SBE_SEEPROM1;
-             }
--            else if ( io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM1)
-+            else if ( io_sbeState.cur_seeprom_side == SBE_SEEPROM1)
-             {
--                io_sbeState.alt_seeprom_side = PNOR::SBE_SEEPROM0;
-+                io_sbeState.alt_seeprom_side = SBE_SEEPROM0;
-             }
-             else
-             {
-@@ -2012,7 +2055,7 @@ namespace SBE
-             /*  Determine what side to update                             */
-             /**************************************************************/
-             // Set cur and alt isDirty values
--            if( io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM0 )
-+            if( io_sbeState.cur_seeprom_side == SBE_SEEPROM0 )
-             {
-                 current_side_isDirty = seeprom_0_isDirty;
-                 alt_side_isDirty     = seeprom_1_isDirty;
-@@ -2179,14 +2222,14 @@ namespace SBE
-                     io_sbeState.seeprom_side_to_update = EEPROM::SBE_PRIMARY;
- 
-                     // Update MVPD PERMANENT flag: make cur=perm
--                    ( io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM0 ) ?
-+                    ( io_sbeState.cur_seeprom_side == SBE_SEEPROM0 ) ?
-                          // clear bit 0
-                          io_sbeState.mvpdSbKeyword.flags &= ~PERMANENT_FLAG_MASK
-                          : //set bit 0
-                          io_sbeState.mvpdSbKeyword.flags |= PERMANENT_FLAG_MASK;
- 
-                     // Update MVPD RE-IPL SEEPROM flag: re-IPL on ALT:
--                    ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ?
-+                    ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) ?
-                          // clear bit 1
-                          io_sbeState.mvpdSbKeyword.flags &= ~REIPL_SEEPROM_MASK
-                          : //set bit 1
-@@ -2252,18 +2295,18 @@ namespace SBE
- 
-                     // Set Update side to alt
-                     io_sbeState.seeprom_side_to_update =
--                                ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 )
-+                                ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 )
-                                   ? EEPROM::SBE_PRIMARY : EEPROM::SBE_BACKUP ;
- 
-                     // Update MVPD PERMANENT flag: make cur=perm
--                    ( io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM0 ) ?
-+                    ( io_sbeState.cur_seeprom_side == SBE_SEEPROM0 ) ?
-                          // clear bit 0
-                          io_sbeState.mvpdSbKeyword.flags &= ~PERMANENT_FLAG_MASK
-                          : //set bit 0
-                          io_sbeState.mvpdSbKeyword.flags |= PERMANENT_FLAG_MASK;
- 
-                     // Update MVPD RE-IPL SEEPROM flag: re-IPL on ALT:
--                    ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ?
-+                    ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) ?
-                          // clear bit 1
-                          io_sbeState.mvpdSbKeyword.flags &= ~REIPL_SEEPROM_MASK
-                          : //set bit 1
-@@ -2298,13 +2341,13 @@ namespace SBE
- 
-                     // Set Update side to alt
-                     io_sbeState.seeprom_side_to_update =
--                                ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 )
-+                                ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 )
-                                   ? EEPROM::SBE_PRIMARY : EEPROM::SBE_BACKUP ;
- 
- 
-                     // MVPD flag Update
-                     // Update MVPD flag make cur=perm
--                    ( io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM0 ) ?
-+                    ( io_sbeState.cur_seeprom_side == SBE_SEEPROM0 ) ?
-                          // clear bit 0
-                          io_sbeState.mvpdSbKeyword.flags &= ~PERMANENT_FLAG_MASK
-                          : // set bit 0
-@@ -2358,11 +2401,11 @@ namespace SBE
- 
-                     // Set Update side to alt
-                     io_sbeState.seeprom_side_to_update =
--                                ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 )
-+                                ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 )
-                                   ? EEPROM::SBE_PRIMARY : EEPROM::SBE_BACKUP ;
- 
-                     // Update MVPD RE-IPL SEEPROM flag: re-IPL on ALT:
--                    ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ?
-+                    ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) ?
-                          // clear bit 1
-                          io_sbeState.mvpdSbKeyword.flags &= ~REIPL_SEEPROM_MASK
-                          : // set bit 1
-@@ -2373,7 +2416,7 @@ namespace SBE
-                     if ( g_istep_mode )
-                     {
-                         // Update MVPD PERMANENT flag: make alt=perm
--                        (io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ?
-+                        (io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) ?
-                          // clear bit 0
-                          io_sbeState.mvpdSbKeyword.flags &= ~PERMANENT_FLAG_MASK
-                          : //set bit 0
-@@ -2455,11 +2498,11 @@ namespace SBE
- 
-                         // Set Update side to alt
-                         io_sbeState.seeprom_side_to_update =
--                                ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 )
-+                                ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 )
-                                   ? EEPROM::SBE_PRIMARY : EEPROM::SBE_BACKUP ;
- 
-                         // Update MVPD RE-IPL SEEPROM flag: re-IPL on ALT:
--                        ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ?
-+                        ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) ?
-                           // clear bit 1
-                           io_sbeState.mvpdSbKeyword.flags &= ~REIPL_SEEPROM_MASK
-                           : // set bit 1
-@@ -2491,7 +2534,7 @@ namespace SBE
- 
-                     // Set Update side to alt
-                     io_sbeState.seeprom_side_to_update =
--                                ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 )
-+                                ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 )
-                                   ? EEPROM::SBE_PRIMARY : EEPROM::SBE_BACKUP ;
- 
-                     TRACFCOMP( g_trac_sbe, INFO_MRK"SBE Update tgt=0x%X: "
-@@ -3201,12 +3244,12 @@ namespace SBE
- 
-                     // Compare against 'current' Master side in case there is
-                     // an issue with the other side
--                    if (io_sbeStates_v[i].cur_seeprom_side == PNOR::SBE_SEEPROM0)
-+                    if (io_sbeStates_v[i].cur_seeprom_side == SBE_SEEPROM0)
-                     {
-                         ver_ptr =
-                             &(io_sbeStates_v[i].seeprom_0_ver.image_version);
-                     }
--                    else // PNOR::SBE_SEEPROM1
-+                    else // SBE_SEEPROM1
-                     {
-                         ver_ptr =
-                             &(io_sbeStates_v[i].seeprom_1_ver.image_version);
-@@ -3346,12 +3389,12 @@ namespace SBE
-                 else
-                 {
-                     // Not Master, so get 'current' version
--                    if (io_sbeStates_v[i].cur_seeprom_side == PNOR::SBE_SEEPROM0)
-+                    if (io_sbeStates_v[i].cur_seeprom_side == SBE_SEEPROM0)
-                     {
-                         ver_ptr =
-                             &(io_sbeStates_v[i].seeprom_0_ver.image_version);
-                     }
--                    else // PNOR::SBE_SEEPROM1
-+                    else // SBE_SEEPROM1
-                     {
-                         ver_ptr =
-                             &(io_sbeStates_v[i].seeprom_1_ver.image_version);
-diff --git a/src/usr/sbe/sbe_update.H b/src/usr/sbe/sbe_update.H
-index e49c582..aa880b2 100644
---- a/src/usr/sbe/sbe_update.H
-+++ b/src/usr/sbe/sbe_update.H
-@@ -5,9 +5,7 @@
- /*                                                                        */
- /* OpenPOWER HostBoot Project                                             */
- /*                                                                        */
--/* Contributors Listed Below - COPYRIGHT 2013,2015                        */
--/* [+] International Business Machines Corp.                              */
--/*                                                                        */
-+/* COPYRIGHT International Business Machines Corp. 2013,2014              */
- /*                                                                        */
- /* Licensed under the Apache License, Version 2.0 (the "License");        */
- /* you may not use this file except in compliance with the License.       */
-@@ -55,6 +53,10 @@ namespace SBE
-     const uint64_t SBE_IMAGE_SEEPROM_ADDRESS    = 0x400; // 1KB
-     const uint64_t SBE_VERSION_SEEPROM_ADDRESS  = 0x300; // 1KB - 256B
- 
-+    //Used to read SBE Boot Side from processor
-+    const uint64_t SBE_VITAL_REG_0x0005001C = 0x005001C;
-+    const uint64_t SBE_BOOT_SELECT_MASK = 0x0080000000000000;
-+
-     // PNOR SBE and SBEC Partition constants
-     const uint32_t MAX_SBE_ENTRIES = 9;
-     const uint32_t SBETOC_EYECATCH = 0x53424500;  //'SBE\0'
-@@ -104,6 +106,14 @@ namespace SBE
-         MVPDOP_WRITE,     // Write version data to MVPD
-     };
- 
-+    // Used to keep track of perm/temp, and cur/alt
-+    enum sbeSeepromSide_t
-+    {
-+        SBE_SEEPROM0         = 0x00,   // corresponds to EEPROM::SBE_PRIMARY
-+        SBE_SEEPROM1         = 0x01,   // corresponts to EEPROM::SBE_BACKUP
-+        SBE_SEEPROM_INVALID  = 0xFF,
-+    };
-+
-     // Actions can be combined
-     enum sbeUpdateActions_t
-     {
-@@ -117,6 +127,7 @@ namespace SBE
-         UNSUPPORTED_SITUATION  = 0x80000000,
-     };
- 
-+
-     /******************************************/
-     /*  Structs                               */
-     /******************************************/
-@@ -196,9 +207,9 @@ namespace SBE
-         bool                     seeprom_0_ver_ECC_fail;
-         bool                     seeprom_1_ver_ECC_fail;
- 
--        PNOR::sbeSeepromSide_t         cur_seeprom_side; // aka 'booted' side
--        PNOR::sbeSeepromSide_t         alt_seeprom_side;
--        PNOR::sbeSeepromSide_t         permanent_seeprom_side;
-+        sbeSeepromSide_t         cur_seeprom_side; // aka 'booted' side
-+        sbeSeepromSide_t         alt_seeprom_side;
-+        sbeSeepromSide_t         permanent_seeprom_side;
- 
-         // Customized Image Information for this Target
-         size_t                   customizedImage_size;
-@@ -318,6 +329,21 @@ namespace SBE
-                                    void* io_imgPtr,
-                                    size_t& o_actImgSize);
- 
-+
-+    /**
-+     * @brief Determines which Seeprom was used to boot the SBE
-+     *
-+     * @param[in] i_target      Target processor to customize
-+     *
-+     * @param[out] o_bootSide   The Seeprom the SBE booted from
-+     *
-+     * @return errlHndl_t    Error log handle on failure.
-+     */
-+
-+    errlHndl_t getSbeBootSeeprom(TARGETING::Target* i_target,
-+                                 sbeSeepromSide_t& o_bootSide);
-+
-+
-     /**
-      * @brief Collects Version information from a specific SEEPROM
-      *
-diff --git a/src/usr/sbe/test/sbeupdatetest.H b/src/usr/sbe/test/sbeupdatetest.H
-index 5e25706..d235141 100644
---- a/src/usr/sbe/test/sbeupdatetest.H
-+++ b/src/usr/sbe/test/sbeupdatetest.H
-@@ -580,7 +580,7 @@ class SBEUpdateTest: public CxxTest::TestSuite
-         {
-             // Inputs
-             uint8_t                      i_situation;
--            PNOR::sbeSeepromSide_t       i_cur;     // current_seeprom_side
-+            sbeSeepromSide_t             i_cur;     // current_seeprom_side
-             uint8_t                      i_flags;   // mvpdSbKeyword.flags
- 
-             // Expected Output
-@@ -596,7 +596,7 @@ class SBEUpdateTest: public CxxTest::TestSuite
-             // - update alt=1
-             // - make cur=perm
-             // - re-IPL
--            { 0xE0, PNOR::SBE_SEEPROM0, 0x80,
-+            { 0xE0, SBE_SEEPROM0, 0x80,
-               static_cast<sbeUpdateActions_t>
-                      (DO_UPDATE|IPL_RESTART|UPDATE_MVPD|UPDATE_SBE),
-               EEPROM::SBE_BACKUP, 0x40 },
-@@ -606,7 +606,7 @@ class SBEUpdateTest: public CxxTest::TestSuite
-             // - update alt=0
-             // - make cur=perm
-             // - re-IPL
--            { 0xC0, PNOR::SBE_SEEPROM1, 0x00,
-+            { 0xC0, SBE_SEEPROM1, 0x00,
-               static_cast<sbeUpdateActions_t>
-                      (DO_UPDATE|IPL_RESTART|UPDATE_MVPD|UPDATE_SBE),
-               EEPROM::SBE_PRIMARY, 0x80 },
-@@ -616,7 +616,7 @@ class SBEUpdateTest: public CxxTest::TestSuite
-             // - update alt=0
-             // - make cur=perm
-             // - Continue IPL
--            { 0xA0, PNOR::SBE_SEEPROM1, 0x00,
-+            { 0xA0, SBE_SEEPROM1, 0x00,
-               static_cast<sbeUpdateActions_t>
-                      (DO_UPDATE|UPDATE_MVPD|UPDATE_SBE),
-               EEPROM::SBE_PRIMARY, 0x80 },
-@@ -625,7 +625,7 @@ class SBEUpdateTest: public CxxTest::TestSuite
-             // Arbitrarily set cur side to 1 (therefore perm set to 0)
-             // - No updates
-             // - Continue IPL
--            { 0x80, PNOR::SBE_SEEPROM1, 0x00,
-+            { 0x80, SBE_SEEPROM1, 0x00,
-               static_cast<sbeUpdateActions_t>(CLEAR_ACTIONS),
-               EEPROM::LAST_CHIP_TYPE, 0x00 },
- 
-@@ -633,7 +633,7 @@ class SBEUpdateTest: public CxxTest::TestSuite
-             // Arbitrarily set cur side to 0 (therefore perm set to 0)
-             // - update alt=1
-             // - re-IPL
--            { 0x60, PNOR::SBE_SEEPROM0, 0x00,
-+            { 0x60, SBE_SEEPROM0, 0x00,
-               static_cast<sbeUpdateActions_t>
-                      (DO_UPDATE|IPL_RESTART|UPDATE_MVPD|UPDATE_SBE),
-               EEPROM::SBE_BACKUP, 0x40 },
-@@ -644,14 +644,14 @@ class SBEUpdateTest: public CxxTest::TestSuite
-             // Arbitrarily set cur side to 1 (therefore perm set to 1)
-             // - update alt=0
-             // - re-IPL
--            { 0x40, PNOR::SBE_SEEPROM1, 0x80,
-+            { 0x40, SBE_SEEPROM1, 0x80,
-               static_cast<sbeUpdateActions_t>
-                      (DO_UPDATE|IPL_RESTART|UPDATE_MVPD|UPDATE_SBE),
-               EEPROM::SBE_PRIMARY, 0x80 },
- 
-             // Repeat previous case to make sure global variables are used
-             // correctly to save MBOX value
--            { 0x40, PNOR::SBE_SEEPROM1, 0x80,
-+            { 0x40, SBE_SEEPROM1, 0x80,
-               static_cast<sbeUpdateActions_t>
-                      (DO_UPDATE|IPL_RESTART|UPDATE_MVPD|UPDATE_SBE),
-               EEPROM::SBE_PRIMARY, 0x80 },
-@@ -660,7 +660,7 @@ class SBEUpdateTest: public CxxTest::TestSuite
-             // Arbitrarily set cur side to 0 (therefore perm set to 0)
-             // - update alt=1
-             // - Continue IPL
--            { 0x20, PNOR::SBE_SEEPROM0, 0x00,
-+            { 0x20, SBE_SEEPROM0, 0x00,
-               static_cast<sbeUpdateActions_t>(DO_UPDATE|UPDATE_SBE),
-               EEPROM::SBE_BACKUP, 0x00 },
- 
-@@ -670,7 +670,7 @@ class SBEUpdateTest: public CxxTest::TestSuite
-             // - Continue IPL
-             // NOTE: this will test that right-most-bit is ignored:
-             //  so techincally case 0x01, which should be = case 0x00
--            { 0x01, PNOR::SBE_SEEPROM0, 0x00,
-+            { 0x01, SBE_SEEPROM0, 0x00,
-               static_cast<sbeUpdateActions_t>(CLEAR_ACTIONS),
-               EEPROM::LAST_CHIP_TYPE, 0x00 },
- #endif // SBE_UPDATE_SEQUENTIAL
-@@ -708,8 +708,8 @@ class SBEUpdateTest: public CxxTest::TestSuite
-                 sbeState.cur_seeprom_side = testData[i].i_cur;
- 
-                 sbeState.alt_seeprom_side =
--                             ( ( testData[i].i_cur == PNOR::SBE_SEEPROM0 )
--                               ? PNOR::SBE_SEEPROM1 : PNOR::SBE_SEEPROM0 );
-+                             ( ( testData[i].i_cur == SBE_SEEPROM0 )
-+                               ? SBE_SEEPROM1 : SBE_SEEPROM0 );
- 
-                 sbeState.mvpdSbKeyword.flags = testData[i].i_flags;
- 
--- 
-1.8.2.2
-
diff --git a/openpower/package/hostboot/hostboot-0004-Serverwiz2-scripts.patch b/openpower/package/hostboot/hostboot-0004-Serverwiz2-scripts.patch
deleted file mode 100644
index 6eecc7b..0000000
--- a/openpower/package/hostboot/hostboot-0004-Serverwiz2-scripts.patch
+++ /dev/null
@@ -1,2634 +0,0 @@
-From 065fd1bc3d9fcc8b06be7564f8df162580f8775e Mon Sep 17 00:00:00 2001
-From: Matt Ploetz <maploetz@us.ibm.com>
-Date: Fri, 13 Feb 2015 10:41:12 -0600
-Subject: [PATCH] New severwiz2 scripts up to support up to commit
- 44fde6512e834ea8f5071299ca99b35973c0f979
-
-Change-Id: I3df49506aad9490f5f6e1840fa5e6afe3150492d
----
- src/build/mkrules/dist.targets.mk      |    3 +-
- src/usr/targeting/common/Targets.pm    | 1446 ++++++++++++++++++++++++++++++++
- src/usr/targeting/common/processMrw.pl | 1144 +++++++++++++++++++++++++
- 3 files changed, 2592 insertions(+), 1 deletion(-)
- create mode 100755 src/usr/targeting/common/Targets.pm
- create mode 100755 src/usr/targeting/common/processMrw.pl
-
-diff --git a/src/build/mkrules/dist.targets.mk b/src/build/mkrules/dist.targets.mk
-index ca28150..4b541ce 100644
---- a/src/build/mkrules/dist.targets.mk
-+++ b/src/build/mkrules/dist.targets.mk
-@@ -74,7 +74,8 @@ COPY_FILES = \
-     src/usr/hwpf/hwp/initfiles/sample.initfile:tools \
-     src/build/buildpnor/buildSbePart.pl:openpower \
-     src/build/buildpnor/buildpnor.pl:openpower \
--    src/usr/targeting/common/genHwsvMrwXml.pl:openpower \
-+    src/usr/targeting/common/processMrw.pl:openpower \
-+    src/usr/targeting/common/Targets.pm:openpower \
-     src/usr/targeting/common/xmltohb/mergexml.sh:openpower \
-     src/usr/targeting/common/xmltohb/attribute_types.xml:openpower \
-     src/usr/targeting/common/xmltohb/attribute_types_hb.xml:openpower \
-diff --git a/src/usr/targeting/common/Targets.pm b/src/usr/targeting/common/Targets.pm
-new file mode 100755
-index 0000000..53568cf
---- /dev/null
-+++ b/src/usr/targeting/common/Targets.pm
-@@ -0,0 +1,1446 @@
-+# IBM_PROLOG_BEGIN_TAG
-+# This is an automatically generated prolog.
-+#
-+# $Source: src/usr/targeting/common/Targets.pm $
-+#
-+# OpenPOWER HostBoot Project
-+#
-+# Contributors Listed Below - COPYRIGHT 2015
-+# [+] International Business Machines Corp.
-+#
-+#
-+# Licensed under the Apache License, Version 2.0 (the "License");
-+# you may not use this file except in compliance with the License.
-+# You may obtain a copy of the License at
-+#
-+#     http://www.apache.org/licenses/LICENSE-2.0
-+#
-+# Unless required by applicable law or agreed to in writing, software
-+# distributed under the License is distributed on an "AS IS" BASIS,
-+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-+# implied. See the License for the specific language governing
-+# permissions and limitations under the License.
-+#
-+# IBM_PROLOG_END_TAG
-+package Targets;
-+
-+use strict;
-+use XML::Simple;
-+use Data::Dumper;
-+
-+sub new
-+{
-+    my $class = shift;
-+    my $self  = {
-+        xml          => undef,
-+        data         => undef,
-+        targeting    => undef,
-+        enumerations => undef,
-+        MAX_MCS      => 0,
-+        master_proc  => undef,
-+        huid_idx     => undef,
-+        mru_idx      => undef,
-+        force        => 0,
-+        debug        => 0,
-+        version      => "",
-+        errorsExist  => 0,
-+        NUM_PROCS    => 0,
-+        TOP_LEVEL    => "sys-0",
-+        TOPOLOGY     => undef,
-+        DMI_FSI_MAP  => {
-+            '0' => '3',
-+            '1' => '2',
-+            '4' => '7',
-+            '5' => '6'
-+        }
-+        # TODO RTC: TBD
-+        # DMI_FSI_MAP is a lookup table for DMI channel to FSI and ref clock.
-+        # It is processor specific and needs to be pulled from a
-+        # processor attribute instead of being hardcoded
-+
-+    };
-+    return bless $self, $class;
-+}
-+
-+sub setVersion
-+{
-+    my $self    = shift;
-+    my $version = shift;
-+
-+    $self->{version} = $version;
-+}
-+
-+sub getData
-+{
-+    my $self = shift;
-+    return $self->{data};
-+}
-+
-+## loads ServerWiz XML format
-+sub loadXML
-+{
-+    my $self = shift;
-+    my $filename = shift;
-+    $XML::Simple::PREFERRED_PARSER = 'XML::Parser';
-+    print "Loading MRW XML: $filename\n";
-+    $self->{xml} =
-+      XMLin($filename,forcearray => [ 'child_id', 'hidden_child_id', 'bus',
-+                                      'property' ]);
-+    $self->storeEnumerations();
-+    $self->buildHierarchy($self->{TOP_LEVEL});
-+    $self->buildAffinity();
-+}
-+
-+################################################
-+## prints out final XML for HOSTBOOT consumption
-+
-+sub printXML
-+{
-+    my $self = shift;
-+    my $fh   = shift;
-+    my $t    = shift;
-+
-+    my $atTop = 0;
-+    if ($t eq "top")
-+    {
-+        $atTop = 1;
-+        $t     = $self->{targeting}->{SYS};
-+        print $fh "<attributes>\n";
-+        print $fh "<version>" . $self->{version} . "</version>\n";
-+    }
-+    if (ref($t) ne "ARRAY")
-+    {
-+        return;
-+    }
-+    for (my $p = 0; $p < scalar(@{$t}); $p++)
-+    {
-+        if (ref($t->[$p]) ne "HASH") { next; }
-+        my $target = $t->[$p]->{KEY};
-+        $self->printTarget($fh, $target);
-+        my $children = $t->[$p];
-+        foreach my $u (sort(keys %{$children}))
-+        {
-+            if ($u ne "KEY")
-+            {
-+                $self->printXML($fh, $t->[$p]->{$u});
-+            }
-+        }
-+    }
-+    if ($atTop)
-+    {
-+        print $fh "</attributes>\n";
-+    }
-+}
-+
-+sub printTarget
-+{
-+    my $self   = shift;
-+    my $fh     = shift;
-+    my $target = shift;
-+
-+    my $target_ptr = $self->getTarget($target);
-+    print $fh "<targetInstance>\n";
-+    my $target_id = $self->getAttribute($target, "PHYS_PATH");
-+    $target_id = substr($target_id, 9);
-+    $target_id =~ s/\///g;
-+    $target_id =~ s/\-//g;
-+    print $fh "\t<id>" . $target_id . "</id>\n";
-+    print $fh "\t<type>" . $self->getTargetType($target) . "</type>\n";
-+
-+    ## get attributes
-+    foreach my $attr (sort (keys %{ $target_ptr->{ATTRIBUTES} }))
-+    {
-+        $self->printAttribute($fh, $target_ptr->{ATTRIBUTES}, $attr);
-+    }
-+    print $fh "</targetInstance>\n";
-+}
-+
-+sub printAttribute
-+{
-+    my $self       = shift;
-+    my $fh         = shift;
-+    my $target_ptr = shift;
-+    my $attribute  = shift;
-+    my $r          = "";
-+
-+    # TODO RTC: TBD
-+    # temporary until we converge attribute types
-+    my %filter;
-+    $filter{MRW_TYPE}                       = 1;
-+    $filter{INSTANCE_PATH}                  = 1;
-+    $filter{SYSTEM_NAME}                    = 1;
-+    $filter{BUS_TYPE}                       = 1;
-+    $filter{DIRECTION}                      = 1;
-+    $filter{ENABLE_CAPI}                    = 1;
-+    $filter{PCIE_CONFIG_NUM}                = 1;
-+    $filter{PCIE_LANE_MASK}                 = 1;
-+    $filter{PCIE_LANE_SET}                  = 1;
-+    $filter{PCIE_NUM_LANES}                 = 1;
-+    $filter{PHB_NUM}                        = 1;
-+    $filter{IOP_NUM}                        = 1;
-+    $filter{LOCATION_CODE}                  = 1;
-+    $filter{MCS_NUM}                        = 1;
-+    $filter{SCHEMATIC_INTERFACE}            = 1;
-+    $filter{ENTITY_ID}                      = 1;
-+    $filter{CLASS}                          = 1;
-+    $filter{MODEL}                          = 1;
-+    $filter{TYPE}                           = 1;
-+    $filter{CDM_POLICIES}                   = 1;
-+    $filter{ALL_MCS_IN_INTERLEAVING_GROUP}  = 1;
-+    $filter{MSS_INTERLEAVE_ENABLE}          = 1;
-+    $filter{CDM_POLICIES_BITMASK}           = 1;
-+    $filter{ENTITY_ID_LOOKUP}               = 1;
-+    $filter{ENTITY_INSTANCE}                = 1;
-+    $filter{MBA_NUM}                        = 1;
-+    $filter{IPMI_INSTANCE}                  = 1;
-+    $filter{INSTANCE_ID}                    = 1;
-+    $filter{ADC_CHANNEL_SENSOR_NUMBERS}     = 1;
-+
-+    if ($filter{$attribute} == 1)
-+    {
-+        return;
-+    }
-+    print $fh "\t<attribute>\n";
-+    print $fh "\t\t<id>$attribute</id>\n";
-+    my $value = $target_ptr->{$attribute}->{default};
-+
-+    if (ref($value) eq "HASH")
-+    {
-+        if (defined($value->{field}))
-+        {
-+            print $fh "\t\t<default>\n";
-+            foreach my $f (sort keys %{ $value->{field} })
-+            {
-+                my $v = $value->{field}->{$f}->{value};
-+                print $fh "\t\t\t<field><id>$f</id><value>$v</value></field>\n";
-+            }
-+            print $fh "\t\t</default>\n";
-+        }
-+    }
-+    else
-+    {
-+        print $fh "\t\t<default>$value</default>\n";
-+    }
-+    print $fh "\t</attribute>\n";
-+}
-+
-+## stores TYPE enumeration values which is used to generate HUIDs
-+sub storeEnumerations
-+{
-+    my $self = shift;
-+
-+    foreach my $enumType (keys(%{ $self->{xml}->{enumerationType} }))
-+    {
-+        foreach my $enum (
-+            keys(%{$self->{xml}->{enumerationType}->{$enumType}->{enumerator}}))
-+        {
-+            $self->{enumeration}->{$enumType}->{$enum} =
-+              $self->{xml}->{enumerationType}->{$enumType}->{enumerator}
-+              ->{$enum}->{value};
-+        }
-+    }
-+}
-+
-+####################################################
-+## build target hierarchy recursively
-+##
-+## creates convenient data structure
-+## for accessing targets and busses
-+## Structure:
-+##
-+##{TARGETS}                                         # location of all targets
-+##{NSTANCE_PATH}                                    # keeps track of hierarchy
-+##                                                   path while iterating
-+##{TARGETS} -> target_name                          # specific target
-+##{TARGETS} -> target_name -> {TARGET}              # pointer to target data
-+##                                                   from XML data struture
-+##{TARGETS} -> target_name -> {TYPE}# special attribute
-+##{TARGETS} -> target_name -> {PARENT}              # parent target name
-+##{TARGETS} -> target_name -> {CHILDREN}            # array of children targets
-+##{TARGETS} -> target_name -> {CONNECTION} -> {DEST} # array of connection
-+##                                                     destination targets
-+##{TARGETS} -> target_name -> {CONNECTION} -> {BUS} # array of busses
-+##{TARGETS} -> target_name -> {CHILDREN}            # array of children targets
-+##{TARGETS} -> target_name -> {ATTRIBUTES}          # attributes
-+## {ENUMERATION} -> enumeration_type -> enum        # value of enumeration
-+## {BUSSES} -> bus_type[]                           # array of busses by
-+##                                                   bus_type (I2C, FSI, etc)
-+## {BUSSES} -> bus_type[] -> {BUS}                  # pointer to bus target
-+##                                                   from xml structure
-+## {BUSSES} -> bus_type[] -> {SOURCE_TARGET}        # source target name
-+## {BUSSES} -> bus_type[] -> {DEST_TARGET}          # dest target name
-+
-+sub buildHierarchy
-+{
-+    my $self   = shift;
-+    my $target = shift;
-+
-+    my $old_path        = $self->{data}->{INSTANCE_PATH};
-+    my $target_xml      = $self->{xml}->{'targetInstance'}{$target};
-+    my $affinity_target = $target;
-+    my $key             = $self->{data}->{INSTANCE_PATH} . "/" . $target;
-+
-+    my $instance_path = $self->{data}->{INSTANCE_PATH};
-+    $instance_path = "instance:" . substr($instance_path, 1);
-+    $self->setAttribute($key, "INSTANCE_PATH", $instance_path);
-+    $self->{data}->{TARGETS}->{$key}->{TARGET} = $target_xml;
-+    $self->{data}->{INSTANCE_PATH} = $old_path . "/" . $target;
-+
-+    ## copy attributes
-+    
-+    foreach my $attribute (keys %{ $target_xml->{attribute} })
-+    {
-+        my $value = $target_xml->{attribute}->{$attribute}->{default};
-+        if (ref($value) eq "HASH")
-+        {
-+            if (defined($value->{field}))
-+            {
-+                foreach my $f (keys %{ $value->{field} })
-+                {
-+                    my $field_val=$value->{field}{$f}{value};
-+                    if (ref($field_val)) {
-+                        $self->setAttributeField($key, $attribute, $f,"");
-+                    }
-+                    else
-+                    {
-+                        $self->setAttributeField($key, $attribute, $f,
-+                            $value->{field}{$f}{value});
-+                    }
-+                }
-+            }
-+            else
-+            {
-+                $self->setAttribute($key, $attribute, "");
-+            }
-+        }
-+        else
-+        {
-+            $self->setAttribute($key, $attribute, $value);
-+        }
-+    }
-+    ## global attributes overwrite local   
-+    foreach my $prop (keys %{$self->{xml}->{globalSetting}->{$key}->{property}})
-+    {
-+        my $val=$self->{xml}->{globalSetting}->{$key}->{property}->
-+                       {$prop}->{value};
-+        $self->setAttribute($key, $prop, $val);
-+    }
-+
-+    ## Save busses
-+    if (defined($target_xml->{bus}))
-+    {
-+        foreach my $b (@{ $target_xml->{bus} })
-+        {
-+            my $source_target =
-+              $key . "/" . $b->{source_path} . $b->{source_target};
-+            my $dest_target = $key . "/" . $b->{dest_path} . $b->{dest_target};
-+            my $bus_type    = $b->{bus_type};
-+            push(
-+                @{
-+                    $self->{data}->{TARGETS}->{$source_target}->{CONNECTION}
-+                      ->{DEST}
-+                  },
-+                $dest_target
-+            );
-+            push(
-+                @{
-+                    $self->{data}->{TARGETS}->{$source_target}->{CONNECTION}
-+                      ->{BUS}
-+                  },
-+                $b
-+            );
-+            my %bus_entry;
-+            $bus_entry{SOURCE_TARGET} = $source_target;
-+            $bus_entry{DEST_TARGET}   = $dest_target;
-+            $bus_entry{BUS_TARGET}    = $b;
-+            push(@{ $self->{data}->{BUSSES}->{$bus_type} }, \%bus_entry);
-+        }
-+    }
-+
-+    foreach my $child (@{ $target_xml->{child_id} })
-+    {
-+        my $child_key = $self->{data}->{INSTANCE_PATH} . "/" . $child;
-+        $self->{data}->{TARGETS}->{$child_key}->{PARENT} = $key;
-+        push(@{ $self->{data}->{TARGETS}->{$key}->{CHILDREN} }, $child_key);
-+        $self->buildHierarchy($child);
-+    }
-+    foreach my $child (@{ $target_xml->{hidden_child_id} })
-+    {
-+        my $child_key = $self->{data}->{INSTANCE_PATH} . "/" . $child;
-+        $self->{data}->{TARGETS}->{$child_key}->{PARENT} = $key;
-+        push(@{ $self->{data}->{TARGETS}->{$key}->{CHILDREN} }, $child_key);
-+        $self->buildHierarchy($child);
-+    }
-+    $self->{data}->{INSTANCE_PATH} = $old_path;
-+
-+}
-+
-+##########################################################
-+## traces busses and builds affinity hierarchy
-+## HOSTBOOT expected hierarchy: sys/node/proc/<unit>
-+##                              sys/node/proc/mcs/membuf/<unit>
-+##                              sys/node/proc/mcs/membuf/mba/dimm
-+
-+sub buildAffinity
-+{
-+    my $self = shift;
-+    my $node      = -1;
-+    my $proc      = -1;
-+    my $node_phys = "";
-+    my $node_aff  = "";
-+    my $core_num = 0;
-+    $self->{membuf_inst_num}=0;
-+    foreach my $target (sort keys %{ $self->{data}->{TARGETS} })
-+    {
-+        my $target_ptr = $self->{data}->{TARGETS}{$target};
-+        my $type       = $self->getType($target);
-+        my $type_id    = $self->getEnumValue("TYPE", $type);
-+        if ($type_id eq "") { $type_id = 0; }
-+
-+        if ($type eq "SYS")
-+        {
-+            $proc = -1;
-+            $node = -1;
-+            
-+            $self->{targeting}{SYS}[0]{KEY} = $target;
-+            $self->setAttribute($target, "AFFINITY_PATH", "affinity:sys-0");
-+            $self->setAttribute($target, "PHYS_PATH",     "physical:sys-0");
-+            $self->setAttribute($target, "ENTITY_INSTANCE","0");
-+        }
-+        elsif ($type eq "NODE")
-+        {
-+            $core_num = 0;
-+            $proc = -1;
-+            $self->{dimm_tpos} = 0;
-+            $self->{membuf_inst_num}=0;
-+            $node++;
-+            $node_phys = "physical:sys-0/node-$node";
-+            $node_aff  = "affinity:sys-0/node-$node";
-+            $self->{targeting}{SYS}[0]{NODES}[$node]{KEY} = $target;
-+            $self->setAttribute($target, "AFFINITY_PATH",
-+                "affinity:sys-0/node-$node");
-+            $self->setAttribute($target, "PHYS_PATH",
-+                "physical:sys-0/node-$node");
-+            $self->setHuid($target, 0, $node);
-+            $self->setAttribute($target, "ENTITY_INSTANCE",$node);
-+        }
-+        elsif ($type eq "PROC")
-+        {
-+            $proc++;
-+            my $num_mcs = 0;
-+            ### count number of MCSs
-+            foreach my $unit (@{ $self->{data}->{TARGETS}{$target}{CHILDREN} })
-+            {
-+                my $unit_type = $self->getType($unit);
-+                if ($unit_type eq "MCS")
-+                {
-+                    $num_mcs++;
-+                }
-+            }
-+            if ($num_mcs > $self->{MAX_MCS})
-+            {
-+                $self->{MAX_MCS} = $num_mcs;
-+            }
-+            $self->{NUM_PROCS_PER_NODE} = $proc + 1;
-+            $self->{targeting}->{SYS}[0]{NODES}[$node]{PROCS}[$proc]{KEY} =
-+              $target;
-+            
-+            $self->setHuid($target, 0, $node);
-+            my $socket = $self->getTargetParent(
-+                         $self->getTargetParent($target));
-+            my $parent_affinity = "affinity:sys-0/node-$node/proc-$proc";
-+            my $parent_physical = "physical:sys-0/node-$node/proc-$proc";
-+            $self->setAttribute($target, "AFFINITY_PATH",  $parent_affinity);
-+            $self->setAttribute($target, "PHYS_PATH",      $parent_physical);
-+            $self->setAttribute($target, "POSITION",       $proc);
-+            $self->setAttribute($target, "ENTITY_INSTANCE",$proc);
-+            $self->setAttribute($target, "FABRIC_NODE_ID",
-+                  $self->getAttribute($socket,"FABRIC_NODE_ID"));
-+             $self->setAttribute($target, "FABRIC_CHIP_ID",
-+                  $self->getAttribute($socket,"FABRIC_CHIP_ID"));
-+
-+            $self->setAttribute($target, "VPD_REC_NUM",    $proc);
-+
-+
-+            foreach my $unit (@{ $self->{data}->{TARGETS}{$target}{CHILDREN} })
-+            {
-+                my $unit_ptr     = $self->getTarget($unit);
-+                my $unit_type    = $self->getType($unit);
-+                my $unit_type_id = $self->getEnumValue("TYPE", $unit_type);
-+                if (   $unit_type_id eq "" || $unit_type eq "FSI"
-+                    || $unit_type eq "MCS")
-+                {
-+                    $unit_type_id = 0;
-+                }
-+
-+                ## don't want non-hostboot targets
-+                if ($unit_type_id > 0)
-+                {
-+                    
-+                    push(@{$self->{targeting}
-+                            ->{SYS}[0]{NODES}[$node]{PROCS}[$proc]{$unit_type}},
-+                            { 'KEY' => $unit });
-+                    my $affinity_path =
-+                        $parent_affinity . "/"
-+                      . $self->getTarget($unit)->{TARGET}->{instance_name};
-+                    my $physical_path =
-+                        $parent_physical . "/"
-+                      . $self->getTarget($unit)->{TARGET}->{instance_name};
-+                    $self->setAttribute($unit, "AFFINITY_PATH",$affinity_path);
-+                    $self->setAttribute($unit, "PHYS_PATH", $physical_path);
-+                    $self->setHuid($unit, 0, $node);
-+                    if ($unit_type eq "OCC")
-+                    {
-+                        $self->setAttribute($unit, "ENTITY_INSTANCE",$proc);                        
-+                    }
-+                    ## export core
-+                    if ($unit_type eq "EX")
-+                    {
-+                        my $core_unit_num = $self->getAttribute($unit,
-+                            "CHIP_UNIT");
-+
-+                        my $core_unit =
-+                          $self->{data}->{TARGETS}{$unit}{CHILDREN}[0];
-+                        push(
-+                            @{
-+                                $self->{targeting}
-+                                  ->{SYS}[0]{NODES}[$node]{PROCS}[$proc]{CORE}
-+                              },
-+                            { 'KEY' => $core_unit }
-+                        );
-+                        my $core_affinity_path =
-+                            $affinity_path . "/"
-+                          . $self->getTarget($core_unit)->{TARGET}
-+                          ->{instance_name};
-+                        my $core_physical_path =
-+                            $physical_path . "/"
-+                          . $self->getTarget($core_unit)->{TARGET}
-+                          ->{instance_name};
-+                        $self->setAttribute($core_unit, "AFFINITY_PATH",
-+                            $core_affinity_path);
-+                        $self->setAttribute($core_unit, "PHYS_PATH",
-+                            $core_physical_path);
-+                        $self->setAttribute($core_unit, "CHIP_UNIT",
-+                            $core_unit_num);
-+                        $self->setHuid($core_unit, 0, $node);
-+                        $self->setAttribute($core_unit, "ENTITY_INSTANCE",
-+                             $core_num);
-+                        $core_num++;
-+                    }
-+                }
-+                elsif ($unit_type eq "MCS")
-+                {
-+                    $self->processMcs($unit, $node, $proc, $parent_affinity,
-+                        $parent_physical, $node_phys);
-+                }
-+            }
-+        }
-+    }
-+}
-+
-+sub processMcs
-+{
-+    my $self            = shift;
-+    my $unit            = shift;
-+    my $node            = shift;
-+    my $proc            = shift;
-+    my $parent_affinity = shift;
-+    my $parent_physical = shift;
-+    my $node_phys       = shift;
-+
-+    my $mcs = $self->getAttribute($unit, "CHIP_UNIT");
-+    my $membufnum = $proc * $self->{MAX_MCS} + $mcs;
-+    $self->setAttribute($unit, "AFFINITY_PATH",$parent_affinity . "/mcs-$mcs");
-+    $self->setAttribute($unit, "PHYS_PATH", $parent_physical . "/mcs-$mcs");
-+    $self->setAttribute($unit, "MCS_NUM",   $mcs);
-+    $self->setHuid($unit, 0, $node);
-+    $self->{targeting}->{SYS}[0]{NODES}[$node]{PROCS}[$proc]{MCSS}[$mcs]{KEY} =
-+      $unit;
-+
-+        $self->setAttribute($unit, "EI_BUS_TX_LANE_INVERT","0");
-+        $self->setAttribute($unit, "EI_BUS_TX_MSBSWAP","0");
-+        $self->setAttribute($unit, "DMI_REFCLOCK_SWIZZLE","0");
-+
-+    ## Find connected membufs
-+    my $membuf_dmi = $self->{data}->{TARGETS}{$unit}{CONNECTION}{DEST}[0];
-+    if (defined($membuf_dmi))
-+    {
-+        ## found membuf connected
-+        my $membuf =
-+          $self->{data}->{TARGETS}{$membuf_dmi}
-+          {PARENT};    ## get parent of dmi unit which is membuf
-+        my $dmi_bus = $self->{data}->{TARGETS}{$unit}{CONNECTION}{BUS}[0];
-+        $self->setAttribute($membuf, "POSITION",$membufnum);
-+        $self->setAttribute($membuf, "AFFINITY_PATH",
-+            $parent_affinity . "/mcs-$mcs/membuf-$membufnum");
-+        $self->setAttribute($membuf, "PHYS_PATH",
-+            $node_phys . "/membuf-$membufnum");
-+        $self->setAttribute($membuf, "VPD_REC_NUM",
-+            $self->getAttribute($membuf, "POSITION"));
-+
-+        ## copy DMI bus attributes to membuf
-+        $self->setAttribute($unit, "EI_BUS_TX_LANE_INVERT",
-+            $dmi_bus->{bus_attribute}->{PROC_TX_LANE_INVERT}->{default});
-+        $self->setAttribute($unit, "EI_BUS_TX_MSBSWAP",
-+            $dmi_bus->{bus_attribute}->{PROC_TX_MSBSWAP}->{default});
-+        $self->setAttribute($membuf, "EI_BUS_TX_LANE_INVERT",
-+            $dmi_bus->{bus_attribute}->{MEMBUF_TX_LANE_INVERT}->{default});
-+        $self->setAttribute($membuf, "EI_BUS_TX_MSBSWAP",
-+            $dmi_bus->{bus_attribute}->{MEMBUF_TX_MSBSWAP}->{default});
-+
-+        ## auto setup FSI assuming schematic symbol.  If FSI busses are
-+        ## defined in serverwiz2, this will be overridden
-+        ## in the schematic symbol, the fsi port num matches dmi ref clk num
-+
-+        my $fsi_port = $self->{DMI_FSI_MAP}->{$mcs};
-+        my $proc_key =
-+            $self->{targeting}->{SYS}[0]{NODES}[$node]{PROCS}[$proc]{KEY};
-+        my $proc_path = $self->getAttribute($proc_key,"PHYS_PATH");
-+        $self->setFsiAttributes($membuf,"FSICM",0,$proc_path,$fsi_port,0);
-+        $self->setAttribute($unit, "DMI_REFCLOCK_SWIZZLE",$fsi_port);
-+        my $dmi_swizzle =
-+             $dmi_bus->{bus_attribute}->{DMI_REFCLOCK_SWIZZLE}->{default};
-+        my $dmi_swizzle =
-+             $self->getBusAttribute($unit,0,"DMI_REFCLOCK_SWIZZLE");
-+        if ($dmi_swizzle ne "")
-+        {
-+            $self->setAttribute($unit, "DMI_REFCLOCK_SWIZZLE",$dmi_swizzle);
-+        }
-+
-+        $self->setHuid($membuf, 0, $node);
-+        $self->{targeting}
-+          ->{SYS}[0]{NODES}[$node]{PROCS}[$proc]{MCSS}[$mcs] {MEMBUFS}[0]{KEY} =
-+          $membuf;
-+          
-+        $self->setAttribute($membuf, "ENTITY_INSTANCE",
-+               $self->{membuf_inst_num});   
-+        $self->{membuf_inst_num}++;
-+        ## get the mbas
-+        foreach my $child (@{ $self->{data}->{TARGETS}{$membuf}{CHILDREN} })
-+        {
-+            ## need to not hardcard the subunits
-+            if ($self->getType($child) eq "L4")
-+            {
-+                $self->{targeting}
-+                  ->{SYS}[0]{NODES}[$node]{PROCS}[$proc]{MCSS}[$mcs]{MEMBUFS}[0]
-+                  {L4S}[0] {KEY} = $child;
-+                $self->setAttribute($child, "AFFINITY_PATH",
-+                    $parent_affinity . "/mcs-$mcs/membuf-$membufnum/l4-0");
-+                $self->setAttribute($child, "PHYS_PATH",
-+                    $node_phys . "/membuf-$membufnum/l4-0");
-+                $self->setHuid($child, 0, $node);
-+            }
-+            
-+            if ($self->getType($child) eq "MBA")
-+            {
-+                my $mba = $self->getAttribute($child,"MBA_NUM");
-+                $self->setAttribute($child, "AFFINITY_PATH",
-+                    $parent_affinity . "/mcs-$mcs/membuf-$membufnum/mba-$mba");
-+                $self->setAttribute($child, "PHYS_PATH",
-+                    $node_phys . "/membuf-$membufnum/mba-$mba");
-+                $self->setHuid($child, 0, $node);
-+                $self->{targeting}
-+                  ->{SYS}[0]{NODES}[$node]{PROCS}[$proc]{MCSS}[$mcs]{MEMBUFS}[0]
-+                  {MBAS}[$mba]{KEY} = $child;
-+
-+                ## Trace the DDR busses to find connected DIMM
-+                my $ddrs = $self->findConnections($child,"DDR3","");
-+                if ($ddrs ne "")
-+                {
-+                    my $affinitypos=0;
-+                    foreach my $dimms (@{$ddrs->{CONN}})
-+                    {
-+                        my $ddr = $dimms->{SOURCE};
-+                        my $port_num = $self->getAttribute($ddr,"MBA_PORT");
-+                        my $dimm_num = $self->getAttribute($ddr,"MBA_DIMM");
-+                        my $dimm=$dimms->{DEST_PARENT};
-+                        $self->setAttribute($dimm,"MBA_PORT",$port_num);
-+                        $self->setAttribute($dimm,"MBA_DIMM",$dimm_num);
-+
-+                        my $aff_pos=16*$proc+$mcs*$self->{MAX_MCS}+4*$mba+
-+                                    2*$port_num+$dimm_num;
-+                        $self->setAttribute($dimm, "AFFINITY_PATH",
-+                            $parent_affinity
-+                      . "/mcs-$mcs/membuf-$membufnum/mba-$mba/dimm-$affinitypos"
-+                        );
-+                        $self->setAttribute($dimm, "PHYS_PATH",
-+                            $node_phys . "/dimm-" . $self->{dimm_tpos});
-+                        $self->setAttribute($dimm, "POSITION",
-+                            $aff_pos);
-+                        $self->setAttribute($dimm, "VPD_REC_NUM",
-+                            $aff_pos);
-+                        $self->setHuid($dimm, 0, $node);
-+                        $self->{targeting}
-+                          ->{SYS}[0]{NODES}[$node]{PROCS}[$proc] {MCSS}[$mcs]
-+                          {MEMBUFS}[0]{MBAS}[$mba] {DIMMS}[$affinitypos]{KEY} = $dimm;
-+                        $self->setAttribute($dimm, "ENTITY_INSTANCE",
-+                             $self->{dimm_tpos});  
-+                        $self->{dimm_tpos}++;
-+                        $affinitypos++;
-+                    }
-+                }
-+            }
-+        }
-+    }
-+}
-+
-+sub setFsiAttributes
-+{
-+    my $self = shift;
-+    my $target = shift;
-+    my $type = shift;
-+    my $cmfsi = shift;
-+    my $phys_path = shift;
-+    my $fsi_port = shift;
-+    my $flip_port = shift;
-+
-+    $self->setAttribute($target, "FSI_MASTER_TYPE","NO_MASTER");
-+    if ($type eq "FSIM")
-+    {
-+        $self->setAttribute($target, "FSI_MASTER_TYPE","MFSI");
-+    }
-+    if ($type eq "FSICM")
-+    {
-+        $self->setAttribute($target, "FSI_MASTER_TYPE","CMFSI");
-+    }
-+    $self->setAttribute($target, "FSI_MASTER_CHIP","physical:sys");
-+    $self->setAttribute($target, "FSI_MASTER_PORT","0xFF");
-+    $self->setAttribute($target, "ALTFSI_MASTER_CHIP","physical:sys");
-+    $self->setAttribute($target, "ALTFSI_MASTER_PORT","0xFF");
-+    $self->setAttribute($target, "FSI_SLAVE_CASCADE", "0");
-+    if ($cmfsi == 0)
-+    {
-+        $self->setAttribute($target, "FSI_MASTER_CHIP",$phys_path);
-+        $self->setAttribute($target, "FSI_MASTER_PORT", $fsi_port);
-+    }
-+    else
-+    {
-+        $self->setAttribute($target, "ALTFSI_MASTER_CHIP",$phys_path);
-+        $self->setAttribute($target, "ALTFSI_MASTER_PORT", $fsi_port);
-+    }
-+
-+    #my $phys_path = $targetObj->getAttribute($parentTarget, "PHYS_PATH");
-+    $self->setAttributeField($target, "FSI_OPTION_FLAGS","flipPort",
-+          $flip_port);
-+    $self->setAttributeField($target, "FSI_OPTION_FLAGS","reserved", "0");
-+
-+}
-+
-+
-+## returns pointer to target from target name
-+sub getTarget
-+{
-+    my $self   = shift;
-+    my $target = shift;
-+    return $self->{data}->{TARGETS}->{$target};
-+}
-+
-+## returns pointer to array of all targets
-+sub getAllTargets
-+{
-+    my $self   = shift;
-+    my $target = shift;
-+    return $self->{data}->{TARGETS};
-+}
-+
-+## returns the target name of the parent of passed in target
-+sub getTargetParent
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $target_ptr = $self->getTarget($target);
-+    return $target_ptr->{PARENT};
-+}
-+
-+## returns the number of connections associated with target
-+sub getNumConnections
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $target_ptr = $self->getTarget($target);
-+    if (!defined($target_ptr->{CONNECTION}->{DEST}))
-+    {
-+        return 0;
-+    }
-+    return scalar(@{ $target_ptr->{CONNECTION}->{DEST} });
-+}
-+
-+## returns destination target name of first connection
-+## useful for point to point busses with only 1 endpoint
-+sub getFirstConnectionDestination
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $target_ptr = $self->getTarget($target);
-+    return $target_ptr->{CONNECTION}->{DEST}->[0];
-+}
-+
-+## returns pointer to bus of first connection
-+sub getFirstConnectionBus
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $target_ptr = $self->getTarget($target);
-+    return $target_ptr->{CONNECTION}->{BUS}->[0];
-+}
-+## returns target name of $i connection
-+sub getConnectionDestination
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $i          = shift;
-+    my $target_ptr = $self->getTarget($target);
-+    return $target_ptr->{CONNECTION}->{DEST}->[$i];
-+}
-+
-+sub getConnectionBus
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $i          = shift;
-+    my $target_ptr = $self->getTarget($target);
-+    return $target_ptr->{CONNECTION}->{BUS}->[$i];
-+}
-+
-+sub findFirstEndpoint
-+{
-+    my $self     = shift;
-+    my $target   = shift;
-+    my $bus_type = shift;
-+    my $end_type = shift;
-+
-+    my $target_children = $self->getTargetChildren($target);
-+    if ($target_children eq "") { return ""; }
-+
-+    foreach my $child (@{ $self->getTargetChildren($target) })
-+    {
-+        my $child_bus_type = $self->getBusType($child);
-+        if ($child_bus_type eq $bus_type)
-+        {
-+            for (my $i = 0; $i < $self->getNumConnections($child); $i++)
-+            {
-+                my $dest_target = $self->getConnectionDestination($child, $i);
-+                my $dest_parent = $self->getTargetParent($dest_target);
-+                my $type        = $self->getMrwType($dest_parent);
-+                my $dest_type   = $self->getType($dest_parent);
-+                if ($type eq "NA") { $type = $dest_type; }
-+                if ($type eq $end_type)
-+                {
-+                    return $dest_parent;
-+                }
-+            }
-+        }
-+    }
-+    return "";
-+}
-+sub findConnections
-+{
-+    my $self     = shift;
-+    my $target   = shift;
-+    my $bus_type = shift;
-+    my $end_type = shift;
-+
-+    my %connections;
-+    my $num=0;
-+    my $target_children = $self->getTargetChildren($target);
-+    if ($target_children eq "")
-+    {
-+        return "";
-+    }
-+
-+    foreach my $child (@{ $self->getTargetChildren($target) })
-+    {
-+        my $child_bus_type = $self->getBusType($child);
-+        if ($child_bus_type eq $bus_type)
-+        {
-+            for (my $i = 0; $i < $self->getNumConnections($child); $i++)
-+            {
-+                my $dest_target = $self->getConnectionDestination($child, $i);
-+                my $dest_parent = $self->getTargetParent($dest_target);
-+                my $type        = $self->getMrwType($dest_parent);
-+                my $dest_type   = $self->getType($dest_parent);
-+                if ($type eq "NA")
-+                {
-+                    $type = $dest_type;
-+                }
-+
-+                if ($type eq $end_type || $end_type eq "")
-+                {
-+                    $connections{CONN}[$num]{SOURCE}=$child;
-+                    $connections{CONN}[$num]{SOURCE_PARENT}=$target;
-+                    $connections{CONN}[$num]{DEST}=$dest_target;
-+                    $connections{CONN}[$num]{DEST_PARENT}=$dest_parent;
-+                    $connections{CONN}[$num]{BUS_NUM}=$i;
-+                    $num++;
-+                }
-+            }
-+        }
-+    }
-+    if ($num==0) { return ""; }
-+    return \%connections;
-+}
-+
-+
-+## returns BUS_TYPE attribute of target
-+sub getBusType
-+{
-+    my $self   = shift;
-+    my $target = shift;
-+    my $type   = $self->getAttribute($target, "BUS_TYPE");
-+    if ($type eq "") { $type = "NA"; }
-+    return $type;
-+}
-+
-+## return target type
-+sub getType
-+{
-+    my $self   = shift;
-+    my $target = shift;
-+    my $type   = $self->getAttribute($target, "TYPE");
-+    if ($type eq "") { $type = "NA"; }
-+    return $type;
-+}
-+
-+## return target type
-+sub getMrwType
-+{
-+    my $self   = shift;
-+    my $target = shift;
-+    my $type   = $self->getAttribute($target, "MRW_TYPE");
-+    if ($type eq "") { $type = "NA"; }
-+    return $type;
-+}
-+
-+## returns target instance name
-+sub getInstanceName
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $target_ptr = $self->getTarget($target);
-+    return $target_ptr->{TARGET}->{instance_name};
-+}
-+
-+## returns the parent target type
-+sub getTargetType
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $target_ptr = $self->getTarget($target);
-+    return $target_ptr->{TARGET}->{type};
-+}
-+
-+## checks if attribute is value
-+## must be defined and have a non-empty value
-+sub isBadAttribute
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $attribute  = shift;
-+    my $badvalue   = shift;
-+    my $target_ptr = $self->getTarget($target);
-+    if (!defined($target_ptr->{ATTRIBUTES}->{$attribute}))
-+    {
-+        return 1;
-+    }
-+    if (!defined($target_ptr->{ATTRIBUTES}->{$attribute}->{default}))
-+    {
-+        return 1;
-+    }
-+    if ($target_ptr->{ATTRIBUTES}->{$attribute}->{default} eq "")
-+    {
-+        return 1;
-+    }
-+    if ($target_ptr->{ATTRIBUTES}->{$attribute}->{default} eq $badvalue)
-+    {
-+        return 1;
-+    }
-+    return 0;
-+}
-+
-+## checks if complex attribute field is
-+## defined and non-empty
-+sub isBadComplexAttribute
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $attribute  = shift;
-+    my $field      = shift;
-+    my $badvalue   = shift;
-+    my $target_ptr = $self->getTarget($target);
-+
-+    if (!defined($target_ptr->{ATTRIBUTES}->{$attribute}))
-+    {
-+        return 1;
-+    }
-+    if (!defined($target_ptr->{ATTRIBUTES}->{$attribute}->{default}))
-+    {
-+        return 1;
-+    }
-+    if (!defined($target_ptr->{ATTRIBUTES}->{$attribute}->{default}->{field}))
-+    {
-+        return 1;
-+    }
-+    if ($target_ptr->{ATTRIBUTES}->{$attribute}->{default}->{field}->{$field}
-+        ->{value} eq "")
-+    {
-+        return 1;
-+    }
-+    if ($target_ptr->{ATTRIBUTES}->{$attribute}->{default}->{field}->{$field}
-+        ->{value} eq $badvalue)
-+    {
-+        return 1;
-+    }
-+    return 0;
-+}
-+
-+## returns attribute value
-+sub getAttribute
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $attribute  = shift;
-+    my $target_ptr = $self->getTarget($target);
-+    if (!defined($target_ptr->{ATTRIBUTES}->{$attribute}->{default}))
-+    {
-+        printf("ERROR: getAttribute(%s,%s) | Attribute not defined\n",
-+            $target, $attribute);
-+
-+        #print Dumper($target_ptr);
-+        $self->myExit(4);
-+    }
-+    return $target_ptr->{ATTRIBUTES}->{$attribute}->{default};
-+}
-+## renames a target attribute
-+sub renameAttribute
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $oldName    = shift;
-+    my $newName    = shift;
-+    my $target_ptr = $self->{data}->{TARGETS}->{$target};
-+    if (!defined($target_ptr->{ATTRIBUTES}->{$oldName}))
-+    {
-+        return 1;
-+    }
-+    $target_ptr->{ATTRIBUTES}->{$newName}->{default} =
-+      $target_ptr->{ATTRIBUTES}->{$oldName}->{default};
-+    delete($target_ptr->{ATTRIBUTES}->{$oldName});
-+    $self->log($target, "Renaming attribute: $oldName => $newName");
-+    return 0;
-+}
-+
-+## copy an attribute between targets
-+sub copyAttribute
-+{
-+    my $self = shift;
-+    my $source_target = shift;
-+    my $dest_target = shift;
-+    my $attribute = shift;
-+
-+    my $value=$self->getAttribute($source_target,$attribute);
-+    $self->setAttribute($dest_target,$attribute,$value);
-+
-+    $self->log($dest_target, "Copy Attribute: $attribute=$value");
-+}
-+
-+## sets an attribute
-+sub setAttribute
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $attribute  = shift;
-+    my $value      = shift;
-+    my $target_ptr = $self->getTarget($target);
-+    $target_ptr->{ATTRIBUTES}->{$attribute}->{default} = $value;
-+    $self->log($target, "Setting Attribute: $attribute=$value");
-+}
-+## sets the field of a complex attribute
-+sub setAttributeField
-+{
-+    my $self      = shift;
-+    my $target    = shift;
-+    my $attribute = shift;
-+    my $field     = shift;
-+    my $value     = shift;
-+    $self->{data}->{TARGETS}->{$target}->{ATTRIBUTES}->{$attribute}->{default}
-+      ->{field}->{$field}->{value} = $value;
-+}
-+## returns complex attribute value
-+sub getAttributeField
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $attribute  = shift;
-+    my $field      = shift;
-+    my $target_ptr = $self->getTarget($target);
-+    if (!defined($target_ptr->{ATTRIBUTES}->{$attribute}->
-+       {default}->{field}->{$field}->{value}))
-+    {
-+        printf("ERROR: getAttributeField(%s,%s,%s) | Attribute not defined\n",
-+            $target, $attribute,$field);
-+
-+        $self->myExit(4);
-+    }
-+
-+    return $target_ptr->{ATTRIBUTES}->{$attribute}->
-+           {default}->{field}->{$field}->{value};
-+}
-+
-+## returns an attribute from a bus
-+sub getBusAttribute
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $busnum     = shift;
-+    my $attr       = shift;
-+    my $target_ptr = $self->getTarget($target);
-+
-+    if (
-+        !defined(
-+            $target_ptr->{CONNECTION}->{BUS}->[$busnum]->{bus_attribute}
-+              ->{$attr}->{default}
-+        )
-+      )
-+    {
-+        printf("ERROR: getBusAttribute(%s,%d,%s) | Attribute not defined\n",
-+            $target, $busnum, $attr);
-+        $self->myExit(4);
-+    }
-+   if (ref($target_ptr->{CONNECTION}->{BUS}->[$busnum]->{bus_attribute}->{$attr}
-+      ->{default}) eq  "HASH") {
-+        return  "";
-+    }
-+    return $target_ptr->{CONNECTION}->{BUS}->[$busnum]->{bus_attribute}->{$attr}
-+      ->{default};
-+}
-+## returns a pointer to an array of children target names
-+sub getTargetChildren
-+{
-+    my $self       = shift;
-+    my $target     = shift;
-+    my $target_ptr = $self->getTarget($target);
-+    ## this is an array
-+    return $target_ptr->{CHILDREN};
-+}
-+
-+sub getEnumValue
-+{
-+    my $self     = shift;
-+    my $enumType = shift;
-+    my $enumName = shift;
-+    if (!defined($self->{enumeration}->{$enumType}->{$enumName}))
-+    {
-+        printf("ERROR: getEnumValue(%s,%s) | enumType not defined\n",
-+            $enumType, $enumName);
-+        $self->myExit(4);
-+    }
-+    return $self->{enumeration}->{$enumType}->{$enumName};
-+}
-+
-+sub getEnumHash
-+{
-+    my $self     = shift;
-+    my $enumType = shift;
-+    my $enumName = shift;
-+    if (!defined($self->{enumeration}->{$enumType}))
-+    {
-+        printf("ERROR: getEnumValue(%s) | enumType not defined\n",
-+            $enumType);
-+            print Dumper($self->{enumeration});
-+        $self->myExit(4);
-+    }
-+    return $self->{enumeration}->{$enumType};
-+}
-+
-+sub setHuid
-+{
-+    my $self   = shift;
-+    my $target = shift;
-+    my $sys    = shift;
-+    my $node   = shift;
-+
-+    my $type    = $self->getType($target);
-+    my $type_id = $self->{enumeration}->{TYPE}->{$type};
-+    if ($type_id eq "") { $type_id = 0; }
-+    if ($type_id == 0) { return; }
-+    my $index = 0;
-+    if (defined($self->{huid_idx}->{$type}))
-+    {
-+        $index = $self->{huid_idx}->{$type};
-+    }
-+    else { $self->{huid_idx}->{$type} = 0; }
-+
-+    # Format: SSSS NNNN TTTTTTTT iiiiiiiiiiiiiiii
-+    my $huid = sprintf("%01x%01x%02x%04x", $sys, $node, $type_id, $index);
-+    $huid = "0x" . uc($huid);
-+
-+    $self->setAttribute($target, "HUID", $huid);
-+    $self->{huid_idx}->{$type}++;
-+    $self->log($target, "Setting HUID: $huid");
-+    $self->setMruid($target, $node);
-+}
-+
-+sub setMruid
-+{
-+    my $self   = shift;
-+    my $target = shift;
-+    my $node   = shift;
-+
-+    my $type          = $self->getType($target);
-+    my $mru_prefix_id = $self->{enumeration}->{MRU_PREFIX}->{$type};
-+    if ($mru_prefix_id eq "") { $mru_prefix_id = "0xFFFF"; }
-+    if ($mru_prefix_id eq "0xFFFF") { return; }
-+    my $index = 0;
-+    if (defined($self->{mru_idx}->{$node}->{$type}))
-+    {
-+        $index = $self->{mru_idx}->{$node}->{$type};
-+    }
-+    else { $self->{mru_idx}->{$node}->{$type} = 0; }
-+
-+    my $mruid = sprintf("%s%04x", $mru_prefix_id, $index);
-+    $self->setAttribute($target, "MRU_ID", $mruid);
-+    $self->{mru_idx}->{$node}->{$type}++;
-+}
-+
-+sub getMasterProc
-+{
-+    my $self = shift;
-+    return $self->{master_proc};
-+}
-+
-+sub setMasterProc
-+{
-+    my $self = shift;
-+    my $target = shift;
-+    $self->{master_proc}=$target;
-+}
-+
-+sub getSystemName
-+{
-+    my $self = shift;
-+    return $self->getAttribute("/".$self->{TOP_LEVEL}, "SYSTEM_NAME");
-+}
-+
-+sub myExit
-+{
-+    my $self      = shift;
-+    my $exit_code = shift;
-+    if ($exit_code eq "") { $exit_code = 0; }
-+    $self->{errorsExist} = 1;
-+    if ($self->{force} == 0)
-+    {
-+        exit($exit_code);
-+    }
-+}
-+
-+sub log
-+{
-+    my $self   = shift;
-+    my $target = shift;
-+    my $msg    = shift;
-+    if ($self->{debug})
-+    {
-+        print "DEBUG: ($target) $msg\n";
-+    }
-+}
-+1;
-+
-+=head1 NAME
-+
-+Targets
-+
-+=head1 SYNOPSIS
-+
-+    use Targets;
-+
-+    my $targets = Targets->new;
-+    $targets->loadXML("myfile.xml");
-+    foreach my $target ( sort keys %{ $targets->getAllTargets() } ) {
-+        ## do stuff with targets
-+    }
-+
-+    $targets->printXML( $file_handle, "top" );
-+
-+=head1 DESCRIPTION
-+
-+C<Targets> is a class that consumes XML generated by ServerWiz2.  The XML
-+describes a POWER system topology including nodes, cards, chips, and busses.
-+
-+=head1 OVERVIEW
-+
-+A simple example of a ServerWiz2 topology would be:
-+
-+=over 4
-+
-+=item Topology Example:
-+
-+   -system
-+      -node
-+         -motherboard
-+           -processor
-+           -pcie card
-+               - daughtercard
-+                  - memory buffer
-+                  - dimms
-+
-+=back
-+
-+Targets->loadXML("myfile.xml") reads this topology and creates 2 data
-+structures.  One data structure simply represents the hierarchical system
-+topology.  The other data structure represents the hierarchical structure
-+that hostboot expects (affinity path).
-+
-+Unlike hostboot, everything in ServerWiz2 is represented as a target.
-+For example, FSI and I2C units are targets under the processor that have a
-+bus type and therefore allow connections to be made.
-+
-+=head1 CONSTRUCTOR
-+
-+=over 4
-+
-+=item new ()
-+
-+There are no arguments for the constructor.
-+
-+=back
-+
-+=head1 METHODS
-+
-+C<TARGET> is a pointer to data structure containing all target information.
-+C<TARGET_STRING> is the hierarchical target string used as key for data
-+structure.  An example for C<TARGET_STRING> would be:
-+C</sys-0/node-0/motherboard-0/dimm-0>
-+
-+=over 4
-+
-+=item loadXml (C<FILENAME>)
-+
-+Reads ServerWiz2 XML C<FILENAME> and stores into a data structure for
-+manipulation and printing.
-+
-+=item getTarget(C<TARGET_STRING>)
-+
-+Returns pointer to data structure (C<TARGET>)
-+
-+=item getAllTargets(C<TARGET_STRING>)
-+
-+Returns array with all existing target data structures
-+
-+=item getTargetParent(C<TARGET_STRING>)
-+
-+Returns C<TARGET_STRING> of parent target
-+
-+=item getNumConnections(C<TARGET_STRING>)
-+
-+Returns the number of bus connections to this target
-+
-+=item getFirstConnectionDestination(C<TARGET_STRING>)
-+
-+Returns the target string of the first target found connected to
-+C<TARGET_STRING>.  This is useful because many busses are guaranteed
-+to only have one connection because they are point to point.
-+
-+=item getFirstConnectionBus(C<TARGET_STRING>)
-+
-+Returns the data structure of the bus of the first target found connected to
-+C<TARGET_STRING>.  The bus data structure is also a target with attributes.
-+
-+=item getConnectionDestination(C<TARGET_STRING>,C<INDEX>)
-+
-+Returns the target string of the C<INDEX> target found connected to
-+C<TARGET_STRING>.
-+
-+=item getConnectionBus(C<TARGET_STRING>)
-+
-+Returns the data structure of the C<INDEX> bus target found connected to
-+C<TARGET_STRING>.
-+
-+=item findEndpoint(C<TARGET_STRING>,C<BUS_TYPE>,C<ENDPOINT_MRW_TYPE>)
-+
-+Searches through all connections to C<TARGET_STRING>
-+for a endpoint C<MRW_TYPE> and C<BUS_TYPE>
-+
-+=item getBusType(C<TARGET_STRING>)
-+
-+Returns the BUS_TYPE attribute of (C<TARGET_STRING>).  Examples are I2C and DMI.
-+
-+=item getType(C<TARGET_STRING>)
-+
-+Returns the TYPE attribute of (C<TARGET_STRING>).
-+Examples are PROC and MEMBUF.
-+
-+=item getMrwType(C<TARGET_STRING>)
-+
-+Returns the MRW_TYPE attribute of (C<TARGET_STRING>).
-+Examples are CARD and PCI_CONFIG.  This
-+is an extension to the TYPE attribute and are types that hostboot does
-+not care about.
-+
-+=item getTargetType(C<TARGET_STRING>)
-+
-+Returns the target type id of (C<TARGET_STRING>).
-+This is not the TYPE attribute.  This is the
-+<id> from target_types.xml.  Examples are unit-pci-power8 and enc-node-power8.
-+
-+=item isBadAttribute(C<TARGET_STRING>,C<ATTRIBUTE_NAME>)
-+
-+Tests where attribute (C<ATTRIBUTE_NAME>) has been set in
-+target (C<TARGET_STRING>).  Returns true if attribute is undefined or empty
-+and false if attribute is defined and not empty.
-+
-+=item getAttribute(C<TARGET_STRING>,C<ATTRIBUTE_NAME>)
-+
-+Returns the value of attribute C<ATTRIBUTE_NAME> in target C<TARGET_STRING>.
-+
-+=item renameAttribute(C<TARGET_STRING>,C<ATTRIBUTE_OLDNAME>,
-+C<ATTRIBUTE_OLDNAME>)
-+
-+Renames attribute C<ATTRIBUTE_OLDNAME> to C<ATTRIBUTE_NEWNAME> in target
-+C<TARGET_STRING>.
-+
-+=item setAttribute(C<TARGET_STRING>,C<ATTRIBUTE_NAME>,C<VALUE>)
-+
-+Sets attribute C<ATTRIBUTE_NAME> of target C<TARGET_STRING> to value C<VALUE>.
-+
-+=item setAttributeField(C<TARGET_STRING>,C<ATTRIBUTE_NAME>,C<FIELD>,C<VALUE>)
-+
-+Sets attribute C<ATTRIBUTE_NAME> and field C<FIELD> of target C<TARGET_STRING>
-+to value C<VALUE>.  This is for complex attributes.
-+
-+=item getBusAttribute(C<TARGET_STRING>,C<INDEX>,C<ATTRIBUTE_NAME>)
-+
-+Gets the attribute C<ATTRIBUTE_NAME> from bus C<TARGET_STRING> bus number
-+C<INDEX>.
-+
-+=item getTargetChildren(C<TARGET_STRING>)
-+
-+Returns an array of target strings representing all the children of target
-+C<TARGET_STRING>.
-+
-+=item getEnumValue(C<ENUM_TYPE>,C<ENUM_NAME>)
-+
-+Returns the enum value of type C<ENUM_TYPE> and name C<ENUM_NAME>.  The
-+enumerations are also defined in ServerWiz2 XML output and are directly
-+copied from attribute_types.xml.
-+
-+=item getMasterProc()
-+
-+Returns the target string of the master processor.
-+
-+=item myExit(C<EXIT_NUM>)
-+
-+Calls exit(C<EXIT_NUM>) when force flag is not set.
-+
-+=item log(C<TARGET_STRING>,C<MESSAGE>)
-+
-+Prints to stdout log message is debug mode is turned on.
-+
-+
-+=back
-+
-+=head1 CREDITS
-+
-+Norman James <njames@us.ibm.com>
-+
-+=cut
-+
-diff --git a/src/usr/targeting/common/processMrw.pl b/src/usr/targeting/common/processMrw.pl
-new file mode 100755
-index 0000000..1fb292f
---- /dev/null
-+++ b/src/usr/targeting/common/processMrw.pl
-@@ -0,0 +1,1144 @@
-+#! /usr/bin/perl
-+# IBM_PROLOG_BEGIN_TAG
-+# This is an automatically generated prolog.
-+#
-+# $Source: src/usr/targeting/common/processMrw.pl $
-+#
-+# OpenPOWER HostBoot Project
-+#
-+# Contributors Listed Below - COPYRIGHT 2015
-+# [+] International Business Machines Corp.
-+#
-+#
-+# Licensed under the Apache License, Version 2.0 (the "License");
-+# you may not use this file except in compliance with the License.
-+# You may obtain a copy of the License at
-+#
-+#     http://www.apache.org/licenses/LICENSE-2.0
-+#
-+# Unless required by applicable law or agreed to in writing, software
-+# distributed under the License is distributed on an "AS IS" BASIS,
-+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-+# implied. See the License for the specific language governing
-+# permissions and limitations under the License.
-+#
-+# IBM_PROLOG_END_TAG
-+
-+use strict;
-+use XML::Simple;
-+use Data::Dumper;
-+use Targets;
-+use Math::BigInt;
-+use Getopt::Long;
-+use File::Basename;
-+
-+my $VERSION = "1.0.0";
-+
-+my $force          = 0;
-+my $serverwiz_file = "";
-+my $version        = 0;
-+my $debug          = 0;
-+my $report         = 0;
-+my $sdr_file       = "";
-+
-+GetOptions(
-+    "f"   => \$force,             # numeric
-+    "x=s" => \$serverwiz_file,    # string
-+    "d"   => \$debug,
-+    "v"   => \$version,
-+    "r"   => \$report,
-+  )                               # flag
-+  or printUsage();
-+
-+if ($version == 1)
-+{
-+    die "\nprocessMrw.pl\tversion $VERSION\n";
-+}
-+
-+if ($serverwiz_file eq "")
-+{
-+    printUsage();
-+}
-+
-+$XML::Simple::PREFERRED_PARSER = 'XML::Parser';
-+
-+my $targetObj = Targets->new;
-+if ($force == 1)
-+{
-+    $targetObj->{force} = 1;
-+}
-+if ($debug == 1)
-+{
-+    $targetObj->{debug} = 1;
-+}
-+
-+$targetObj->setVersion($VERSION);
-+my $xmldir = dirname($serverwiz_file);
-+$targetObj->loadXML($serverwiz_file);
-+
-+#--------------------------------------------------
-+## loop through all targets and do stuff
-+foreach my $target (sort keys %{ $targetObj->getAllTargets() })
-+{
-+    my $type = $targetObj->getType($target);
-+    if ($type eq "SYS")
-+    {
-+        processSystem($targetObj, $target);
-+    } 
-+    elsif ($type eq "PROC")
-+    {
-+        processProcessor($targetObj, $target);
-+    }
-+    elsif ($type eq "MEMBUF")
-+    {
-+        processMembuf($targetObj, $target);
-+    }
-+    elsif ($type eq "FSP")
-+    {
-+        processBmc($targetObj, $target);
-+    }
-+}
-+
-+
-+## check topology
-+foreach my $n (keys %{$targetObj->{TOPOLOGY}}) {
-+    foreach my $p (keys %{$targetObj->{TOPOLOGY}->{$n}}) {
-+        if ($targetObj->{TOPOLOGY}->{$n}->{$p} > 1) {
-+            print "ERROR: Fabric topology invalid.  2 targets have same ".
-+                  "FABRIC_NODE_ID,FABRIC_CHIP_ID ($n,$p)\n";
-+            $targetObj->myExit(3);
-+        }
-+    }
-+}
-+## check for errors
-+if ($targetObj->getMasterProc() eq "")
-+{
-+    print "ERROR: Master Processor not defined.  Please instaitant a BMC
-+ and connect LPC bus\n";
-+    $targetObj->myExit(3);
-+}
-+foreach my $target (keys %{ $targetObj->getAllTargets() })
-+{
-+    errorCheck($targetObj, $target);
-+}
-+
-+#--------------------------------------------------
-+## write out final XML
-+my $xml_fh;
-+my $filename = $xmldir . "/" . $targetObj->getSystemName() . "_hb.mrw.xml";
-+print "Creating XML: $filename\n";
-+open($xml_fh, ">$filename") || die "Unable to create: $filename";
-+$targetObj->printXML($xml_fh, "top");
-+close $xml_fh;
-+if (!$targetObj->{errorsExist})
-+{
-+    print "MRW created successfully!\n";
-+}
-+
-+
-+## optionally print out report
-+if ($report)
-+{
-+    my $report_file = $xmldir . "/" . $targetObj->getSystemName() . ".rpt";
-+    open(SUM,">$report_file") || die "Unable to create: $report_file\n";
-+    my $ref = $targetObj->{targeting}->{SYS}[0]{NODES}[0]{PROCS};       
-+    foreach my $proc (@{$ref})
-+    {
-+        foreach my $mcs (@{$proc->{MCSS}})
-+        {
-+            my $mcs_target = $mcs->{KEY};
-+            my $membuf=$mcs->{MEMBUFS}[0];
-+            my $membuf_target = $membuf->{KEY};
-+          
-+            my $sch = $targetObj->getAttribute($mcs_target,
-+                      "SCHEMATIC_INTERFACE");
-+            my $aff = $targetObj->getAttribute($mcs_target,"AFFINITY_PATH");
-+            my $huid = $targetObj->getAttribute($mcs_target,"HUID");
-+            print SUM "$sch | $huid | $mcs_target | $aff\n";
-+            if ($membuf_target ne "") {
-+                foreach my $mba (@{$membuf->{MBAS}}) {
-+                    my $mba_target = $mba->{KEY};
-+               
-+                    $huid = $targetObj->getAttribute($mba_target,"HUID");
-+                    $aff = $targetObj->getAttribute($mcs_target,
-+                                   "AFFINITY_PATH");
-+                    print SUM "\t | $huid | $mba_target | $aff\n";
-+                    foreach my $dimm (@{$mba->{DIMMS}}) {
-+                        my $dimm_target = $dimm->{KEY};
-+                        $aff = $targetObj->getAttribute($dimm_target,
-+                                   "AFFINITY_PATH");
-+                        $huid = $targetObj->getAttribute($dimm_target,"HUID");
-+                        my $p = $targetObj->getAttribute($dimm_target,
-+                                  "MBA_PORT");
-+                        my $d = $targetObj->getAttribute($dimm_target,
-+                                   "MBA_DIMM");
-+                        my $i2c = $targetObj->getAttributeField($dimm_target,
-+                                  "EEPROM_VPD_PRIMARY_INFO","devAddr");
-+                        my $sens = $targetObj->getAttribute($dimm_target,
-+                                  "IPMI_SENSORS");
-+                        my @s = split(/\,/,$sens);
-+                        
-+                        print SUM "\t\t$huid | $dimm_target".
-+                                  " | $aff | $p | $d | $i2c | ".
-+                                  "$s[0],$s[1] | $s[2],$s[3]\n";
-+                    }
-+                }
-+            }
-+        }
-+    }
-+    close SUM;
-+}
-+
-+#--------------------------------------------------
-+#--------------------------------------------------
-+## Processing subroutines
-+
-+#--------------------------------------------------
-+
-+#--------------------------------------------------
-+## System
-+##
-+
-+sub processSystem
-+{
-+    my $targetObj = shift;
-+    my $target    = shift;
-+
-+    $targetObj->setAttribute($target, "MAX_MCS_PER_SYSTEM",
-+        $targetObj->{NUM_PROCS_PER_NODE} * $targetObj->{MAX_MCS});
-+    $targetObj->setAttribute($target, "MAX_PROC_CHIPS_PER_NODE",
-+        $targetObj->{NUM_PROCS_PER_NODE});
-+    parseBitwise($targetObj,$target,"CDM_POLICIES");
-+}
-+sub processBmc
-+{
-+    my $targetObj = shift;
-+    my $target    = shift;
-+    my $i2cs=$targetObj->findConnections($target,"I2C","PROC");
-+    if ($i2cs ne "")
-+    {
-+       foreach my $i2c (@{$i2cs->{CONN}})
-+       {
-+           my $addr=$targetObj->getBusAttribute(
-+                $i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_ADDRESS");
-+           $targetObj->setAttribute(
-+                $i2c->{DEST_PARENT},"I2C_SLAVE_ADDRESS",$addr);
-+       }
-+    }
-+    my $lpcs=$targetObj->findConnections($target,"LPC","PROC");
-+    if ($lpcs ne "")
-+    {
-+       my $lpc=$lpcs->{CONN}->[0];
-+       $targetObj->setMasterProc($lpc->{DEST_PARENT});
-+    }
-+}
-+
-+
-+sub parseBitwise
-+{
-+    my $targetObj = shift;
-+    my $target = shift;
-+    my $attribute = shift;
-+
-+    my $mask = 0;
-+    foreach my $e (keys %{ $targetObj->getEnumHash($attribute) }) {
-+        my $field = $targetObj->getAttributeField(
-+                    $target,$attribute."_BITMASK",$e);
-+        my $val=hex($targetObj->getEnumValue($attribute,$e));
-+        if ($field eq "true")
-+        {
-+            $mask=$mask | $val;
-+        }
-+    }
-+    $targetObj->setAttribute($target,$attribute,$mask);
-+ }
-+#--------------------------------------------------
-+## Processor
-+##
-+
-+sub processProcessor
-+{
-+    my $targetObj = shift;
-+    my $target    = shift;
-+
-+    #########################
-+    ## Copy PCIE attributes from socket
-+    ## In serverwiz, processor instances are not unique
-+    ## because plugged into socket
-+    ## so processor instance unique attributes are socket level.
-+    ## The grandparent is guaranteed to be socket.
-+    my $socket_target =
-+       $targetObj->getTargetParent($targetObj->getTargetParent($target));
-+    $targetObj->copyAttribute($socket_target,$target,"LOCATION_CODE");
-+    $targetObj->copyAttribute($socket_target,$target,"FRU_ID");
-+    
-+
-+    foreach my $attr (sort (keys
-+           %{ $targetObj->getTarget($socket_target)->{TARGET}->{attribute} }))
-+    {
-+        if ($attr =~ /PROC\_PCIE/)
-+        {
-+            $targetObj->copyAttribute($socket_target,$target,$attr);
-+        }
-+    }
-+    $targetObj->log($target, "Processing PROC");
-+    foreach my $child (@{ $targetObj->getTargetChildren($target) })
-+    {
-+        $targetObj->log($target, "Processing PROC child: $child");
-+        my $child_type = $targetObj->getType($child);
-+        if ($child_type eq "NA" || $child_type eq "FSI")
-+        {
-+            $child_type = $targetObj->getMrwType($child);
-+        }
-+        if ($child_type eq "ABUS")
-+        {
-+            processAbus($targetObj, $child);
-+        }
-+        elsif ($child_type eq "XBUS")
-+        {
-+            processXbus($targetObj, $child);
-+        }
-+        elsif ($child_type eq "FSIM" || $child_type eq "FSICM")
-+        {
-+            processFsi($targetObj, $child, $target);
-+        }
-+        elsif ($child_type eq "PCI_CONFIGS")
-+        {
-+            foreach my $pci_child (@{ $targetObj->getTargetChildren($child) })
-+            {
-+               processPcie($targetObj, $pci_child, $target);
-+            }
-+        }
-+        elsif ($child_type eq "MCS")
-+        {
-+            processMcs($targetObj, $child, $target);
-+        }
-+        elsif ($child_type eq "OCC")
-+        {
-+            processOcc($targetObj, $child, $target);
-+        }
-+    }
-+
-+    ## update path for mvpd's and sbe's
-+    my $path  = $targetObj->getAttribute($target, "PHYS_PATH");
-+    my $model = $targetObj->getAttribute($target, "MODEL");
-+
-+    $targetObj->setAttributeField($target,
-+        "EEPROM_VPD_PRIMARY_INFO","i2cMasterPath",$path);
-+    $targetObj->setAttributeField($target,
-+        "EEPROM_VPD_BACKUP_INFO","i2cMasterPath",$path);
-+    $targetObj->setAttributeField($target,
-+        "EEPROM_SBE_PRIMARY_INFO","i2cMasterPath",$path);
-+    $targetObj->setAttributeField($target,
-+        "EEPROM_SBE_BACKUP_INFO","i2cMasterPath",$path);
-+    $targetObj->setAttributeField($target,
-+        "EEPROM_VPD_FRU_INFO","i2cMasterPath",$path);
-+
-+    ## initialize master processor FSI's
-+    $targetObj->setAttributeField($target, "FSI_OPTION_FLAGS", "flipPort", "0");
-+
-+    if ($target eq $targetObj->getMasterProc())
-+    {
-+        $targetObj->setAttributeField($target, "FSI_OPTION_FLAGS", "reserved",
-+            "0");
-+        $targetObj->setAttribute($target, "FSI_MASTER_CHIP",    "physical:sys");
-+        $targetObj->setAttribute($target, "FSI_MASTER_PORT",    "0xFF");
-+        $targetObj->setAttribute($target, "ALTFSI_MASTER_CHIP", "physical:sys");
-+        $targetObj->setAttribute($target, "ALTFSI_MASTER_PORT", "0xFF");
-+        $targetObj->setAttribute($target, "FSI_MASTER_TYPE",    "NO_MASTER");
-+        $targetObj->setAttribute($target, "FSI_SLAVE_CASCADE",  "0");
-+        $targetObj->setAttribute($target, "PROC_MASTER_TYPE", "ACTING_MASTER");
-+    }
-+    else
-+    {
-+        $targetObj->setAttribute($target, "PROC_MASTER_TYPE",
-+            "MASTER_CANDIDATE");
-+    }
-+    ## Update bus speeds
-+    processI2cSpeeds($targetObj,$target);
-+
-+    ## these are hardcoded because code sets them properly
-+    $targetObj->setAttributeField($target, "SCOM_SWITCHES", "reserved",   "0");
-+    $targetObj->setAttributeField($target, "SCOM_SWITCHES", "useFsiScom", "1");
-+    $targetObj->setAttributeField($target, "SCOM_SWITCHES", "useInbandScom",
-+        "0");
-+    $targetObj->setAttributeField($target, "SCOM_SWITCHES", "useXscom", "0");
-+
-+    processMembufVpdAssociation($targetObj,$target);
-+    setupBars($targetObj,$target);
-+}
-+
-+
-+sub processI2cSpeeds
-+{
-+    my $targetObj = shift;
-+    my $target    = shift;
-+
-+    my @bus_speeds;
-+    my $bus_speed_attr=$targetObj->getAttribute($target,"I2C_BUS_SPEED_ARRAY");
-+    my @bus_speeds2 = split(/,/,$bus_speed_attr);
-+    $bus_speeds[0][0] = $bus_speeds2[0];
-+    $bus_speeds[0][1] = $bus_speeds2[1];
-+    $bus_speeds[0][2] = $bus_speeds2[2];
-+    $bus_speeds[1][0] = $bus_speeds2[3];
-+    $bus_speeds[1][1] = $bus_speeds2[4];
-+    $bus_speeds[1][2] = $bus_speeds2[5];
-+
-+    my $i2cs=$targetObj->findConnections($target,"I2C","");
-+    if ($i2cs ne "") {
-+        foreach my $i2c (@{$i2cs->{CONN}}) {
-+            my $port=oct($targetObj->getAttribute($i2c->{SOURCE},"I2C_PORT"));
-+            my $engine=oct($targetObj->getAttribute(
-+                           $i2c->{SOURCE},"I2C_ENGINE"));
-+            my $bus_speed=$targetObj->getBusAttribute(
-+                  $i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_SPEED");
-+            if ($bus_speed eq "" || $bus_speed==0) {
-+                print "ERROR: I2C bus speed not defined for $i2c->{SOURCE}\n";
-+                $targetObj->myExit(3);
-+            }
-+            ## choose lowest bus speed
-+            if ($bus_speeds[$engine][$port] eq "" ||
-+                  $bus_speeds[$engine][$port]==0  ||
-+                  $bus_speed < $bus_speeds[$engine][$port]) {
-+                $bus_speeds[$engine][$port] = $bus_speed;
-+            }
-+        }
-+    }
-+    $bus_speed_attr = $bus_speeds[0][0].",".
-+                      $bus_speeds[0][1].",".
-+                      $bus_speeds[0][2].",".
-+                      $bus_speeds[1][0].",".
-+                      $bus_speeds[1][1].",".
-+                      $bus_speeds[1][2];
-+
-+    $targetObj->setAttribute($target,"I2C_BUS_SPEED_ARRAY",$bus_speed_attr);
-+}
-+
-+################################
-+## Setup address map
-+
-+sub setupBars
-+{
-+    my $targetObj = shift;
-+    my $target = shift;
-+    #--------------------------------------------------
-+    ## Setup BARs
-+
-+    my $node = $targetObj->getAttribute($target, "FABRIC_NODE_ID");
-+    my $proc   = $targetObj->getAttribute($target, "FABRIC_CHIP_ID");
-+    $targetObj->{TOPOLOGY}->{$node}->{$proc}++;
-+
-+    my @bars=("FSP_BASE_ADDR","PSI_BRIDGE_BASE_ADDR",
-+              "INTP_BASE_ADDR","PHB_BASE_ADDRS","PCI_BASE_ADDRS_32",
-+              "PCI_BASE_ADDRS_64","RNG_BASE_ADDR","IBSCOM_PROC_BASE_ADDR");
-+
-+    foreach my $bar (@bars)
-+    {
-+        my ($num,$base,$node_offset,$proc_offset,$offset) = split(/,/,
-+               $targetObj->getAttribute($target,$bar));
-+        my $i_base = Math::BigInt->new($base);
-+        my $i_node_offset = Math::BigInt->new($node_offset);
-+        my $i_proc_offset = Math::BigInt->new($proc_offset);
-+        my $i_offset = Math::BigInt->new($offset);
-+
-+        my $value="";
-+        if ($num==0)
-+        {
-+            $value=$base;
-+        }
-+        else
-+        {
-+            for (my $i=0;$i<$num;$i++)
-+            {
-+                my $b=sprintf("0x%016X",
-+         $i_base+$i_node_offset*$node+$i_proc_offset*$proc+$i_offset*$i);
-+                my $sep=",";
-+                if ($i==$num-1) 
-+                {
-+                    $sep="";
-+                }
-+                $value=$value.$b.$sep;
-+            }
-+        }
-+        $targetObj->setAttribute($target,$bar,$value);
-+    }
-+}
-+
-+#--------------------------------------------------
-+## MCS
-+##
-+sub processMcs
-+{
-+    my $targetObj    = shift;
-+    my $target       = shift;
-+    my $parentTarget = shift;
-+
-+    my $node = $targetObj->getAttribute($parentTarget, "FABRIC_NODE_ID");
-+    my $proc   = $targetObj->getAttribute($parentTarget, "FABRIC_CHIP_ID");
-+
-+    my ($base,$node_offset,$proc_offset,$offset) = split(/,/,
-+               $targetObj->getAttribute($target,"IBSCOM_MCS_BASE_ADDR"));
-+    my $i_base = Math::BigInt->new($base);
-+    my $i_node_offset = Math::BigInt->new($node_offset);
-+    my $i_proc_offset = Math::BigInt->new($proc_offset);
-+    my $i_offset = Math::BigInt->new($offset);
-+
-+    my $mcs = $targetObj->getAttribute($target, "MCS_NUM");
-+    my $mcsStr=sprintf("0x%016X",   
-+         $i_base+$i_node_offset*$node+$i_proc_offset*$proc+$i_offset*$mcs);
-+    $targetObj->setAttribute($target, "IBSCOM_MCS_BASE_ADDR", $mcsStr);
-+}
-+
-+
-+#--------------------------------------------------
-+## XBUS
-+##
-+## Finds XBUS connections and creates PEER TARGET attributes
-+
-+sub processXbus
-+{
-+    my $targetObj = shift;
-+    my $target    = shift;
-+
-+    # $targetObj->setAttribute($target, "PEER_TARGET","");
-+  
-+}
-+
-+#--------------------------------------------------
-+## ABUS
-+##
-+## Finds ABUS connections and creates PEER TARGET attributes
-+
-+sub processAbus
-+{
-+    my $targetObj = shift;
-+    my $target    = shift;
-+
-+    my $found_abus = 0;
-+   $targetObj->setAttribute($target, "PEER_PATH","physical:na");
-+   $targetObj->setAttribute($target, "EI_BUS_TX_LANE_INVERT","0");
-+   $targetObj->setAttribute($target, "EI_BUS_TX_MSBSWAP","0");
-+   # $targetObj->setAttribute($target, "PEER_TARGET","");
-+            
-+    my $abus_child_conn = $targetObj->getFirstConnectionDestination($target);
-+    if ($abus_child_conn ne "")
-+    {
-+        ## set attributes for both directions
-+        my $aff1 = $targetObj->getAttribute($target, "AFFINITY_PATH");
-+        my $aff2 = $targetObj->getAttribute($abus_child_conn, "AFFINITY_PATH");
-+
-+        $targetObj->setAttribute($abus_child_conn, "PEER_TARGET",
-+            $targetObj->getAttribute($target, "PHYS_PATH"));
-+        $targetObj->setAttribute($target, "PEER_TARGET",
-+            $targetObj->getAttribute($abus_child_conn, "PHYS_PATH"));
-+
-+        $targetObj->setAttribute($abus_child_conn, "PEER_PATH",
-+            $targetObj->getAttribute($target, "PHYS_PATH"));
-+        $targetObj->setAttribute($target, "PEER_PATH",
-+            $targetObj->getAttribute($abus_child_conn, "PHYS_PATH"));
-+
-+        # copy Abus attributes to proc
-+        my $abus = $targetObj->getFirstConnectionBus($target);
-+        $targetObj->setAttribute($target, "EI_BUS_TX_LANE_INVERT",
-+            $abus->{bus_attribute}->{SOURCE_TX_LANE_INVERT}->{default});
-+        $targetObj->setAttribute($target, "EI_BUS_TX_MSBSWAP",
-+            $abus->{bus_attribute}->{SOURCE_TX_MSBSWAP}->{default});
-+        $targetObj->setAttribute($abus_child_conn, "EI_BUS_TX_LANE_INVERT",
-+            $abus->{bus_attribute}->{DEST_TX_LANE_INVERT}->{default});
-+        $targetObj->setAttribute($abus_child_conn, "EI_BUS_TX_MSBSWAP",
-+            $abus->{bus_attribute}->{DEST_TX_MSBSWAP}->{default});
-+        $found_abus = 1;
-+    }
-+}
-+
-+#--------------------------------------------------
-+## FSI
-+##
-+## Finds FSI connections and creates FSI MASTER attributes at endpoint target
-+
-+sub processFsi
-+{
-+    my $targetObj    = shift;
-+    my $target       = shift;
-+    my $parentTarget = shift;
-+    my $type         = $targetObj->getBusType($target);
-+
-+    ## fsi can only have 1 connection
-+    my $fsi_child_conn = $targetObj->getFirstConnectionDestination($target);
-+
-+    ## found something on other end
-+    if ($fsi_child_conn ne "")
-+    {
-+        my $fsi_link = $targetObj->getAttribute($target, "FSI_LINK");
-+        my $fsi_port = $targetObj->getAttribute($target, "FSI_PORT");
-+        my $cmfsi = $targetObj->getAttribute($target, "CMFSI");
-+        my $flip_port         = 0;
-+        my $proc_path = $targetObj->getAttribute($parentTarget,"PHYS_PATH");
-+        my $fsi_child_target = $targetObj->getTargetParent($fsi_child_conn);
-+        $targetObj->setFsiAttributes($fsi_child_target,
-+                    $type,$cmfsi,$proc_path,$fsi_port,$flip_port);
-+    }
-+}
-+
-+#--------------------------------------------------
-+## PCIE
-+##
-+## Creates attributes from abstract PCI attributes on bus
-+
-+sub processPcie
-+{
-+    my $targetObj    = shift;
-+    my $target       = shift;
-+    my $parentTarget = shift;
-+
-+
-+    ## process pcie config target
-+    ## this is a special target whose children are the different ways
-+    ## to configure iop/phb's
-+
-+    # TODO RTC: TBD
-+    # add a 3rd IOP for Naples
-+
-+    ## Get config children
-+    my @lane_swap;
-+    $lane_swap[0][0] = 0;
-+    $lane_swap[0][1] = 0;
-+    $lane_swap[1][0] = 0;
-+    $lane_swap[1][1] = 0;
-+
-+    my @lane_mask;
-+    $lane_mask[0][0] = "0x0000";
-+    $lane_mask[0][1] = "0x0000";
-+    $lane_mask[1][0] = "0x0000";
-+    $lane_mask[1][1] = "0x0000";
-+
-+    my @lane_rev;
-+    $lane_rev[0][0] = "";
-+    $lane_rev[0][1] = "";
-+    $lane_rev[1][0] = "";
-+    $lane_rev[1][1] = "";
-+
-+    my @is_slot;
-+    $is_slot[0][0] = 0;
-+    $is_slot[0][1] = 0;
-+    $is_slot[1][0] = 0;
-+    $is_slot[1][1] = 0;
-+
-+    my $phb_config = "00000000";
-+
-+    my %cfg_check;
-+    my @equalization;
-+
-+    my $wiring_table = $targetObj->getAttribute($target,"PCIE_LANE_SWAP_TABLE");
-+    $wiring_table=~s/\s+//g;
-+    $wiring_table=~s/\t+//g;
-+    $wiring_table=~s/\n+//g;
-+
-+    my @t = split(/,/,$wiring_table);
-+    my %iop_swap;
-+
-+    #iop_swap{iop}{clk swap}{clk group reversal}
-+    $iop_swap{0}{0}{'00'}=$t[0];
-+    $iop_swap{0}{0}{'01'}=$t[1];
-+    $iop_swap{0}{0}{'10'}=$t[2];
-+    $iop_swap{0}{0}{'11'}=$t[3];
-+    $iop_swap{0}{1}{'00'}=$t[4];
-+    $iop_swap{0}{1}{'01'}=$t[5];
-+    $iop_swap{0}{1}{'10'}=$t[6];
-+    $iop_swap{0}{1}{'11'}=$t[7];
-+
-+    $iop_swap{1}{0}{'00'}=$t[8];
-+    $iop_swap{1}{0}{'01'}=$t[9];
-+    $iop_swap{1}{0}{'10'}=$t[10];
-+    $iop_swap{1}{0}{'11'}=$t[11];
-+    $iop_swap{1}{1}{'00'}=$t[12];
-+    $iop_swap{1}{1}{'01'}=$t[13];
-+    $iop_swap{1}{1}{'10'}=$t[14];
-+    $iop_swap{1}{1}{'11'}=$t[15];
-+
-+    my @lane_eq;
-+    my $NUM_PHBS=4;
-+    for (my $p=0;$p<$NUM_PHBS;$p++)
-+    {
-+        for (my $lane=0;$lane<16;$lane++)
-+        {
-+           $equalization[$p][$lane] = "0x00,0x00";
-+        }
-+    }
-+    my $found=0;
-+    foreach my $child (@{ $targetObj->getTargetChildren($target) })
-+    {
-+        my $num_connections = $targetObj->getNumConnections($child);
-+        if ($num_connections > 0)
-+        {
-+            $found=1;
-+            my $pci_endpoint=$targetObj->getFirstConnectionDestination($child);
-+
-+            my $bus = $targetObj->getConnectionBus($target, 0);
-+            my $iop_num = $targetObj->getAttribute($child, "IOP_NUM");
-+            my $swap_clks=$targetObj->getBusAttribute($child, 0,
-+                         "PCIE_SWAP_CLKS");
-+
-+            my $lane_rev=$targetObj->getBusAttribute($child, 0,
-+                         "LANE_REVERSAL");
-+
-+            my $phb_num = $targetObj->getAttribute($child, "PHB_NUM");
-+            my $lane_set = $targetObj->getAttribute($child, "PCIE_LANE_SET");
-+            my $capi = $targetObj->getAttribute($child, "ENABLE_CAPI");
-+
-+            my $pci_endpoint_type =
-+              $targetObj->getAttribute(
-+                $targetObj->getTargetParent($pci_endpoint), "CLASS");
-+
-+            if ($pci_endpoint_type eq "CARD")
-+            {
-+                $is_slot[$iop_num][$lane_set] = 1;
-+            }
-+            $lane_swap[$iop_num][$lane_set] =
-+              $targetObj->getBusAttribute($child, 0, "PCIE_SWAP_CLKS");
-+            $lane_mask[$iop_num][$lane_set] =
-+              $targetObj->getAttribute($child, "PCIE_LANE_MASK");
-+            $lane_rev[$iop_num][$lane_set] =
-+              $targetObj->getBusAttribute($child, 0, "LANE_REVERSAL");
-+            my $eq = $targetObj->getBusAttribute($child, 0,
-+              "PCIE_LANE_EQUALIZATION");
-+            my @eqs = split(/\,/,$eq);
-+            for (my $e=0;$e<@eqs;$e=$e+3)
-+            {
-+                if ($eqs[$e] eq "all")
-+                {
-+                    for (my $lane=0;$lane<16;$lane++)
-+                    {
-+                        $equalization[$phb_num][$lane]=$eqs[$e+1].",".$eqs[$e+2];
-+                    }                    
-+                }
-+                else
-+                {
-+                    $equalization[$phb_num][$eqs[$e]] = $eqs[$e+1].",".$eqs[$e+2];
-+                }
-+            }
-+            substr($phb_config, $phb_num, 1, "1");
-+        }
-+    }
-+    if ($found)
-+    {
-+    my $hex = sprintf('%X', oct("0b$phb_config"));
-+
-+    $targetObj->setAttribute($parentTarget, "PROC_PCIE_PHB_ACTIVE","0x" . $hex);
-+    my $lane_mask_attr = sprintf("%s,%s,%s,%s",
-+        $lane_mask[0][0], $lane_mask[0][1],
-+        $lane_mask[1][0], $lane_mask[1][1]);
-+    $targetObj->setAttribute($parentTarget, "PROC_PCIE_LANE_MASK",
-+        $lane_mask_attr);
-+    $targetObj->setAttribute($parentTarget,"PROC_PCIE_LANE_MASK_NON_BIFURCATED",
-+        $lane_mask_attr);
-+    $targetObj->setAttribute($parentTarget, "PROC_PCIE_LANE_MASK_BIFURCATED",
-+        "0,0,0,0");
-+
-+    my @iop_swap_lu;
-+    my @iop_lane_swap;
-+    for (my $iop=0;$iop<2;$iop++)
-+    {
-+        $iop_lane_swap[$iop] = $lane_swap[$iop][0] | $lane_swap[$iop][1];
-+        my $lane_rev = $lane_rev[$iop][0].$lane_rev[$iop][1];
-+        $iop_swap_lu[$iop]=
-+                 "0b".$iop_swap{$iop}{$iop_lane_swap[$iop]}{$lane_rev};
-+        if ($iop_swap_lu[$iop] eq "") {
-+          die "PCIE config for $iop,$iop_lane_swap[$iop],$lane_rev not found\n";
-+        }
-+    }
-+    my $lane_swap_attr0 = sprintf("%s,%s",$iop_lane_swap[0],
-+                          $iop_lane_swap[1]);
-+    my $lane_swap_attr1 = sprintf("%s,0,%s,0",$iop_lane_swap[0],
-+                          $iop_lane_swap[1]);
-+
-+    $targetObj->setAttribute($parentTarget, "PROC_PCIE_IOP_SWAP",
-+        $lane_swap_attr0);
-+    $targetObj->setAttribute($parentTarget, "PROC_PCIE_IOP_SWAP_NON_BIFURCATED",
-+        $lane_swap_attr1);
-+    $targetObj->setAttribute($parentTarget, "PROC_PCIE_IOP_SWAP_BIFURCATED",
-+        "0,0,0,0");
-+
-+    my $lane_rev_attr = sprintf("%s,0,%s,0",
-+                         oct($iop_swap_lu[0]),oct($iop_swap_lu[1]));
-+
-+    $targetObj->setAttribute($parentTarget, "PROC_PCIE_IOP_REVERSAL",
-+        $lane_rev_attr);
-+    $targetObj->setAttribute($parentTarget,
-+        "PROC_PCIE_IOP_REVERSAL_NON_BIFURCATED",$lane_rev_attr);
-+    $targetObj->setAttribute($parentTarget, "PROC_PCIE_IOP_REVERSAL_BIFURCATED",
-+        "0,0,0,0");
-+
-+    my $is_slot_attr = sprintf("%s,%s,%s,%s",
-+        $is_slot[0][0], $is_slot[0][1], $is_slot[1][0], $is_slot[1][1]);
-+    $targetObj->setAttribute($parentTarget, "PROC_PCIE_IS_SLOT", $is_slot_attr);
-+
-+    ## don't support DSMP
-+    $targetObj->setAttribute($parentTarget, "PROC_PCIE_DSMP_CAPABLE","0,0,0,0");
-+    my $eq_str="";
-+    for (my $p=0;$p<$NUM_PHBS;$p++)
-+    {
-+        for (my $lane=0;$lane<16;$lane++)
-+        {
-+            $eq_str=$eq_str.$equalization[$p][$lane].",";
-+        }
-+    }
-+    $eq_str = substr($eq_str,0,length($eq_str)-1);
-+    $targetObj->setAttribute($parentTarget,"PROC_PCIE_LANE_EQUALIZATION",
-+         $eq_str);
-+    }
-+}
-+#--------------------------------------------------
-+## OCC
-+##
-+sub processOcc
-+{
-+    my $targetObj    = shift;
-+    my $target       = shift;
-+    my $parentTarget = shift;
-+    my $master_capable=0;
-+    if ($parentTarget eq $targetObj->getMasterProc())
-+    {
-+        $master_capable=1;
-+    }
-+    $targetObj->setAttribute($target,"OCC_MASTER_CAPABLE",$master_capable);
-+}
-+
-+sub processMembufVpdAssociation
-+{
-+    my $targetObj = shift;
-+    my $target    = shift;
-+    
-+    my $vpds=$targetObj->findConnections($target,"I2C","VPD");
-+    if ($vpds ne "" ) {
-+        my $vpd = $vpds->{CONN}->[0];
-+
-+        my $membuf_assocs=$targetObj->findConnections($vpd->{DEST_PARENT},
-+                          "LOGICAL_ASSOCIATION","MEMBUF");
-+        if ($membuf_assocs ne "") {
-+            foreach my $membuf_assoc (@{$membuf_assocs->{CONN}}) {
-+                my $membuf_target = $membuf_assoc->{DEST_PARENT};
-+                setEepromAttributes($targetObj,
-+                       "EEPROM_VPD_PRIMARY_INFO",$membuf_target,$vpd);
-+                setEepromAttributes($targetObj,
-+                       "EEPROM_VPD_FRU_INFO",$membuf_target,$vpd,"0++");       
-+                my $index = $targetObj->getBusAttribute($membuf_assoc->{SOURCE},
-+                                $membuf_assoc->{BUS_NUM}, "ISDIMM_MBVPD_INDEX");
-+                $targetObj->setAttribute(
-+                            $membuf_target,"ISDIMM_MBVPD_INDEX",$index);
-+            }
-+        }
-+    }
-+}
-+
-+#--------------------------------------------------
-+## MEMBUF
-+##
-+## Finds I2C connections to DIMM and creates EEPROM attributes
-+## FYI:  I had to handle DMI busses in framework because they
-+## define affinity path
-+
-+sub processMembuf
-+{
-+    my $targetObj = shift;
-+    my $target    = shift;
-+    if ($targetObj->isBadAttribute($target, "PHYS_PATH", "")) 
-+    { 
-+        ##dmi is probably not connected.  will get caught in error checking
-+        return;
-+    }
-+
-+    processMembufVpdAssociation($targetObj,$target);
-+
-+    ## finds which gpio expander that controls vddr regs for membufs
-+    my $gpioexp=$targetObj->findConnections($target,"I2C","GPIO_EXPANDER");
-+    if ($gpioexp ne "" ) {
-+        my $vreg=$targetObj->findConnections(
-+            $gpioexp->{CONN}->[0]->{DEST_PARENT},"GPIO","VOLTAGE_REGULATOR");
-+        if ($vreg ne "") {
-+            my $vddPin = $targetObj->getAttribute(
-+                 $vreg->{CONN}->[0]->{SOURCE},"CHIP_UNIT");
-+            my $membufs=$targetObj->findConnections(
-+               $vreg->{CONN}->[0]->{DEST_PARENT},"POWER","MEMBUF");
-+            if ($membufs ne "") {
-+                foreach my $membuf (@{$membufs->{CONN}}) {
-+                    my $aff = $targetObj->getAttribute($membuf->{DEST_PARENT},
-+                        "PHYS_PATH");
-+                    setGpioAttributes($targetObj,$membuf->{DEST_PARENT},
-+                        $gpioexp->{CONN}->[0],$vddPin);
-+
-+                }
-+            }
-+        }
-+    }
-+    ## find port mapping
-+    my %dimm_portmap;
-+    foreach my $child (@{$targetObj->getTargetChildren($target)})
-+    {
-+         if ($targetObj->getType($child) eq "MBA")
-+         {
-+             my $mba_num = $targetObj->getAttribute($child,"MBA_NUM");
-+             my $dimms=$targetObj->findConnections($child,"DDR3","");
-+             if ($dimms ne "")
-+             {
-+                 foreach my $dimm (@{$dimms->{CONN}})
-+                 {
-+                       my $port_num = $targetObj->getAttribute(
-+                                     $dimm->{SOURCE},"MBA_PORT");
-+                       my $dimm_num = $targetObj->getAttribute(
-+                                     $dimm->{SOURCE},"MBA_DIMM");
-+                       
-+                       my $map = oct("0b".$mba_num.$port_num.$dimm_num);
-+                       $dimm_portmap{$dimm->{DEST_PARENT}} = $map;
-+                 }
-+             }
-+         }
-+    }
-+    
-+    
-+    ## Process MEMBUF to DIMM I2C connections
-+    my @addr_map=('0','0','0','0','0','0','0','0');
-+    my $dimms=$targetObj->findConnections($target,"I2C","SPD");
-+    if ($dimms ne "") {
-+        foreach my $dimm (@{$dimms->{CONN}}) {
-+            my $dimm_target = $targetObj->getTargetParent($dimm->{DEST_PARENT});
-+            setEepromAttributes($targetObj,
-+                       "EEPROM_VPD_PRIMARY_INFO",$dimm_target,
-+                       $dimm);
-+            setEepromAttributes($targetObj,
-+                       "EEPROM_VPD_FRU_INFO",$dimm_target,
-+                       $dimm,"0++");
-+
-+            my $field=getI2cMapField($targetObj,$dimm_target,$dimm);
-+            my $map = $dimm_portmap{$dimm_target};
-+            if ($map eq "") { 
-+                print "ERROR: $dimm_target doesn't map to a dimm/port\n";
-+                $targetObj->myExit(3);
-+            }
-+            $addr_map[$map] = $field;
-+        }
-+    }
-+    $targetObj->setAttribute($targetObj->{targeting}->{SYS}[0]->{KEY},
-+            "MRW_MEM_SENSOR_CACHE_ADDR_MAP","0x".join("",@addr_map));
-+
-+    ## Update bus speeds
-+    processI2cSpeeds($targetObj,$target);
-+
-+    ## Do MBA port mapping
-+    my %mba_port_map;
-+    my $ddrs=$targetObj->findConnections($target,"DDR3","DIMM");
-+    if ($ddrs ne "") {
-+        my %portmap;
-+        foreach my $ddr (@{$ddrs->{CONN}}) {
-+            my $mba=$ddr->{SOURCE};
-+            my $dimm=$ddr->{DEST_PARENT};
-+            my ($dimmnum,$port)=split(//,sprintf("%02b\n",$portmap{$mba}));        
-+            $targetObj->setAttribute($dimm, "MBA_DIMM",$dimmnum);
-+            $targetObj->setAttribute($dimm, "MBA_PORT",$port);
-+            $portmap{$mba}++;
-+
-+            ## Copy connector attributes
-+            my $dimmconn=$targetObj->getTargetParent($dimm);
-+        }
-+    }
-+}
-+
-+sub getI2cMapField
-+{
-+    my $targetObj = shift;
-+    my $target = shift;
-+    my $conn_target = shift;
-+
-+
-+    my $port = $targetObj->getAttribute($conn_target->{SOURCE}, "I2C_PORT");
-+    my $engine = $targetObj->getAttribute($conn_target->{SOURCE}, "I2C_ENGINE");
-+    my $addr = $targetObj->getBusAttribute($conn_target->{SOURCE},
-+            $conn_target->{BUS_NUM}, "I2C_ADDRESS");
-+    
-+    my $bits=sprintf("%08b",hex($addr));
-+    my $field=sprintf("%d%3s",oct($port),substr($bits,4,3));
-+    my $hexfield = sprintf("%X",oct("0b$field"));
-+    return $hexfield;
-+}
-+
-+
-+sub setEepromAttributes
-+{
-+    my $targetObj = shift;
-+    my $name = shift;
-+    my $target = shift;
-+    my $conn_target = shift;
-+    my $fru = shift;
-+
-+    my $port = $targetObj->getAttribute($conn_target->{SOURCE}, "I2C_PORT");
-+    my $engine = $targetObj->getAttribute($conn_target->{SOURCE}, "I2C_ENGINE");
-+    my $addr = $targetObj->getBusAttribute($conn_target->{SOURCE},
-+            $conn_target->{BUS_NUM}, "I2C_ADDRESS");
-+
-+    my $path = $targetObj->getAttribute($conn_target->{SOURCE_PARENT},
-+               "PHYS_PATH");
-+    my $mem  = $targetObj->getAttribute($conn_target->{DEST_PARENT},
-+               "MEMORY_SIZE_IN_KB");
-+    my $cycle  = $targetObj->getAttribute($conn_target->{DEST_PARENT},
-+               "WRITE_CYCLE_TIME");
-+    my $page  = $targetObj->getAttribute($conn_target->{DEST_PARENT},
-+               "WRITE_PAGE_SIZE");
-+    my $offset  = $targetObj->getAttribute($conn_target->{DEST_PARENT},
-+               "BYTE_ADDRESS_OFFSET");
-+
-+    $targetObj->setAttributeField($target, $name, "i2cMasterPath", $path);
-+    $targetObj->setAttributeField($target, $name, "port", $port);
-+    $targetObj->setAttributeField($target, $name, "devAddr", $addr);
-+    $targetObj->setAttributeField($target, $name, "engine", $engine);
-+    $targetObj->setAttributeField($target, $name, "byteAddrOffset", $offset);
-+    $targetObj->setAttributeField($target, $name, "maxMemorySizeKB", $mem);
-+    $targetObj->setAttributeField($target, $name, "writePageSize", $page);
-+    $targetObj->setAttributeField($target, $name, "writeCycleTime", $cycle);
-+
-+    if ($fru ne "")
-+    {
-+        $targetObj->setAttributeField($target, $name, "fruId", $fru);
-+    }
-+}
-+
-+
-+sub setGpioAttributes
-+{
-+    my $targetObj = shift;
-+    my $target = shift;
-+    my $conn_target = shift;
-+    my $vddrPin = shift;
-+
-+    my $port = $targetObj->getAttribute($conn_target->{SOURCE}, "I2C_PORT");
-+    my $engine = $targetObj->getAttribute($conn_target->{SOURCE}, "I2C_ENGINE");
-+    my $addr = $targetObj->getBusAttribute($conn_target->{SOURCE},
-+            $conn_target->{BUS_NUM}, "I2C_ADDRESS");
-+    my $path = $targetObj->getAttribute($conn_target->{SOURCE_PARENT}, 
-+               "PHYS_PATH");
-+
-+
-+    my $name="GPIO_INFO";
-+    $targetObj->setAttributeField($target, $name, "i2cMasterPath", $path);
-+    $targetObj->setAttributeField($target, $name, "port", $port);
-+    $targetObj->setAttributeField($target, $name, "devAddr", $addr);
-+    $targetObj->setAttributeField($target, $name, "engine", $engine);
-+    $targetObj->setAttributeField($target, $name, "vddrPin", $vddrPin);
-+}
-+
-+#--------------------------------------------------
-+## ERROR checking
-+sub errorCheck
-+{
-+    my $targetObj = shift;
-+    my $target    = shift;
-+    my $type      = $targetObj->getType($target);
-+
-+    ## error checking even for connections are done with attribute checks
-+    ##  since connections simply create attributes at source and/or destination
-+    ##
-+    ## also error checking after processing is complete vs during
-+    ## processing is easier
-+    my %attribute_checks = (
-+        SYS         => ['SYSTEM_NAME','OPAL_MODEL'],
-+        PROC_MASTER => ['I2C_SLAVE_ADDRESS'],
-+        PROC        => ['FSI_MASTER_CHIP','I2C_SLAVE_ADDRESS'],
-+        MEMBUF => [ 'PHYS_PATH', 'EI_BUS_TX_MSBSWAP', 'FSI_MASTER_PORT|0xFF' ],
-+        DIMM   => ['EEPROM_VPD_PRIMARY_INFO/devAddr'],
-+    );
-+    my %error_msg = (
-+        'EEPROM_VPD_PRIMARY_INFO/devAddr' =>
-+          'I2C connection to target is not defined',
-+        'FSI_MASTER_PORT' => 'This target is missing a required FSI connection',
-+        'FSI_MASTER_CHIP' => 'This target is missing a required FSI connection',
-+        'EI_BUS_TX_MSBSWAP' =>
-+          'DMI connection is missing to this membuf from processor',
-+        'PHYS_PATH' =>'DMI connection is missing to this membuf from processor',
-+        'I2C_SLAVE_ADDRESS' =>'I2C connection is missing from BMC to processor',
-+    );
-+
-+    my @errors;
-+    if ($targetObj->getMasterProc() eq $target)
-+    {
-+        $type = "PROC_MASTER";
-+    }
-+    foreach my $attr (@{ $attribute_checks{$type} })
-+    {
-+        my ($a,         $v)     = split(/\|/, $attr);
-+        my ($a_complex, $field) = split(/\//, $a);
-+        if ($field ne "")
-+        {
-+            if ($targetObj->isBadComplexAttribute(
-+                    $target, $a_complex, $field, $v) )
-+            {
-+                push(@errors,sprintf(
-+                        "$a attribute is invalid (Target=%s)\n\t%s\n",
-+                        $target, $error_msg{$a}));
-+            }
-+        }
-+        else
-+        {
-+            if ($targetObj->isBadAttribute($target, $a, $v))
-+            {
-+                push(@errors,sprintf(
-+                        "$a attribute is invalid (Target=%s)\n\t%s\n",
-+                        $target, $error_msg{$a}));
-+            }
-+        }
-+    }
-+    if ($type eq "PROC")
-+    {
-+        ## note: DMI is checked on membuf side so don't need to check that here
-+        ## this checks if at least 1 abus is connected
-+        my $found_abus = 0;
-+        my $abus_error = "";
-+        foreach my $child (@{ $targetObj->getTargetChildren($target) })
-+        {
-+            my $child_type = $targetObj->getBusType($child);
-+            if ($child_type eq "ABUS" || $child_type eq "XBUS")
-+            {
-+                if ($targetObj->getMasterProc() ne $target)
-+                {
-+                    if (!$targetObj->isBadAttribute($child, "PEER_TARGET"))
-+                    {
-+                        $found_abus = 1;
-+                    }
-+                    else
-+                    {
-+                        $abus_error = sprintf(
-+"proc not connected to proc via Abus or Xbus (Target=%s)",$child);
-+                    }
-+                }
-+            }
-+        }
-+        if ($found_abus)
-+        {
-+            $abus_error = "";
-+        }
-+        else
-+        {
-+            push(@errors, $abus_error);
-+        }
-+    }
-+    if ($errors[0])
-+    {
-+        foreach my $err (@errors)
-+        {
-+            print "ERROR: $err\n";
-+        }
-+        $targetObj->myExit(3);
-+    }
-+}
-+
-+sub printUsage
-+{
-+    print "
-+processMrwl.pl -x [XML filename] [OPTIONS]
-+Options:
-+        -f = force output file creation even when errors
-+        -d = debug mode
-+        -s [SDR XML file] = import SDRs
-+        -r = create report and save to [system_name].rpt
-+        -v = version
-+";
-+    exit(1);
-+}
--- 
-1.8.2.2
-
diff --git a/openpower/package/hostboot/hostboot-0004-revert-OCC-v3.patch b/openpower/package/hostboot/hostboot-0004-revert-OCC-v3.patch
new file mode 100644
index 0000000..5999ffc
--- /dev/null
+++ b/openpower/package/hostboot/hostboot-0004-revert-OCC-v3.patch
@@ -0,0 +1,205 @@
+From 4619901bd09eccbe26d430195c4e8019f6993b0b Mon Sep 17 00:00:00 2001
+From: Matt Ploetz <maploetz@us.ibm.com>
+Date: Mon, 23 Feb 2015 17:09:14 -0600
+Subject: [PATCH] Revert "Set FIR master in HOMER config data"
+
+This reverts commit 84023756531d9c48d2e4939326f4048f2dadbe28.
+---
+ src/include/usr/hwpf/hwp/occ/occ_common.H | 27 ++----------------
+ src/usr/diag/HBconfig                     |  6 ----
+ src/usr/hwpf/hwp/occ/occ.C                |  2 +-
+ src/usr/hwpf/hwp/occ/occ_common.C         | 46 +++++++++++++++++++------------
+ src/usr/hwpf/hwp/occ/runtime/rt_occ.C     |  2 +-
+ 5 files changed, 33 insertions(+), 50 deletions(-)
+
+diff --git a/src/include/usr/hwpf/hwp/occ/occ_common.H b/src/include/usr/hwpf/hwp/occ/occ_common.H
+index 8245539..1886e51 100644
+--- a/src/include/usr/hwpf/hwp/occ/occ_common.H
++++ b/src/include/usr/hwpf/hwp/occ/occ_common.H
+@@ -36,38 +36,19 @@ namespace HBOCC
+     struct occHostConfigDataArea_t
+     {
+         uint32_t version;
+-
+-        //For computation of timebase frequency
+         uint32_t nestFrequency;
+-
+-        // For determining the interrupt type to Host
+-        //  0x00000000 = Use FSI2HOST Mailbox
+-        //  0x00000001 = Use OCC interrupt line through PSIHB complex
+         uint32_t interruptType;
+-
+-        // For informing OCC if it is the FIR master:
+-        //  0x00000000 = Default
+-        //  0x00000001 = FIR Master
+-        uint32_t firMaster;
+-
+-        // FIR collection configuration data needed by FIR Master
+-        //  OCC in the event of a checkstop
+-        uint8_t firdataConfig[3072];
+     };
+ 
+     enum
+     {
+-        OccHostDataVersion = 3,
++        OccHostDataVersion = 2,
+         OCC_LIDID = 0x81e00430,
+         OCC_IBSCOM_RANGE_IN_MB = MEGABYTE,
+ 
+         // Interrupt Types
+         USE_FSI2HOST_MAILBOX = 0x00000000,
+-        USE_PSIHB_COMPLEX    = 0x00000001,
+-
+-        // FIR Master
+-        NOT_FIR_MASTER = 0x00000000,
+-        IS_FIR_MASTER  = 0x00000001
++        USE_PSIHB_COMPLEX    = 0x00000001
+     };
+ 
+     enum occAction_t
+@@ -78,15 +59,13 @@ namespace HBOCC
+     /**
+      * @brief Sets up OCC Host data
+      *
+-     * @param[in] i_proc:         target processor to load
+      * @param[in] i_occHostDataVirtAddr Virtual
+      *                       address of current
+      *                       proc's Host data area.
+      *
+      * @return errlHndl_t  Error log Host data setup failed
+      */
+-    errlHndl_t loadHostDataToHomer(TARGETING::Target* i_proc,
+-                                   void* i_occHostDataVirtAddr);
++    errlHndl_t loadHostDataToHomer(void* i_occHostDataVirtAddr);
+ 
+     /**
+      * @brief Execute procedures and steps required to load
+diff --git a/src/usr/diag/HBconfig b/src/usr/diag/HBconfig
+index 973cecd..a516133 100644
+--- a/src/usr/diag/HBconfig
++++ b/src/usr/diag/HBconfig
+@@ -2,9 +2,3 @@ config HBRT_PRD
+     default n
+     help
+         Enable HBRT PRD.
+-
+-config ENABLE_CHECKSTOP_ANALYSIS
+-    default n
+-    help
+-        Enable collection of FIR data by OCC for checkstops and
+-        post-checkstop analysis by PRD on system reboot
+diff --git a/src/usr/hwpf/hwp/occ/occ.C b/src/usr/hwpf/hwp/occ/occ.C
+index ac2f4b1..f56c909 100644
+--- a/src/usr/hwpf/hwp/occ/occ.C
++++ b/src/usr/hwpf/hwp/occ/occ.C
+@@ -133,7 +133,7 @@ namespace HBOCC
+                                            (i_homerVirtAddrBase) +
+                                 tmpOffset + HOMER_OFFSET_TO_OCC_HOST_DATA;
+             void* occHostVirt = reinterpret_cast<void*>(i_homerHostVirtAddr);
+-            l_errl = HBOCC::loadHostDataToHomer(i_target,occHostVirt);
++            l_errl = HBOCC::loadHostDataToHomer(occHostVirt);
+             if( l_errl != NULL )
+             {
+                 TRACFCOMP( g_fapiImpTd, ERR_MRK"loading Host Data Area failed!" );
+diff --git a/src/usr/hwpf/hwp/occ/occ_common.C b/src/usr/hwpf/hwp/occ/occ_common.C
+index e444b26..97d36f4 100644
+--- a/src/usr/hwpf/hwp/occ/occ_common.C
++++ b/src/usr/hwpf/hwp/occ/occ_common.C
+@@ -119,9 +119,14 @@ namespace HBOCC
+ 
+     /**
+      * @brief Sets up OCC Host data
++     *
++     * @param[in] i_occHostDataVirtAddr Virtual
++     *                       address of current
++     *                       proc's Host data area.
++     *
++     * @return errlHndl_t  Error log Host data setup failed
+      */
+-    errlHndl_t loadHostDataToHomer( TARGETING::Target* i_proc,
+-                                    void* i_occHostDataVirtAddr)
++    errlHndl_t loadHostDataToHomer(void* i_occHostDataVirtAddr)
+     {
+         TRACUCOMP( g_fapiTd,
+                    ENTER_MRK"loadHostDataToHomer(%p)",
+@@ -156,22 +161,6 @@ namespace HBOCC
+             config_data->interruptType = USE_PSIHB_COMPLEX;
+         }
+ 
+-#ifdef CONFIG_ENABLE_CHECKSTOP_ANALYSIS
+-        // Figure out the FIR master
+-        TARGETING::Target* masterproc = NULL;
+-        tS.masterProcChipTargetHandle( masterproc );
+-        if( masterproc == i_proc )
+-        {
+-            config_data->firMaster = IS_FIR_MASTER;
+-        }
+-        else
+-        {
+-            config_data->firMaster = NOT_FIR_MASTER;
+-        }
+-#else
+-        config_data->firMaster = 0;
+-#endif
+-
+         TRACUCOMP( g_fapiTd,
+                    EXIT_MRK"loadHostDataToHomer");
+ 
+@@ -181,6 +170,16 @@ namespace HBOCC
+     /**
+      * @brief Execute procedures and steps necessary
+      *        to load OCC data in specified processor
++     *
++     * @param[in] i_target   Target proc to load
++     * @param[in] i_homerVirtAddrBase Virtual
++     *                       address of current
++     *                       proc's HOMER
++     * @param[in] i_homerPhysAddrBase Physical
++     *                       address of current
++     *                       proc's HOMER
++     *
++     * @return errlHndl_t  Error log image load failed
+      */
+      errlHndl_t loadOCC(TARGETING::Target* i_target,
+                     uint64_t i_homerPhysAddr,
+@@ -300,6 +299,12 @@ namespace HBOCC
+      * @brief Start OCC for specified DCM pair of processors.
+      *        If 2nd input is NULL, OCC will be setup on just
+      *        one target.
++     *
++     * @param[in] i_target0:    target of first processor in DCM pair
++     * @param[in] i_target1:    target of second processor in DCM pair
++     * @param[out] o_failedTarget failed target in case of an error
++     *
++     * @return errlHndl_t  Error log of startOCC failed
+      */
+     errlHndl_t startOCC (Target* i_target0,
+                          Target* i_target1,
+@@ -418,6 +423,11 @@ namespace HBOCC
+      * @brief Stop OCC for specified DCM pair of processors.
+      *        If 2nd input is NULL, OCC will be setup on just
+      *        one target.
++     *
++     * @param[in] i_target0:    target of first processor in DCM pair
++     * @param[in] i_target1:    target of second processor in DCM pair
++     *
++     * @return errlHndl_t  Error log of stopOCC failed
+      */
+     errlHndl_t stopOCC(TARGETING::Target * i_target0,
+                        TARGETING::Target * i_target1)
+diff --git a/src/usr/hwpf/hwp/occ/runtime/rt_occ.C b/src/usr/hwpf/hwp/occ/runtime/rt_occ.C
+index 1bc02a8..8583801 100644
+--- a/src/usr/hwpf/hwp/occ/runtime/rt_occ.C
++++ b/src/usr/hwpf/hwp/occ/runtime/rt_occ.C
+@@ -179,7 +179,7 @@ namespace RT_OCC
+ 
+             void* occHostVirt = reinterpret_cast <void *> (i_homer_addr_va +
+                                 HOMER_OFFSET_TO_OCC_HOST_DATA);
+-            err = HBOCC::loadHostDataToHomer(proc_target,occHostVirt);
++            err = HBOCC::loadHostDataToHomer(occHostVirt);
+             if( err != NULL )
+             {
+                 TRACFCOMP( g_fapiImpTd, ERR_MRK"loading Host Data Area failed!" );
+-- 
+1.8.2.2
+
diff --git a/openpower/package/hostboot/hostboot-0005-Add-loop-fix-and-missing-include-to-attribute-overri.patch b/openpower/package/hostboot/hostboot-0005-Add-loop-fix-and-missing-include-to-attribute-overri.patch
deleted file mode 100644
index d781d33..0000000
--- a/openpower/package/hostboot/hostboot-0005-Add-loop-fix-and-missing-include-to-attribute-overri.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 7a51e37d5d7672fbef3a8f3c4a11a652ded9241a Mon Sep 17 00:00:00 2001
-From: Andres Lugo-Reyes <aalugore@us.ibm.com>
-Date: Mon, 16 Feb 2015 10:16:48 -0600
-Subject: [PATCH] Add loop fix and missing include to attribute override tool.
-
-Change-Id: I451d905d96822a151aa7966d31d27353bebbe953
-Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15757
-Tested-by: Jenkins Server
-Reviewed-by: Brian Silver <bsilver@us.ibm.com>
-Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
----
- src/usr/targeting/attroverride/attrTextToBinaryBlob.C | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/src/usr/targeting/attroverride/attrTextToBinaryBlob.C b/src/usr/targeting/attroverride/attrTextToBinaryBlob.C
-index 10ef7bb..e4b3330 100755
---- a/src/usr/targeting/attroverride/attrTextToBinaryBlob.C
-+++ b/src/usr/targeting/attroverride/attrTextToBinaryBlob.C
-@@ -48,6 +48,7 @@
- #include <stdio.h>
- #include <arpa/inet.h>
- #include <endian.h>
-+#include <unistd.h>
- #include <hwpf/fapi/fapiTarget.H>
- #include <attributeenums.H>
- #include <pnor/ecc.H>
-@@ -1024,7 +1025,7 @@ bool AttrTextToBinaryBlob::getAttrDataFromMap(const char * i_attrString,
- 
-         o_attrId = currentAttr->iv_attrId;
-         o_attrElemSizeBytes = currentAttr->iv_attrElemSizeBytes;
--        for(size_t i = 0; i < sizeof(o_dims)/sizeof(uint32_t); ++i)
-+        for(size_t i = 0; i < sizeof(o_dims)/sizeof(size_t); ++i)
-         {
-             o_dims[i] = currentAttr->iv_dims[i];
-         }
--- 
-2.1.1
-
diff --git a/openpower/package/hostboot/hostboot.mk b/openpower/package/hostboot/hostboot.mk
index 8eaf3c9..7e1af21 100644
--- a/openpower/package/hostboot/hostboot.mk
+++ b/openpower/package/hostboot/hostboot.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-HOSTBOOT_VERSION ?= 44fde6512e834ea8f5071299ca99b35973c0f979
+HOSTBOOT_VERSION ?= 7894fc7b2f7e848267b4f3666f5d8410ea9b894a
 HOSTBOOT_SITE ?= $(call github,open-power,hostboot,$(HOSTBOOT_VERSION))
 
 HOSTBOOT_LICENSE = Apache-2.0
diff --git a/openpower/package/occ/occ.mk b/openpower/package/occ/occ.mk
index 728a941..cbabb94 100644
--- a/openpower/package/occ/occ.mk
+++ b/openpower/package/occ/occ.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-OCC_VERSION ?= 0a19fa3049ce60d8d9f5905cd05c1018cbdfb253
+OCC_VERSION ?= 2adf5f493db7436dd0df0fcb846c16b93dd1f374
 OCC_SITE ?= $(call github,open-power,occ,$(OCC_VERSION))
 OCC_LICENSE = Apache-2.0
 OCC_DEPENDENCIES = host-binutils host-p8-pore-binutils
diff --git a/openpower/package/openpower-pnor/openpower-pnor.mk b/openpower/package/openpower-pnor/openpower-pnor.mk
index 63dc69a..15e4417 100644
--- a/openpower/package/openpower-pnor/openpower-pnor.mk
+++ b/openpower/package/openpower-pnor/openpower-pnor.mk
@@ -8,7 +8,7 @@
 # make doesn't care for quotes in the dependencies.
 XML_PACKAGE=$(subst $\",,$(BR2_OPENPOWER_XML_PACKAGE))
 
-OPENPOWER_PNOR_VERSION ?= f2dd4340228d1287a2622faffdfecebce9a321dd
+OPENPOWER_PNOR_VERSION ?= 94389f62eabecf00ef129b4184bf4ba2bc9cd193
 OPENPOWER_PNOR_SITE ?= $(call github,open-power,pnor,$(OPENPOWER_PNOR_VERSION))
 
 OPENPOWER_PNOR_LICENSE = Apache-2.0
diff --git a/openpower/package/p8-pore-binutils/p8-pore-binutils-0001-ld.texinfo-Replace-with-when-it-is-part-of-the-text.patch b/openpower/package/p8-pore-binutils/p8-pore-binutils-0001-ld.texinfo-Replace-with-when-it-is-part-of-the-text.patch
deleted file mode 100644
index c131ab9..0000000
--- a/openpower/package/p8-pore-binutils/p8-pore-binutils-0001-ld.texinfo-Replace-with-when-it-is-part-of-the-text.patch
+++ /dev/null
@@ -1,134 +0,0 @@
-From 7ca01ed925b6be550d5d46bd2f0a68bb3e63ff7b Mon Sep 17 00:00:00 2001
-From: Nick Clifton <nickc@redhat.com>
-Date: Mon, 7 Jan 2013 12:11:13 +0000
-Subject: [PATCH] 	* ld.texinfo: Replace @ with @@ when it is part of the
- text. 	Correct ordering of M68HC11 entry.
-
-	* doc/binutils.texi: Fix ordering of top level nodes.
-	Replace erroneous uses of @itemx with @item.
-
-	* bfd.texinfo: Replace @ with @@ when it is part of the text.
----
- bfd/doc/bfd.texinfo        | 12 +++++++-----
- binutils/doc/binutils.texi |  8 ++++----
- ld/ld.texinfo              | 26 ++++++++++++++------------
- 6 files changed, 39 insertions(+), 21 deletions(-)
-
-diff --git a/bfd/doc/bfd.texinfo b/bfd/doc/bfd.texinfo
-index 45ffa73..3aa3300 100644
---- a/bfd/doc/bfd.texinfo
-+++ b/bfd/doc/bfd.texinfo
-@@ -322,7 +324,7 @@ All of BFD lives in one directory.
- @printindex cp
- 
- @tex
--% I think something like @colophon should be in texinfo.  In the
-+% I think something like @@colophon should be in texinfo.  In the
- % meantime:
- \long\def\colophon{\hbox to0pt{}\vfill
- \centerline{The body of this manual is set in}
-@@ -333,7 +335,7 @@ All of BFD lives in one directory.
- \centerline{{\sl\fontname\tensl\/}}
- \centerline{are used for emphasis.}\vfill}
- \page\colophon
--% Blame: doc@cygnus.com, 28mar91.
-+% Blame: doc@@cygnus.com, 28mar91.
- @end tex
- 
- @bye
-diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi
-index 56a0510..fb1802b 100644
---- a/binutils/doc/binutils.texi
-+++ b/binutils/doc/binutils.texi
-@@ -148,18 +148,18 @@ in the section entitled ``GNU Free Documentation License''.
- * objcopy::			Copy and translate object files
- * objdump::                     Display information from object files
- * ranlib::                      Generate index to archive contents
--* readelf::                     Display the contents of ELF format files
- * size::                        List section sizes and total size
- * strings::                     List printable strings from files
- * strip::                       Discard symbols
--* elfedit::                     Update the ELF header of ELF files
- * c++filt::			Filter to demangle encoded C++ symbols
- * cxxfilt: c++filt.             MS-DOS name for c++filt
- * addr2line::			Convert addresses to file and line
- * nlmconv::                     Converts object code into an NLM
--* windres::			Manipulate Windows resources
- * windmc::			Generator for Windows message resources
-+* windres::			Manipulate Windows resources
- * dlltool::			Create files needed to build and use DLLs
-+* readelf::                     Display the contents of ELF format files
-+* elfedit::                     Update the ELF header of ELF files
- * Common Options::              Command-line options for all utilities
- * Selecting the Target System:: How these utilities determine the target
- * Reporting Bugs::              Reporting Bugs
-@@ -2907,7 +2907,7 @@ the Info entries for @file{binutils}.
- @c man end
- @end ignore
- 
--@node c++filt, addr2line, elfedit, Top
-+@node c++filt, addr2line, strip, Top
- @chapter c++filt
- 
- @kindex c++filt
-diff --git a/ld/ld.texinfo b/ld/ld.texinfo
-index c7ae2a5..4777ad5 100644
---- a/ld/ld.texinfo
-+++ b/ld/ld.texinfo
-@@ -142,12 +144,12 @@ in the section entitled ``GNU Free Documentation License''.
- @ifset ARM
- * ARM::				ld and the ARM family
- @end ifset
--@ifset HPPA
--* HPPA ELF32::                  ld and HPPA 32-bit ELF
--@end ifset
- @ifset M68HC11
- * M68HC11/68HC12::              ld and the Motorola 68HC11 and 68HC12 families
- @end ifset
-+@ifset HPPA
-+* HPPA ELF32::                  ld and HPPA 32-bit ELF
-+@end ifset
- @ifset M68K
- * M68K::                        ld and Motorola 68K family
- @end ifset
-@@ -6012,6 +6014,9 @@ functionality are not listed.
- @ifset I960
- * i960::                        @command{ld} and the Intel 960 family
- @end ifset
-+@ifset M68HC11
-+* M68HC11/68HC12::		@code{ld} and the Motorola 68HC11 and 68HC12 families
-+@end ifset
- @ifset ARM
- * ARM::				@command{ld} and the ARM family
- @end ifset
-@@ -6027,9 +6032,6 @@ functionality are not listed.
- @ifset MSP430
- * MSP430::			@command{ld} and MSP430
- @end ifset
--@ifset M68HC11
--* M68HC11/68HC12::		@code{ld} and the Motorola 68HC11 and 68HC12 families
--@end ifset
- @ifset POWERPC
- * PowerPC ELF32::		@command{ld} and PowerPC 32-bit ELF Support
- @end ifset
-@@ -7877,7 +7879,7 @@ If you have more than one @code{SECT} statement for the same
- @printindex cp
- 
- @tex
--% I think something like @colophon should be in texinfo.  In the
-+% I think something like @@colophon should be in texinfo.  In the
- % meantime:
- \long\def\colophon{\hbox to0pt{}\vfill
- \centerline{The body of this manual is set in}
-@@ -7888,7 +7890,7 @@ If you have more than one @code{SECT} statement for the same
- \centerline{{\sl\fontname\tensl\/}}
- \centerline{are used for emphasis.}\vfill}
- \page\colophon
--% Blame: doc@cygnus.com, 28mar91.
-+% Blame: doc@@cygnus.com, 28mar91.
- @end tex
- 
- @bye
--- 
-2.1.1
-
diff --git a/openpower/package/p8-pore-binutils/p8-pore-binutils-0002-Skip-docs.patch b/openpower/package/p8-pore-binutils/p8-pore-binutils-0002-Skip-docs.patch
deleted file mode 100644
index 5ad14f5..0000000
--- a/openpower/package/p8-pore-binutils/p8-pore-binutils-0002-Skip-docs.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From 8056846566045eab511ab134c4a04662ce3e1cea Mon Sep 17 00:00:00 2001
-From: Patrick Williams <iawillia@us.ibm.com>
-Date: Thu, 11 Dec 2014 16:30:42 -0600
-Subject: [PATCH] Skip docs.
-
----
- binutils/Makefile.am | 2 +-
- binutils/Makefile.in | 2 +-
- gas/Makefile.am      | 2 +-
- gas/Makefile.in      | 2 +-
- 4 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/binutils/Makefile.am b/binutils/Makefile.am
-index 7f5f0c4..26bf327 100644
---- a/binutils/Makefile.am
-+++ b/binutils/Makefile.am
-@@ -20,7 +20,7 @@
- AUTOMAKE_OPTIONS = dejagnu no-dist foreign
- ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd
- 
--SUBDIRS = doc po
-+SUBDIRS = po
- 
- tooldir = $(exec_prefix)/$(target_alias)
- 
-diff --git a/binutils/Makefile.in b/binutils/Makefile.in
-index c6e0003..5f34bf9 100644
---- a/binutils/Makefile.in
-+++ b/binutils/Makefile.in
-@@ -434,7 +434,7 @@ top_builddir = @top_builddir@
- top_srcdir = @top_srcdir@
- AUTOMAKE_OPTIONS = dejagnu no-dist foreign
- ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd
--SUBDIRS = doc po
-+SUBDIRS = po
- tooldir = $(exec_prefix)/$(target_alias)
- 
- # Automake 1.10+ disables lex and yacc output file regeneration if
-diff --git a/gas/Makefile.am b/gas/Makefile.am
-index f65225f..3850223 100644
---- a/gas/Makefile.am
-+++ b/gas/Makefile.am
-@@ -20,7 +20,7 @@
- AUTOMAKE_OPTIONS = 1.11 dejagnu foreign no-dist
- ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd
- 
--SUBDIRS = doc po
-+SUBDIRS = po
- 
- tooldir = $(exec_prefix)/$(target_alias)
- 
-diff --git a/gas/Makefile.in b/gas/Makefile.in
-index c7b3597..162d2c1 100644
---- a/gas/Makefile.in
-+++ b/gas/Makefile.in
-@@ -300,7 +300,7 @@ top_builddir = @top_builddir@
- top_srcdir = @top_srcdir@
- AUTOMAKE_OPTIONS = 1.11 dejagnu foreign no-dist
- ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd
--SUBDIRS = doc po
-+SUBDIRS = po
- tooldir = $(exec_prefix)/$(target_alias)
- 
- # Automake 1.10+ disables lex and yacc output file regeneration if
--- 
-2.1.1
-
diff --git a/openpower/package/p8-pore-binutils/p8-pore-binutils.mk b/openpower/package/p8-pore-binutils/p8-pore-binutils.mk
index 5b33422..070e4dc 100644
--- a/openpower/package/p8-pore-binutils/p8-pore-binutils.mk
+++ b/openpower/package/p8-pore-binutils/p8-pore-binutils.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-P8_PORE_BINUTILS_VERSION ?= dcf4f87c0d9e8c8092ace0eb696189ee1056da30
+P8_PORE_BINUTILS_VERSION ?= 1d6a41d5a5104ce9bc8b6ad59f8e58c3a50824a4
 P8_PORE_BINUTILS_SITE ?= $(call github,open-power,p8-pore-binutils,$(P8_PORE_BINUTILS_VERSION))
 P8_PORE_BINUTILS_LICENSE = GPLv3+