summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/partmp.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-20 13:24:11 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-20 16:16:59 +0200
commit0a00b2b5f6d115829f05bbac260ba7c9bc47c9e4 (patch)
treebc25332e7b0f84f2130cfe9163824d76c8037bed /cpukit/rtems/src/partmp.c
parentmpci: Delete unused region support (diff)
downloadrtems-0a00b2b5f6d115829f05bbac260ba7c9bc47c9e4.tar.bz2
rtems: Remove location from _Partition_Get()
Use _Objects_Get_local() for _Partition_Get() to get rid of the location parameter. Move remote object handling to partition MPCI support.
Diffstat (limited to 'cpukit/rtems/src/partmp.c')
-rw-r--r--cpukit/rtems/src/partmp.c70
1 files changed, 52 insertions, 18 deletions
diff --git a/cpukit/rtems/src/partmp.c b/cpukit/rtems/src/partmp.c
index 516fe78f73..f094d619eb 100644
--- a/cpukit/rtems/src/partmp.c
+++ b/cpukit/rtems/src/partmp.c
@@ -33,6 +33,19 @@ static Partition_MP_Packet *_Partition_MP_Get_packet( void )
return (Partition_MP_Packet *) _MPCI_Get_packet();
}
+static void _Partition_MP_Initialize_packet(
+ Partition_MP_Packet *the_packet,
+ Objects_Id id,
+ Partition_MP_Remote_operations operation
+)
+{
+ the_packet->Prefix.the_class = MP_PACKET_PARTITION;
+ the_packet->Prefix.length = sizeof( *the_packet );
+ the_packet->Prefix.to_convert = sizeof( *the_packet );
+ the_packet->Prefix.id = id;
+ the_packet->operation = operation;
+}
+
/*
* _Partition_MP_Send_process_packet
*
@@ -54,14 +67,10 @@ void _Partition_MP_Send_process_packet (
case PARTITION_MP_ANNOUNCE_DELETE:
case PARTITION_MP_EXTRACT_PROXY:
- the_packet = _Partition_MP_Get_packet();
- the_packet->Prefix.the_class = MP_PACKET_PARTITION;
- the_packet->Prefix.length = sizeof ( Partition_MP_Packet );
- the_packet->Prefix.to_convert = sizeof ( Partition_MP_Packet );
- the_packet->operation = operation;
- the_packet->Prefix.id = partition_id;
- the_packet->name = name;
- the_packet->proxy_id = proxy_id;
+ the_packet = _Partition_MP_Get_packet();
+ _Partition_MP_Initialize_packet( the_packet, partition_id, operation );
+ the_packet->name = name;
+ the_packet->proxy_id = proxy_id;
if ( operation == PARTITION_MP_EXTRACT_PROXY )
node = _Objects_Get_node( partition_id );
@@ -84,26 +93,26 @@ void _Partition_MP_Send_process_packet (
*
*/
-rtems_status_code _Partition_MP_Send_request_packet (
- Partition_MP_Remote_operations operation,
+static rtems_status_code _Partition_MP_Send_request_packet (
Objects_Id partition_id,
- void *buffer
+ void *buffer,
+ Partition_MP_Remote_operations operation
)
{
Partition_MP_Packet *the_packet;
+ if ( !_Partition_MP_Is_remote( partition_id ) ) {
+ return RTEMS_INVALID_ID;
+ }
+
switch ( operation ) {
case PARTITION_MP_GET_BUFFER_REQUEST:
case PARTITION_MP_RETURN_BUFFER_REQUEST:
- the_packet = _Partition_MP_Get_packet();
- the_packet->Prefix.the_class = MP_PACKET_PARTITION;
- the_packet->Prefix.length = sizeof ( Partition_MP_Packet );
- the_packet->Prefix.to_convert = sizeof ( Partition_MP_Packet );
- the_packet->operation = operation;
- the_packet->Prefix.id = partition_id;
- the_packet->buffer = buffer;
+ the_packet = _Partition_MP_Get_packet();
+ _Partition_MP_Initialize_packet( the_packet, partition_id, operation );
+ the_packet->buffer = buffer;
return
_MPCI_Send_request_packet(
@@ -130,6 +139,31 @@ rtems_status_code _Partition_MP_Send_request_packet (
return RTEMS_SUCCESSFUL;
}
+rtems_status_code _Partition_MP_Get_buffer(
+ rtems_id id,
+ void **buffer
+)
+{
+ _Thread_Get_executing()->Wait.return_argument = buffer;
+ return _Partition_MP_Send_request_packet(
+ id,
+ buffer,
+ PARTITION_MP_GET_BUFFER_REQUEST
+ );
+}
+
+rtems_status_code _Partition_MP_Return_buffer(
+ rtems_id id,
+ void *buffer
+)
+{
+ return _Partition_MP_Send_request_packet(
+ id,
+ buffer,
+ PARTITION_MP_RETURN_BUFFER_REQUEST
+ );
+}
+
/*
* _Partition_MP_Send_response_packet
*