add .clang-format

Add .clang-format for automatic style.

Change-Id: I6d240009370179b5b8f1f646b0476a059ec6aa85
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/procedures/p9/cfam_overrides.cpp b/procedures/p9/cfam_overrides.cpp
index a594e0c..13f7659 100644
--- a/procedures/p9/cfam_overrides.cpp
+++ b/procedures/p9/cfam_overrides.cpp
@@ -1,12 +1,13 @@
-#include <fstream>
-#include <sstream>
-#include <iostream>
 #include "cfam_access.hpp"
 #include "p9_cfam.hpp"
 #include "registration.hpp"
 #include "targeting.hpp"
-#include <phosphor-logging/elog.hpp>
+
+#include <fstream>
+#include <iostream>
 #include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <sstream>
 #include <xyz/openbmc_project/Common/error.hpp>
 
 /* File /var/lib/obmc/cfam_overrides requires whitespace-separated parameters
@@ -24,7 +25,8 @@
 using namespace openpower::targeting;
 using namespace openpower::util;
 
-void CFAMOverride() {
+void CFAMOverride()
+{
     int pos = 0;
     cfam_address_t address = 0;
     cfam_data_t data = 0;
@@ -38,7 +40,7 @@
 
     if (overrides.is_open())
     {
-        while (std::getline(overrides,line))
+        while (std::getline(overrides, line))
         {
             if (!line.empty())
             {
@@ -47,7 +49,7 @@
                 {
                     mask = 0xFFFFFFFF;
                     if (sscanf(line.c_str(), "%x %hx %x %x", &pos, &address,
-                        &data, &mask) >= 3)
+                               &data, &mask) >= 3)
                     {
                         const auto& target = targets.getTarget(pos);
                         writeRegWithMask(target, address, data, mask);
@@ -60,7 +62,8 @@
                             phosphor::logging::xyz::openbmc_project::Common;
                         phosphor::logging::elog<error::InvalidArgument>(
                             metadata::InvalidArgument::ARGUMENT_NAME("line"),
-                            metadata::InvalidArgument::ARGUMENT_VALUE(line.c_str()));
+                            metadata::InvalidArgument::ARGUMENT_VALUE(
+                                line.c_str()));
                     }
                 }
             }
@@ -73,5 +76,5 @@
 
 REGISTER_PROCEDURE("CFAMOverride", CFAMOverride);
 
-}
-}
+} // namespace p9
+} // namespace openpower
diff --git a/procedures/p9/cleanup_pcie.cpp b/procedures/p9/cleanup_pcie.cpp
index bfeb472..a0be3f5 100644
--- a/procedures/p9/cleanup_pcie.cpp
+++ b/procedures/p9/cleanup_pcie.cpp
@@ -13,12 +13,13 @@
  * See the License for the specific language governing permissions and

  * limitations under the License.

  */

-#include <phosphor-logging/log.hpp>

 #include "cfam_access.hpp"

 #include "p9_cfam.hpp"

 #include "registration.hpp"

 #include "targeting.hpp"

 

+#include <phosphor-logging/log.hpp>

+

 namespace openpower

 {

 namespace p9

@@ -46,5 +47,5 @@
 

 REGISTER_PROCEDURE("cleanupPcie", cleanupPcie);

 

-}

-}

+} // namespace p9

+} // namespace openpower

diff --git a/procedures/p9/collect_sbe_hb_data.cpp b/procedures/p9/collect_sbe_hb_data.cpp
index 436a379..b29d194 100644
--- a/procedures/p9/collect_sbe_hb_data.cpp
+++ b/procedures/p9/collect_sbe_hb_data.cpp
@@ -13,12 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <phosphor-logging/log.hpp>
 #include "cfam_access.hpp"
 #include "p9_cfam.hpp"
 #include "registration.hpp"
 #include "targeting.hpp"
 
+#include <phosphor-logging/log.hpp>
+
 namespace openpower
 {
 namespace p9
@@ -61,21 +62,21 @@
     struct
     {
 #if __BYTE_ORDER == __LITTLE_ENDIAN
-        uint32_t minorStep           :8;    //24:31
-        uint32_t majorStep           :8;    //16:23
-        uint32_t internalStep        :4;    //12:15
-        uint32_t reserved            :2;    //10:11
-        uint32_t stepFinish          :1;    //9
-        uint32_t stepStart           :1;    //8
-        uint32_t magic               :8;    //0:7
+        uint32_t minorStep : 8;    // 24:31
+        uint32_t majorStep : 8;    // 16:23
+        uint32_t internalStep : 4; // 12:15
+        uint32_t reserved : 2;     // 10:11
+        uint32_t stepFinish : 1;   // 9
+        uint32_t stepStart : 1;    // 8
+        uint32_t magic : 8;        // 0:7
 #else
-        uint32_t magic               :8;    //0:7
-        uint32_t stepStart           :1;    //8
-        uint32_t stepFinish          :1;    //9
-        uint32_t reserved            :2;    //10:11
-        uint32_t internalStep        :4;    //12:15
-        uint32_t majorStep           :8;    //16:23
-        uint32_t minorStep           :8;    //24:31
+        uint32_t magic : 8;        // 0:7
+        uint32_t stepStart : 1;    // 8
+        uint32_t stepFinish : 1;   // 9
+        uint32_t reserved : 2;     // 10:11
+        uint32_t internalStep : 4; // 12:15
+        uint32_t majorStep : 8;    // 16:23
+        uint32_t minorStep : 8;    // 24:31
 #endif
     } PACKED;
 };
@@ -95,7 +96,7 @@
 
     Targeting targets;
 
-    for (const auto& proc: targets)
+    for (const auto& proc : targets)
     {
         // Read and parse SBE messaging register
         try
@@ -103,14 +104,10 @@
             auto readData = readReg(proc, P9_SBE_MSG_REGISTER);
             auto msg = reinterpret_cast<const sbeMsgReg_t*>(&readData);
             log<level::INFO>("SBE status register",
-                             entry("PROC=%d",
-                                    proc->getPos()),
-                             entry("SBE_MAJOR_ISTEP=%d",
-                                    msg->PACKED.majorStep),
-                             entry("SBE_MINOR_ISTEP=%d",
-                                    msg->PACKED.minorStep),
-                             entry("REG_VAL=0x%08X",
-                                    msg->data32));
+                             entry("PROC=%d", proc->getPos()),
+                             entry("SBE_MAJOR_ISTEP=%d", msg->PACKED.majorStep),
+                             entry("SBE_MINOR_ISTEP=%d", msg->PACKED.minorStep),
+                             entry("REG_VAL=0x%08X", msg->data32));
         }
         catch (const std::exception& e)
         {
@@ -128,12 +125,9 @@
         if (HB_MBX5_VALID_FLAG == msg->PACKED.magic)
         {
             log<level::INFO>("HB MBOX 5 register",
-                             entry("HB_MAJOR_ISTEP=%d",
-                                    msg->PACKED.majorStep),
-                             entry("HB_MINOR_ISTEP=%d",
-                                    msg->PACKED.minorStep),
-                             entry("REG_VAL=0x%08X",
-                                    msg->data32));
+                             entry("HB_MAJOR_ISTEP=%d", msg->PACKED.majorStep),
+                             entry("HB_MINOR_ISTEP=%d", msg->PACKED.minorStep),
+                             entry("REG_VAL=0x%08X", msg->data32));
         }
     }
     catch (const std::exception& e)
diff --git a/procedures/p9/set_sync_fsi_clock_mode.cpp b/procedures/p9/set_sync_fsi_clock_mode.cpp
index b17aec5..4ffff9f 100644
--- a/procedures/p9/set_sync_fsi_clock_mode.cpp
+++ b/procedures/p9/set_sync_fsi_clock_mode.cpp
@@ -27,7 +27,6 @@
 using namespace openpower::cfam::p9;
 using namespace openpower::targeting;
 
-
 /**
  * @Brief Sets the P9 FSI clock to synchronous mode.
  */
@@ -36,13 +35,11 @@
     Targeting targets;
     const auto& master = *(targets.begin());
 
-    //Set bit 31 to 0
+    // Set bit 31 to 0
     writeRegWithMask(master, P9_LL_MODE_REG, 0x00000000, 0x00000001);
 }
 
-
 REGISTER_PROCEDURE("setSyncFSIClock", setSynchronousFSIClock);
 
-}
-}
-
+} // namespace p9
+} // namespace openpower
diff --git a/procedures/p9/start_host.cpp b/procedures/p9/start_host.cpp
index 07020df..f959ce7 100644
--- a/procedures/p9/start_host.cpp
+++ b/procedures/p9/start_host.cpp
@@ -13,12 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <phosphor-logging/log.hpp>
 #include "cfam_access.hpp"
+#include "ext_interface.hpp"
 #include "p9_cfam.hpp"
 #include "registration.hpp"
 #include "targeting.hpp"
-#include "ext_interface.hpp"
+
+#include <phosphor-logging/log.hpp>
 
 namespace openpower
 {
@@ -30,7 +31,6 @@
 using namespace openpower::cfam::p9;
 using namespace openpower::targeting;
 
-
 /**
  * @brief Starts the self boot engine on P9 position 0 to kick off a boot.
  * @return void
@@ -43,55 +43,54 @@
     log<level::INFO>("Running P9 procedure startHost",
                      entry("NUM_PROCS=%d", targets.size()));
 
-    //Ensure asynchronous clock mode is set
+    // Ensure asynchronous clock mode is set
     writeReg(master, P9_LL_MODE_REG, 0x00000001);
 
-    //Clock mux select override
+    // Clock mux select override
     for (const auto& t : targets)
     {
-        writeRegWithMask(t, P9_ROOT_CTRL8,
-                         0x0000000C, 0x0000000C);
+        writeRegWithMask(t, P9_ROOT_CTRL8, 0x0000000C, 0x0000000C);
     }
 
-    //Enable P9 checkstop to be reported to the BMC
+    // Enable P9 checkstop to be reported to the BMC
 
-    //Setup FSI2PIB to report checkstop
+    // Setup FSI2PIB to report checkstop
     writeReg(master, P9_FSI_A_SI1S, 0x20000000);
 
-    //Enable Xstop/ATTN interrupt
+    // Enable Xstop/ATTN interrupt
     writeReg(master, P9_FSI2PIB_TRUE_MASK, 0x60000000);
 
-    //Arm it
+    // Arm it
     writeReg(master, P9_FSI2PIB_INTERRUPT, 0xFFFFFFFF);
 
-    //Kick off the SBE to start the boot
+    // Kick off the SBE to start the boot
 
     // Choose seeprom side to boot from
     cfam_data_t sbeSide = 0;
-    if(getBootCount() > 0)
+    if (getBootCount() > 0)
     {
         sbeSide = 0;
         log<level::INFO>("Setting SBE seeprom side to 0",
-                entry("SBE_SIDE_SELECT=%d", 0));
+                         entry("SBE_SIDE_SELECT=%d", 0));
     }
     else
     {
         sbeSide = 0x00004000;
         log<level::INFO>("Setting SBE seeprom side to 1",
-                entry("SBE_SIDE_SELECT=%d", 1));
+                         entry("SBE_SIDE_SELECT=%d", 1));
     }
     // Bit 17 of the ctrl status reg indicates sbe seeprom boot side
     // 0 -> Side 0, 1 -> Side 1
     writeRegWithMask(master, P9_SBE_CTRL_STATUS, sbeSide, 0x00004000);
 
-    //Ensure ISTEP stepping isn't enabled
+    // Ensure ISTEP stepping isn't enabled
     writeRegWithMask(master, P9_SCRATCH_REGISTER_8, 0x20000000, 0x20000000);
 
-    //Start the SBE
+    // Start the SBE
     writeRegWithMask(master, P9_CBS_CS, 0x80000000, 0x80000000);
 }
 
 REGISTER_PROCEDURE("startHost", startHost);
 
-}
-}
+} // namespace p9
+} // namespace openpower
diff --git a/procedures/p9/vcs_workaround.cpp b/procedures/p9/vcs_workaround.cpp
index e418971..fe3da3c 100644
--- a/procedures/p9/vcs_workaround.cpp
+++ b/procedures/p9/vcs_workaround.cpp
@@ -13,12 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <phosphor-logging/log.hpp>
 #include "cfam_access.hpp"
 #include "p9_cfam.hpp"
 #include "registration.hpp"
 #include "targeting.hpp"
 
+#include <phosphor-logging/log.hpp>
+
 namespace openpower
 {
 namespace p9
@@ -29,7 +30,6 @@
 using namespace openpower::cfam::p9;
 using namespace openpower::targeting;
 
-
 /**
  * @brief Performs the 'VCS Workaround' on all P9s in the system.
  * @return void
@@ -54,26 +54,23 @@
     log<level::INFO>("Running P9 procedure vcsWorkaround",
                      entry("NUM_PROCS=%d", targets.size()));
 
-    //Set asynchronous clock mode
+    // Set asynchronous clock mode
     writeReg(master, P9_LL_MODE_REG, 0x00000001);
 
     for (const auto& t : targets)
     {
-        //Unfence PLL controls
-        writeRegWithMask(t, P9_ROOT_CTRL0,
-                         0x00000000, 0x00010000);
+        // Unfence PLL controls
+        writeRegWithMask(t, P9_ROOT_CTRL0, 0x00000000, 0x00010000);
 
-        //Assert Perv chiplet endpoint reset
-        writeRegWithMask(t, P9_PERV_CTRL0,
-                         0x40000000, 0x40000000);
+        // Assert Perv chiplet endpoint reset
+        writeRegWithMask(t, P9_PERV_CTRL0, 0x40000000, 0x40000000);
 
-        //Enable Nest PLL
-        writeRegWithMask(t, P9_PERV_CTRL0,
-                         0x00000001, 0x00000001);
+        // Enable Nest PLL
+        writeRegWithMask(t, P9_PERV_CTRL0, 0x00000001, 0x00000001);
     }
 }
 
 REGISTER_PROCEDURE("vcsWorkaround", vcsWorkaround);
 
-}
-}
+} // namespace p9
+} // namespace openpower