[rtems commit] rtems: Add rtems_interrupt_server_entry_move()

Sebastian Huber sebh at rtems.org
Fri Sep 20 07:24:29 UTC 2019


Module:    rtems
Branch:    master
Commit:    33ed4123c0f3e6193beb8d6a22d46c9983d0df79
Changeset: http://git.rtems.org/rtems/commit/?id=33ed4123c0f3e6193beb8d6a22d46c9983d0df79

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Sep 20 09:16:17 2019 +0200

rtems: Add rtems_interrupt_server_entry_move()

The use case for this function is the libbsd.  In FreeBSD, the interrupt
setup and binding to a processor is done in two steps.  Message
based interrupts like PCIe MSI and MSI-X interrupts can be implemented
through interrupt server entries.  They are setup at the default
interrupt server and may optionally move to an interrupt server bound to
a specific processor.

---

 bsps/shared/irq/irq-server.c         | 17 +++++++++++++++++
 cpukit/include/rtems/irq-extension.h | 24 +++++++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/bsps/shared/irq/irq-server.c b/bsps/shared/irq/irq-server.c
index fad0fc6..0e62d76 100644
--- a/bsps/shared/irq/irq-server.c
+++ b/bsps/shared/irq/irq-server.c
@@ -638,6 +638,23 @@ void rtems_interrupt_server_entry_submit(
   bsp_interrupt_server_trigger(entry);
 }
 
+rtems_status_code rtems_interrupt_server_entry_move(
+  rtems_interrupt_server_entry *entry,
+  uint32_t                      destination_server_index
+)
+{
+  rtems_status_code sc;
+  bsp_interrupt_server_context *s;
+
+  s = bsp_interrupt_server_get_context(destination_server_index, &sc);
+  if (s == NULL) {
+    return sc;
+  }
+
+  entry->server = s;
+  return RTEMS_SUCCESSFUL;
+}
+
 static void bsp_interrupt_server_entry_synchronize_helper(void *arg)
 {
   bsp_interrupt_server_helper_data *hd = arg;
diff --git a/cpukit/include/rtems/irq-extension.h b/cpukit/include/rtems/irq-extension.h
index 28030c2..122901d 100644
--- a/cpukit/include/rtems/irq-extension.h
+++ b/cpukit/include/rtems/irq-extension.h
@@ -9,7 +9,7 @@
 /*
  * Based on concepts of Pavel Pisa, Till Straumann and Eric Valette.
  *
- * Copyright (c) 2008, 2017 embedded brains GmbH.
+ * Copyright (C) 2008, 2019 embedded brains GmbH
  *
  *  embedded brains GmbH
  *  Dornierstr. 4
@@ -561,6 +561,28 @@ void rtems_interrupt_server_entry_submit(
 );
 
 /**
+ * @brief Moves the interrupt server entry to the specified destination
+ * interrupt server.
+ *
+ * Calling this function concurrently with rtems_interrupt_server_entry_submit()
+ * with the same entry or while the entry is enqueued on the previous interrupt
+ * server is undefined behaviour.
+ *
+ * @param[in,out] entry The interrupt server entry.  It must have be initialized
+ *   before the call to this function.
+ * @param destination_server_index The destination interrupt server index.
+ *   Use @c RTEMS_INTERRUPT_SERVER_DEFAULT to specify the default server.
+ *
+ * @retval RTEMS_SUCCESSFUL Successful operation
+ * @retval RTEMS_INCORRECT_STATE The interrupt servers are not initialized.
+ * @retval RTEMS_INVALID_ID The destination interrupt server index is invalid.
+ */
+rtems_status_code rtems_interrupt_server_entry_move(
+  rtems_interrupt_server_entry *entry,
+  uint32_t                      destination_server_index
+);
+
+/**
  * @brief Destroys the specified interrupt server entry.
  *
  * This function must be called from thread context.  It may block.  Calling




More information about the vc mailing list