summaryrefslogtreecommitdiffstats
path: root/src/import/hwpf
diff options
context:
space:
mode:
Diffstat (limited to 'src/import/hwpf')
-rw-r--r--src/import/hwpf/fapi2/include/array.H188
-rw-r--r--src/import/hwpf/fapi2/src/array.C131
2 files changed, 0 insertions, 319 deletions
diff --git a/src/import/hwpf/fapi2/include/array.H b/src/import/hwpf/fapi2/include/array.H
deleted file mode 100644
index 947bdf56a..000000000
--- a/src/import/hwpf/fapi2/include/array.H
+++ /dev/null
@@ -1,188 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/import/hwpf/fapi2/include/array.H $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
-/* [+] 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 array.H
- * @brief definitions for fapi2 arrays
- */
-
-#ifndef __FAPI2_ARRAY__
-#define __FAPI2_ARRAY__
-
-#include <stdint.h>
-#include <utility>
-#include <assert.h>
-#include <string.h>
-
-namespace fapi2
-{
-///
-/// @brief Class representing a FAPI2 array
-/// FAPI2 arrays are defined to be very lightweight but support
-/// c++ container operations (iterators, bounds checking, assignment, etc.)
-/// To avoid the code-bloat associated with std::vector templates,
-/// fapi2::array is presently limited to 64-bit elements.
-///
-/// To construct an array, you can either pass in an existing chunk
-/// of memory, or let the container allocate memory for you:
-/// fapi2::array foo(3, &PIB_MEM_BLOCK);
-/// creates an array 3 x uit64_t in size, located at &PIB_MEM_BLOCK.
-/// The memory pointed to by the address passed in is untouched
-/// during creation. This allows for a light-weight overlay on top
-/// of existing memory. It also means you need to initialize the space
-/// yourself.
-/// fapi2_array foo(3);
-/// creates an array 3 x uint64_t in size, and that memory will be
-/// allocated by the constructor and initiaized to 0's.
-///
-///
-class array
-{
- public:
-
- typedef uint64_t element_type;
- typedef element_type* iterator;
- typedef const element_type* const_iterator;
-
- ///
- /// @brief Create an array
- /// @param[in] i_size the size of the array
- /// @param[in] i_data a pointer to memory of appropriate size
- /// defaults to nullptr which causes the platform to
- /// allocate memory of size * element_type
- /// @warning fapi2::arrays, like arrays, can not be re-sized after
- /// creation.
- ///
- array(const uint32_t i_size, element_type* i_data = nullptr);
-
- ///
- /// @brief Destroy an array
- ///
- ~array(void);
-
- ///
- /// @brief operator[]
- /// @param[in] i_index the index of the element
- /// @return a reference to the element in question.
- /// @note array[0] = 0 works as well as foo = array[0]
- ///
- element_type& operator[](const uint32_t i_index);
-
- ///
- /// @brief operator=()
- /// @param[in] i_other the other array
- /// @return a reference to this, after the assignement
- ///
- array& operator=(const array& i_other);
-
- ///
- /// @brief move operator=()
- /// @note To use: new_array = std::move(old_array). old_array will be
- /// destroyed and no copy will be made (moved)
- ///
- array& operator=(array&& i_other);
-
- ///
- /// @brief operator==()
- ///
- bool operator==(const array& i_other);
-
- ///
- /// @brief operator!=()
- ///
- __attribute__ ((always_inline))
- bool operator!=(const array& i_other)
- {
- return ! operator==(i_other);
- }
-
- ///
- /// @brief Return an iterator the to beginning of the array
- /// @return An iterator to the beginning of the array
- ///
- __attribute__ ((always_inline))
- iterator begin(void)
- {
- return iv_data;
- }
-
- ///
- /// @brief Return an iterator the to end of the array
- /// @return An iterator to the end of the array
- ///
- __attribute__ ((always_inline))
- iterator end(void)
- {
- return iv_data + size();
- }
-
- ///
- /// @brief Return a const_iterator the to beginning of the array
- /// @return A const_iterator to the beginning of the array
- ///
- __attribute__ ((always_inline))
- const_iterator begin(void) const
- {
- return iv_data;
- }
-
- ///
- /// @brief Return a const_iterator the to end of the array
- /// @return A const_iterator to the end the array
- ///
- __attribute__ ((always_inline))
- const_iterator end(void) const
- {
- return iv_data + size();
- }
-
- private:
-
- enum
- {
- // Bit in iv_size representing whether we delete in the dtor
- delete_bit = 0x80000000,
-
- // The resulting size limit
- size_limit = 0x7FFFFFFF,
- };
-
- __attribute__ ((always_inline))
- uint32_t size(void)
- {
- return (iv_size & ~delete_bit);
- }
-
- __attribute__ ((always_inline))
- uint32_t size(void) const
- {
- return (iv_size & ~delete_bit);
- }
-
- uint32_t iv_size;
- element_type* iv_data;
-};
-}
-
-#endif
diff --git a/src/import/hwpf/fapi2/src/array.C b/src/import/hwpf/fapi2/src/array.C
deleted file mode 100644
index 043446d8e..000000000
--- a/src/import/hwpf/fapi2/src/array.C
+++ /dev/null
@@ -1,131 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/import/hwpf/fapi2/src/array.C $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2016 */
-/* [+] 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 array.C
- * @brief fapi2 arrays
- */
-
-#include <stdint.h>
-#include <array.H>
-
-namespace fapi2
-{
- /// @brief Create an array
- array::array(const uint32_t i_size, element_type* i_data):
- iv_size(i_size),
- iv_data(i_data)
- {
- assert(iv_size <= size_limit);
- if (iv_data == nullptr)
- {
- iv_data = new element_type[iv_size]();
- iv_size |= delete_bit;
- }
- // If the caller passed in a pointer, leave it be. Don't
- // initialize it or anything. That will allow a placement
- // operation where generic memory can use fapi2::array
- // methods without much overhead.
- }
-
- /// @brief Destroy an array
- array::~array(void)
- {
- if ((iv_size & delete_bit) != 0)
- {
- delete[] iv_data;
- }
- }
-
- /// @brief operator[]
- array::element_type& array::operator[](const uint32_t i_index)
- {
- assert(i_index < size());
- return iv_data[i_index];
- }
-
- /// @brief operator=()
- array& array::operator=(const array& i_other)
- {
- // Check to make sure it'll fit.
- assert(i_other.size() <= size());
-
- // Our new size will be the other's size.
- // Save of whether we should delete our iv_data ...
- uint64_t l_our_delete_state = iv_size | delete_bit;
-
- // ... our new size is the size (minus the delete state) of i_other
- iv_size = i_other.size();
-
- // ... do the copy ...
- memcpy(iv_data, i_other.iv_data, iv_size * sizeof(element_type));
-
- // ... and record our old delete state.
- iv_size |= l_our_delete_state;
-
- return *this;
- }
-
- /// @brief move operator=()
- array& array::operator=(array&& i_other)
- {
- iv_size = i_other.iv_size;
-
- // Make sure to clear the delete bit in the other. We
- // don't want our memory to be deleted.
- i_other.iv_size = i_other.size();
-
- iv_data = std::move(i_other.iv_data);
- return *this;
- }
-
- /// @brief operator==()
- bool array::operator==(const array& i_other)
- {
- // If they're not the same size, they're not the same
- if (size() != i_other.size())
- {
- return false;
- }
-
- // If they're the same size and point to the same memory, they're the same.
- if (iv_data == i_other.iv_data)
- {
- return true;
- }
-
- auto oitr = i_other.begin();
- auto iter = begin();
-
- for(; iter != end(); ++iter, ++oitr)
- {
- if (*iter != *oitr)
- {
- return false;
- }
- }
-
- return true;
- }
-}
OpenPOWER on IntegriCloud