From 33ed4123c0f3e6193beb8d6a22d46c9983d0df79 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 20 Sep 2019 09:16:17 +0200 Subject: 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 fad0fc661f..0e62d76acb 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 28030c2181..122901d796 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 @@ -560,6 +560,28 @@ void rtems_interrupt_server_entry_submit( rtems_interrupt_server_entry *entry ); +/** + * @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. * -- cgit v1.2.3