bsps: Generalize bsp_fdt_map_intr()

Pass all interrupt cells to bsp_fdt_map_intr() since some platforms use
an array to describe an interrupt.

Update #3090.
This commit is contained in:
Sebastian Huber
2017-09-13 07:00:57 +02:00
parent 29919242db
commit 05f9858ffd
5 changed files with 12 additions and 9 deletions

View File

@@ -29,7 +29,7 @@ void bsp_start(void)
printk("\nRTEMS Beagleboard: %s\n", type); printk("\nRTEMS Beagleboard: %s\n", type);
} }
uint32_t bsp_fdt_map_intr(uint32_t intr) uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells)
{ {
return intr; return intr[0];
} }

View File

@@ -86,7 +86,9 @@ static void imx_uart_init_context(
#ifdef CONSOLE_USE_INTERRUPTS #ifdef CONSOLE_USE_INTERRUPTS
val = fdt_getprop(fdt, node, "interrupts", &len); val = fdt_getprop(fdt, node, "interrupts", &len);
if (val != NULL && len >= 8) { if (val != NULL && len >= 8) {
ctx->irq = bsp_fdt_map_intr(fdt32_to_cpu(val[1])); uint32_t cpu_val[2];
cpu_val[1] = fdt32_to_cpu(val[1]);
ctx->irq = bsp_fdt_map_intr(cpu_val, 2);
} }
#endif #endif
} }

View File

@@ -20,9 +20,9 @@
#include <libfdt.h> #include <libfdt.h>
uint32_t bsp_fdt_map_intr(uint32_t intr) uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells)
{ {
return intr + 32; return intr[1] + 32;
} }
void arm_generic_timer_get_config( void arm_generic_timer_get_config(

View File

@@ -205,7 +205,7 @@ void bsp_start(void)
#endif #endif
} }
uint32_t bsp_fdt_map_intr(uint32_t intr) uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells)
{ {
return intr - 16; return intr[0] - 16;
} }

View File

@@ -53,11 +53,12 @@ const void *bsp_fdt_get(void);
* This function is used by the libbsd to implement the OFW_BUS_MAP_INTR bus * This function is used by the libbsd to implement the OFW_BUS_MAP_INTR bus
* method. * method.
* *
* @param[in] intr The FDT interrupt number. * @param[in] intr The FDT interrupt number cells.
* @param[in] icells The FDT interrupt cell count.
* *
* @return The interrupt vector of the FDT interrupt number. * @return The interrupt vector of the FDT interrupt number.
*/ */
uint32_t bsp_fdt_map_intr(uint32_t intr); uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells);
#ifdef __cplusplus #ifdef __cplusplus
} }