summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/attn/common/attnbits.C
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/diag/attn/common/attnbits.C')
-rw-r--r--src/usr/diag/attn/common/attnbits.C273
1 files changed, 273 insertions, 0 deletions
diff --git a/src/usr/diag/attn/common/attnbits.C b/src/usr/diag/attn/common/attnbits.C
new file mode 100644
index 000000000..4edcddb7e
--- /dev/null
+++ b/src/usr/diag/attn/common/attnbits.C
@@ -0,0 +1,273 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/attn/common/attnbits.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2014 */
+/* [+] 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 attnbits.C
+ *
+ * @brief HBATTN register addresses, bits of interest.
+ */
+
+#include "common/attnfwd.H"
+#include "common/attnbits.H"
+
+using namespace PRDF;
+using namespace std;
+
+namespace ATTN
+{
+
+/**
+ * @brief RegAssoc Associate register data with a key.
+ *
+ * Typically used to associate an attention type or MCS position
+ * with register addresses or masks.
+ */
+struct RegAssoc
+{
+ uint64_t key;
+
+ uint64_t data;
+};
+
+bool getCheckbits(
+ const RegAssoc * i_first,
+ const RegAssoc * i_last,
+ uint64_t i_key,
+ uint64_t & o_bits)
+{
+ while(i_first != i_last)
+ {
+ if(i_first->key == i_key)
+ {
+ o_bits = i_first->data;
+ break;
+ }
+
+ ++i_first;
+ }
+
+ return i_first != i_last;
+}
+
+void forEach(
+ const RegAssoc * i_first,
+ const RegAssoc * i_last,
+ uint64_t i_scomData,
+ void * i_data,
+ void (*i_func)(uint64_t, void *))
+{
+ while(i_first != i_last)
+ {
+ if(i_first->data & i_scomData)
+ {
+ (*i_func)(i_first->key, i_data);
+ }
+
+ ++i_first;
+ }
+}
+
+namespace IPOLL
+{
+
+const uint64_t address = 0x1020013;
+
+void getCheckbitsAssociations(
+ const RegAssoc * & o_first,
+ const RegAssoc * & o_last)
+{
+ static const RegAssoc first[] = {
+
+ {CHECK_STOP, 0x8000000000000000ull},
+ {RECOVERABLE, 0x4000000000000000ull},
+ {SPECIAL, 0x2000000000000000ull},
+ {HOST, 0x1000000000000000ull},
+ };
+
+ static const RegAssoc * last = first +
+ sizeof(first)/sizeof(*first);
+
+ o_first = first;
+ o_last = last;
+}
+
+bool getCheckbits(
+ uint64_t i_type,
+ uint64_t & o_bits)
+{
+ const RegAssoc * first, * last;
+
+ getCheckbitsAssociations(first, last);
+
+ return getCheckbits(first, last, i_type, o_bits);
+}
+
+void forEach(
+ uint64_t i_scomData,
+ void * i_data,
+ void (*i_func)(uint64_t, void *))
+{
+ const RegAssoc * first, * last;
+
+ getCheckbitsAssociations(first, last);
+
+ forEach(first, last, i_scomData, i_data, i_func);
+}
+}
+
+namespace GFIR
+{
+
+bool getAddress(
+ uint64_t i_type,
+ uint64_t & o_address)
+{
+ static const RegAssoc first[] = {
+
+ {CHECK_STOP, 0x570f001c},
+ {RECOVERABLE, 0x570f001b},
+ {SPECIAL, 0x570f001a},
+ };
+
+ static const RegAssoc * last = first +
+ sizeof(first)/sizeof(*first);
+
+ return getCheckbits(first, last, i_type, o_address);
+}
+
+bool getCheckbits(
+ uint64_t i_type,
+ uint64_t & o_bits)
+{
+ static const RegAssoc first[] = {
+
+ {CHECK_STOP, 0xffffffffffffffffull},
+ {RECOVERABLE, 0xffffffffffffffffull},
+ {SPECIAL, 0xffffffffffffffffull},
+ };
+
+ static const RegAssoc * last = first +
+ sizeof(first)/sizeof(*first);
+
+ return getCheckbits(first, last, i_type, o_bits);
+}
+}
+
+namespace MCI
+{
+
+const uint64_t address = 0x2011840;
+
+void getCheckbitsAssociations(
+ const RegAssoc * & o_first,
+ const RegAssoc * & o_last)
+{
+ static const RegAssoc first[] = {
+
+ {RECOVERABLE, 0x0009000000000000ull},
+ {SPECIAL, 0x0000C00000000000ull},
+ };
+
+ static const RegAssoc * last = first +
+ sizeof(first)/sizeof(*first);
+
+ o_first = first;
+ o_last = last;
+}
+
+bool getCheckbits(
+ uint64_t i_type,
+ uint64_t & o_bits)
+{
+ const RegAssoc * first, * last;
+
+ getCheckbitsAssociations(first, last);
+
+ return getCheckbits(first, last, i_type, o_bits);
+}
+
+void forEach(
+ uint64_t i_scomData,
+ void * i_data,
+ void (*i_func)(uint64_t, void *))
+{
+ const RegAssoc * first, * last;
+
+ getCheckbitsAssociations(first, last);
+
+ forEach(first, last, i_scomData, i_data, i_func);
+}
+}
+
+namespace GP1
+{
+
+const uint64_t address = 0x2000001ull;
+
+void getCheckbitsAssociations(
+ const RegAssoc * & o_first,
+ const RegAssoc * & o_last)
+{
+ static const RegAssoc first[] = {
+ {0, 0x0100000000000000ull},
+ {1, 0x0080000000000000ull},
+ {2, 0x0040000000000000ull},
+ {3, 0x0020000000000000ull},
+ {4, 0x0010000000000000ull},
+ {5, 0x0008000000000000ull},
+ {6, 0x0004000000000000ull},
+ {7, 0x0002000000000000ull},
+ };
+
+ static const RegAssoc * last = first +
+ sizeof(first)/sizeof(*first);
+
+ o_first = first;
+ o_last = last;
+}
+
+bool getCheckbits(
+ uint64_t i_pos,
+ uint64_t & o_bits)
+{
+ const RegAssoc * first, * last;
+
+ getCheckbitsAssociations(first, last);
+
+ return getCheckbits(first, last, i_pos, o_bits);
+}
+
+void forEach(
+ uint64_t i_scomData,
+ void * i_data,
+ void (*i_func)(uint64_t, void *))
+{
+ const RegAssoc * first, * last;
+
+ getCheckbitsAssociations(first, last);
+
+ forEach(first, last, i_scomData, i_data, i_func);
+}
+}
+}
OpenPOWER on IntegriCloud