bsps/x86_64/amd64: Implement the vector operations

rtems_interrupt_vector_is_enabled() and rtems_interrupt_clear() returned
RTEMS_UNSATISFIED for every vector, while enable and disable claimed
success without doing anything, and the attributes said nothing about
either.  ts-validation-intr reported 1664 failed steps.

The three vectors which are left are delivered by the Local APIC.  Only
the local vector table entry of the timer has a mask bit, so it is the
only one which can be enabled and disabled.  The interprocessor and
software vectors are delivered by a write to the interrupt command
register and nothing masks them, so they are always enabled and the
attributes say that they cannot be disabled.

ts-validation-intr now has no failed step.

Update #5692.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This commit is contained in:
Sebastian Huber authored and Joel Sherrill committed 2026-08-20 17:42:07 -05:00
1 parent 7989b9773a
commit 148ee1ed77
3 files changed
+71 -13

No files matched your search

+16
View File
@@ -206,6 +206,22 @@ uint32_t lapic_timer_calc_ticks(uint64_t desired_freq_hz);
*/
void lapic_timer_enable(uint32_t reload_value);
/**
* @brief Masks or unmasks the local vector table entry of the Local APIC
* timer.
*
* @param masked Mask the entry, if true, otherwise unmask it.
*/
void lapic_timer_set_masked(bool masked);
/**
* @brief Checks if the local vector table entry of the Local APIC timer is
* masked.
*
* @return true if the entry is masked.
*/
bool lapic_timer_is_masked(void);
/**
* @brief Raises the interrupt vector on the processor executing this function.
*
+18
View File
@@ -319,6 +319,24 @@ void lapic_timer_enable(uint32_t reload_value)
amd64_lapic_base[LAPIC_REGISTER_TIMER_INITCNT] = reload_value;
}
void lapic_timer_set_masked(bool masked)
{
uint32_t lvt = amd64_lapic_base[LAPIC_REGISTER_LVT_TIMER];
if (masked) {
lvt |= LAPIC_LVT_MASK;
} else {
lvt &= ~LAPIC_LVT_MASK;
}
amd64_lapic_base[LAPIC_REGISTER_LVT_TIMER] = lvt;
}
bool lapic_timer_is_masked(void)
{
return (amd64_lapic_base[LAPIC_REGISTER_LVT_TIMER] & LAPIC_LVT_MASK) != 0;
}
void lapic_raise_self(uint32_t vector)
{
amd64_lapic_base[LAPIC_REGISTER_ICR_LOW] =
+37 -13
View File
@@ -202,11 +202,20 @@ void bsp_interrupt_facility_initialize(void)
}
}
/*
* Only the local vector table entry of the Local APIC timer has a mask bit.
* The interprocessor and software vectors are delivered by a write to the
* interrupt command register and there is nothing which masks them.
*/
rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
{
(void) vector;
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
/* XXX: Should be implemented once I/O APIC support is added */
if (vector != BSP_VECTOR_APIC_TIMER) {
return RTEMS_UNSATISFIED;
}
lapic_timer_set_masked(true);
return RTEMS_SUCCESSFUL;
}
@@ -240,13 +249,20 @@ rtems_status_code bsp_interrupt_get_attributes(
rtems_interrupt_attributes *attributes
)
{
if (vector >= BSP_VECTOR_APIC_FIRST) {
attributes->is_maskable = true;
attributes->can_raise = true;
attributes->cleared_by_acknowledge = true;
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
attributes->is_maskable = true;
attributes->can_raise = true;
attributes->cleared_by_acknowledge = true;
#ifdef RTEMS_SMP
attributes->can_raise_on = true;
attributes->can_raise_on = true;
#endif
if (vector == BSP_VECTOR_APIC_TIMER) {
attributes->can_enable = true;
attributes->maybe_enable = true;
attributes->can_disable = true;
attributes->maybe_disable = true;
}
return RTEMS_SUCCESSFUL;
@@ -285,19 +301,27 @@ rtems_status_code bsp_interrupt_vector_is_enabled(
bool *enabled
)
{
(void) vector;
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
bsp_interrupt_assert(enabled != NULL);
*enabled = false;
return RTEMS_UNSATISFIED;
if (vector == BSP_VECTOR_APIC_TIMER) {
*enabled = !lapic_timer_is_masked();
} else {
*enabled = true;
}
return RTEMS_SUCCESSFUL;
}
rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
{
(void) vector;
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
/* XXX: Should be implemented once I/O APIC support is added */
if (vector != BSP_VECTOR_APIC_TIMER) {
return RTEMS_UNSATISFIED;
}
lapic_timer_set_masked(false);
return RTEMS_SUCCESSFUL;
}