summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authordgilbert <dgilbert@us.ibm.com>2011-06-03 12:54:41 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2011-06-17 12:23:52 -0500
commit609d6810b8bc92dc979f8bbb8e7e7d7b7b5d9490 (patch)
treecd517ec2e10a95638e675b037bb24e2d01296ef4 /src/usr
parentf64ba52098e248e62b4ddb14c0a027c21066e9e2 (diff)
downloadblackbird-hostboot-609d6810b8bc92dc979f8bbb8e7e7d7b7b5d9490.tar.gz
blackbird-hostboot-609d6810b8bc92dc979f8bbb8e7e7d7b7b5d9490.zip
Initial futex support
Change-Id: I51a4f1117085ce23c7993c1a38e4124596636726 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/141 Tested-by: Jenkins Server Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com> Reviewed-by: Thi N. Tran <thi@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr')
-rwxr-xr-xsrc/usr/cxxtest/cxxtestgen.pl2
-rw-r--r--src/usr/devicefw/associator.C14
-rw-r--r--src/usr/devicefw/associator.H4
-rw-r--r--src/usr/example/example.C4
-rw-r--r--src/usr/trace/trace.C78
5 files changed, 37 insertions, 65 deletions
diff --git a/src/usr/cxxtest/cxxtestgen.pl b/src/usr/cxxtest/cxxtestgen.pl
index 8fa5ab5d7..24b722163 100755
--- a/src/usr/cxxtest/cxxtestgen.pl
+++ b/src/usr/cxxtest/cxxtestgen.pl
@@ -613,7 +613,7 @@ sub writeHostBootPreamble() {
## print the standard includes for Hostboot
print "\n";
print "#include <kernel/console.H>\n";
- print "#include <sys/mutex.h>\n";
+ print "#include <sys/sync.h>\n";
print "#include <sys/vfs.h>\n";
print "#include <sys/task.h>\n";
print "#include <trace/interface.H>\n";
diff --git a/src/usr/devicefw/associator.C b/src/usr/devicefw/associator.C
index d076c311e..e09852bf9 100644
--- a/src/usr/devicefw/associator.C
+++ b/src/usr/devicefw/associator.C
@@ -13,17 +13,16 @@ namespace DeviceFW
trace_desc_t* g_traceBuffer = NULL;
TRAC_INIT(&g_traceBuffer, "DevFW", 4096);
- Associator::Associator() : iv_mutex(mutex_create())
+ Associator::Associator() : iv_mutex()
{
TRACFCOMP(g_traceBuffer, ENTER_MRK "Associator::Associator");
-
+ mutex_init(&iv_mutex);
// Allocate first level of map (access types).
iv_routeMap = iv_associations.allocate(LAST_DRIVER_ACCESS_TYPE);
}
Associator::~Associator()
{
- mutex_destroy(iv_mutex);
TRACFCOMP(g_traceBuffer, EXIT_MRK "Associator::~Associator");
}
@@ -40,7 +39,7 @@ namespace DeviceFW
// compiler due to the template specializations in driverif.H.
// No assert-checks will be done here.
- mutex_lock(iv_mutex);
+ mutex_lock(&iv_mutex);
size_t ops = 0;
AssociationData targets = AssociationData();
@@ -118,14 +117,13 @@ namespace DeviceFW
// Set function offset into map. True flag indicates valid.
(*iv_associations[targets.offset]) = AssociationData(true, opLoc);
- mutex_unlock(iv_mutex);
+ mutex_unlock(&iv_mutex);
}
errlHndl_t Associator::performOp(OperationType i_opType,
TargetHandle_t i_target,
void* io_buffer, size_t& io_buflen,
int64_t i_accessType, va_list i_addr)
- const
{
TRACDCOMP(g_traceBuffer, "Device op requested for (%d, %d, %d)",
i_opType, i_accessType, /*TODO: i_target->type*/PROCESSOR);
@@ -136,7 +134,7 @@ namespace DeviceFW
errlHndl_t l_errl = NULL;
- mutex_lock(iv_mutex);
+ mutex_lock(&iv_mutex);
// Function pointer found for this route request.
deviceOp_t l_devRoute = NULL;
@@ -203,7 +201,7 @@ namespace DeviceFW
}
} while(0);
- mutex_unlock(iv_mutex);
+ mutex_unlock(&iv_mutex);
// Call function if one was found, create error otherwise.
if (NULL == l_devRoute)
diff --git a/src/usr/devicefw/associator.H b/src/usr/devicefw/associator.H
index 2052781b7..aba457338 100644
--- a/src/usr/devicefw/associator.H
+++ b/src/usr/devicefw/associator.H
@@ -5,7 +5,7 @@
#define __DEVICEFW_ASSOCIATOR_H
#include <devicefw/driverif.H>
-#include <sys/mutex.h>
+#include <sys/sync.h>
#include <vector>
#include "assoccontain.H"
@@ -53,7 +53,7 @@ namespace DeviceFW
errlHndl_t performOp(OperationType i_opType,
TargetHandle_t i_target,
void* io_buffer, size_t& io_buflen,
- int64_t i_accessType, va_list i_addr) const;
+ int64_t i_accessType, va_list i_addr);
private:
typedef std::vector<deviceOp_t> opVector_t;
diff --git a/src/usr/example/example.C b/src/usr/example/example.C
index 536100368..632eb6882 100644
--- a/src/usr/example/example.C
+++ b/src/usr/example/example.C
@@ -1,5 +1,5 @@
#include <kernel/console.H>
-#include <sys/mutex.h>
+#include <sys/sync.h>
#include <sys/vfs.h>
#include <sys/task.h>
#include <trace/interface.H>
@@ -7,7 +7,7 @@
#include <example/examplerc.H>
#include <errl/errlentry.H>
-//static mutex_t value = mutex_create();
+//static mutex_t value = MUTEX_INITIALIZER;
trace_desc_t *g_trac_test = NULL;
TRAC_INIT(&g_trac_test, "EXAMPLE", 4096);
diff --git a/src/usr/trace/trace.C b/src/usr/trace/trace.C
index e7687ad7e..569af1e08 100644
--- a/src/usr/trace/trace.C
+++ b/src/usr/trace/trace.C
@@ -18,7 +18,7 @@
#include <limits.h>
#include <stdlib.h>
#include <sys/task.h>
-#include <sys/mutex.h>
+#include <sys/sync.h>
#include <string.h>
#include <trace/trace.H>
@@ -57,7 +57,7 @@ Trace& Trace::getTheInstance()
/******************************************************************************/
Trace::Trace()
{
- iv_trac_mutex = mutex_create();
+ mutex_init(&iv_trac_mutex);
g_trac_global = static_cast<trace_desc_t *>(malloc(TRAC_DEFAULT_BUFFER_SIZE));
@@ -137,7 +137,6 @@ void Trace::trace_adal_write_all(trace_desc_t *io_td,
/*------------------------------------------------------------------------*/
/* Local Variables */
/*------------------------------------------------------------------------*/
- int64_t l_rc = 0;
uint32_t l_entry_size = 0;
trace_entire_entry_t l_entry;
@@ -206,27 +205,15 @@ void Trace::trace_adal_write_all(trace_desc_t *io_td,
// buffer for this
// CRITICAL REGION START
- l_rc = mutex_lock(iv_trac_mutex);
- if(l_rc != 0)
- {
- // This will assert so we'll never hit this code.
- }
- else
- {
- // Update the entry count
- io_td->te_count++;
+ mutex_lock(&iv_trac_mutex);
+ // Update the entry count
+ io_td->te_count++;
- writeData(io_td,
- static_cast<void *>(&l_entry),
- l_entry_size);
+ writeData(io_td,
+ static_cast<void *>(&l_entry),
+ l_entry_size);
- l_rc = mutex_unlock(iv_trac_mutex);
- if(l_rc != 0)
- {
- // Badness
- // This will assert so we'll never hit this code.
- }
- }
+ mutex_unlock(&iv_trac_mutex);
// CRITICAL REGION END
}
@@ -245,7 +232,6 @@ void Trace::trace_adal_write_bin(trace_desc_t *io_td,const trace_hash_val i_hash
/*------------------------------------------------------------------------*/
/* Local Variables */
/*------------------------------------------------------------------------*/
- int64_t l_rc = 0;
uint32_t l_entry_size = 0;
trace_bin_entry_t l_entry;
@@ -291,40 +277,28 @@ void Trace::trace_adal_write_bin(trace_desc_t *io_td,const trace_hash_val i_hash
convertTime(&l_entry.stamp);
// CRITICAL REGION START
- l_rc = mutex_lock(iv_trac_mutex);
- if(l_rc != 0)
- {
- // This will assert so we'll never hit this code.
- }
- else
- {
+ mutex_lock(&iv_trac_mutex);
- // Increment trace counter
- io_td->te_count++;
+ // Increment trace counter
+ io_td->te_count++;
- // First write the header
- writeData(io_td,
- static_cast<void *>(&l_entry),
- sizeof(l_entry));
+ // First write the header
+ writeData(io_td,
+ static_cast<void *>(&l_entry),
+ sizeof(l_entry));
- // Now write the actual binary data
- writeData(io_td,
- i_ptr,
- i_size);
+ // Now write the actual binary data
+ writeData(io_td,
+ i_ptr,
+ i_size);
- // Now write the size at the end
- writeData(io_td,
- static_cast<void *>(&l_entry_size),
- sizeof(l_entry_size));
+ // Now write the size at the end
+ writeData(io_td,
+ static_cast<void *>(&l_entry_size),
+ sizeof(l_entry_size));
- // CRITICAL REGION END
- l_rc = mutex_unlock(iv_trac_mutex);
- if(l_rc != 0)
- {
- // Badness
- // This will assert so we'll never hit this code.
- }
- }
+ // CRITICAL REGION END
+ mutex_unlock(&iv_trac_mutex);
}while(0);
OpenPOWER on IntegriCloud