bsp/arm/tms570: protect against vector < 2 in irq_set_priority

calls to tms570_irq_set_priority protect against requesting a
priority < 2, but not against inputs with vector < 2.

for example calling tms570_irq_set_priority(ESM_HIGH, 10)
will not only get through the guard, it will attempt to write
to CHANCTRL0 (which gets blocked by hardware), puts whatever
was there (apparently hardcoded INT-REQ0) into channel 10,
and returns success.

So the channel 10 request dissappeared from the VIM channel
map completely - yet this call returns RTEMS_SUCCESSFUL

TRM (for both TMS570LS31x and TMS570LC43x) states:
NOTE: CHAN0 and CHAN1 are hard wired to INT_REQ0 and
INT_REQ1, so they cannot be remapped.

This commit puts a guard to fail on requests with vector < 2.
This commit is contained in:
Avi Weiss
2026-07-12 15:45:29 +03:00
parent 155f798c0a
commit e07f69641b
2 changed files with 8 additions and 1 deletions
+3 -1
View File
@@ -152,6 +152,8 @@
* channel associated with the priority is assigned to this channel. The
* specified interrupt vector is assigned to the channel associated with the
* priority. So, this function swaps the channels of two interrupt vectors.
* Interrupt vectors 0 and 1 cannot be reprioritized because the corresponding
* VIM channels are hardwired to INT_REQ0 and INT_REQ1 (FIQ requests).
*
* @param vector is the number of the interrupt vector to set the priority.
*
@@ -160,7 +162,7 @@
* @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
*
* @retval ::RTEMS_INVALID_ID There was no interrupt vector associated with the
* number specified by ``vector``.
* number specified by ``vector``, or the vector cannot be remapped.
*
* @retval ::RTEMS_INVALID_PRIORITY The interrupt priority specified in
* ``priority`` was invalid.
+5
View File
@@ -79,6 +79,11 @@ rtems_status_code tms570_irq_set_priority(
return RTEMS_INVALID_ID;
}
/* CHAN0 & CHAN1 are hard wired to INT_REQ0 & INT_REQ1 and can't be remapped. */
if (vector < 2) {
return RTEMS_INVALID_ID;
}
if (priority < 2) {
return RTEMS_INVALID_PRIORITY;
}