Attention Handler design markdown

Added attention handler design document and enabled clang-format support. This design document is a work in progress and will continue to be updated as the attention handler design evolves.

Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: Icdd33241f61a1b8691ed31c96cb065ebf08f3512
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..ac8be0c
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,115 @@
+---
+Language:        Cpp
+# BasedOnStyle:  LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: true
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlines: Right
+AlignOperands:   true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: Empty
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: Yes
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterClass:      true
+  AfterControlStatement: true
+  AfterEnum:       true
+  AfterFunction:   true
+  AfterNamespace:  true
+  AfterObjCDeclaration: true
+  AfterStruct:     true
+  AfterUnion:      true
+  AfterExternBlock: true
+  BeforeCatch:     true
+  BeforeElse:      true
+  IndentBraces:    false
+  SplitEmptyFunction:   false
+  SplitEmptyRecord:     false
+  SplitEmptyNamespace:  false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializers: AfterColon
+BreakInheritanceList: AfterColon
+BreakStringLiterals: true
+ColumnLimit:     80
+CommentPragmas:  '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+PointerAlignment: Left
+DisableFormat:   false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
+IncludeBlocks: Regroup
+IncludeCategories:
+  - Regex:           '^[<"](gtest|gmock)'
+    Priority:        7
+  - Regex:           '^"config.h"'
+    Priority:        -1
+  - Regex:           '^".*\.h"'
+    Priority:        1
+  - Regex:           '^".*\.hpp"'
+    Priority:        2
+  - Regex:           '^<.*\.h>'
+    Priority:        3
+  - Regex:           '^<.*\.hpp>'
+    Priority:        4
+  - Regex:           '^<.*'
+    Priority:        5
+  - Regex:           '.*'
+    Priority:        6
+IndentCaseLabels: true
+IndentWidth:     4
+IndentWrappedFunctionNames: true
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd:   ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Left
+ReflowComments:  true
+SortIncludes:    true
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles:  false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard:        Cpp11
+TabWidth:        4
+UseTab:          Never
+...
+
diff --git a/attn/Attention_Handler.md b/attn/Attention_Handler.md
new file mode 100644
index 0000000..45502ba
--- /dev/null
+++ b/attn/Attention_Handler.md
@@ -0,0 +1,56 @@
+# Hardware Error Attention Handling for POWER Systems
+
+Attentions are host error and debug breakpoint conditions that can be handled
+by software running on the BMC. The host alerts the BMC of these conditions
+via the Attention GPIO pin. The Attention Handler application (ATTN) monitors
+this gpio for activity and services active attentions. When activity is
+detected on the Attention GPIO, ATTN will query the hardware to determine the
+active attention that needs to be serviced.
+
+## Attention Handler Logic
+The following logic is implemented in ATTN to allow for controlling the flow
+of attention handling once an attention event has been detected.
+
+- ATTN can adjust the handling priority of active attention events.
+
+- ATTN can choose to defer or ignore handling of attention events.
+
+- ATTN can handle any number of active attentions per GPIO event.
+
+- ATTN can continue monitoring or stop monitoring the attention GPIO.
+
+## Attention Conditions
+The following is a list of attention conditions and actions.
+
+1. SBE Attention (vital): This attention indicates that the SBE is in a state
+   that is considered non-functional. ATTN will log this event and *...TBD*
+
+2. System Checkstop (checkstop): This attention indicates an error condition
+   in which the host cannot continue operating properly. ATTN will launch the
+   Hardware Diagnostics application (Hwdiags) and may provide Hwdiags with
+   information needed to help it analyze the checkstop *...TBD*
+
+3. Special Attention (special): This attention indicates that one of the
+   following conditions has occurred.
+
+    - PHYP Breakpoint (breakpoint): ATTN will send notification with the
+      processor, core and thread number associated with the event.
+
+    - PHYP Terminate Immediate (PHYP TI): ATTN will dump and re-ipl.
+
+    - OPAL Terminate Immediate (OPAL TI): ATTN will dump and re-ipl.
+
+    - Core Code to SP (PHYP CoreCode): ATTN will log this event.
+
+    - Other (instruction stop, core recovery handshake): Attention will log
+      these events.
+
+##Command Line Interface
+
+ATTN supports the following command line interface *...TBD*
+
+##Building
+
+This application is built using the standard Meson/Ninja build setup.
+
+    meson build && cd build && ninja
diff --git a/src/main.cpp b/src/main.cpp
index b9dae63..eaf2d4c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3,6 +3,5 @@
 
 int main()
 {
-    printf( "Hello, World!\n" );
+    printf("Hello, World!\n");
 }
-
diff --git a/test/hello-world.cpp b/test/hello-world.cpp
index 8cc0b19..5cdaa1b 100644
--- a/test/hello-world.cpp
+++ b/test/hello-world.cpp
@@ -3,8 +3,7 @@
 
 int main()
 {
-    printf( "test: Hello, World!\n" );
+    printf("test: Hello, World!\n");
 
     return 0;
 }
-