[rtems-central commit] spec: Rework interrupt attributes

Sebastian Huber sebh at rtems.org
Wed Jul 14 10:27:41 UTC 2021


Module:    rtems-central
Branch:    master
Commit:    160a456f95ec8ed7e0792d7f1498d174e9635412
Changeset: http://git.rtems.org/rtems-central/commit/?id=160a456f95ec8ed7e0792d7f1498d174e9635412

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Jul 14 09:21:46 2021 +0200

spec: Rework interrupt attributes

---

 spec/rtems/intr/if/attributes.yml         |  41 +++++---
 spec/rtems/intr/if/signal-no.yml          |  17 +++
 spec/rtems/intr/if/signal-unspecified.yml |   2 +-
 spec/rtems/intr/if/signal-variant.yml     |   2 +
 spec/rtems/intr/req/entry-install.yml     | 156 +++++++++++++++++----------
 spec/rtems/intr/req/entry-remove.yml      | 168 +++++++++++++++++++++---------
 spec/rtems/intr/req/get-attributes.yml    |   1 +
 spec/rtems/intr/req/vector-disable.yml    |  70 ++++++++-----
 8 files changed, 312 insertions(+), 145 deletions(-)

diff --git a/spec/rtems/intr/if/attributes.yml b/spec/rtems/intr/if/attributes.yml
index 193d589..1280a17 100644
--- a/spec/rtems/intr/if/attributes.yml
+++ b/spec/rtems/intr/if/attributes.yml
@@ -33,9 +33,8 @@ definition:
     definition: bool ${.:name}
     description: |
       When an interrupt vector can be enabled, this means that the enabled
-      state can always be changed from disabled to enabled and from enabled to
-      enabled.  For an interrupt vector which can be enabled it follows that it
-      may be enabled.
+      state can always be changed from disabled to enabled.  For an interrupt
+      vector which can be enabled it follows that it may be enabled.
     kind: member
     name: can_enable
   variants: []
@@ -46,11 +45,10 @@ definition:
     definition: bool ${.:name}
     description: |
       When an interrupt vector may be enabled, this means that the enabled
-      state may be changed from disabled to enabled and from enabled to
-      enabled.  The requested enabled state change should be checked by
-      ${vector-is-enabled:/name}.  Some interrupt vectors may be optionally
-      avaialable and cannot be enabled on a particular
-      ${/glossary/target:/term}.
+      state may be changed from disabled to enabled.  The requested enabled
+      state change should be checked by ${vector-is-enabled:/name}.  Some
+      interrupt vectors may be optionally avaialable and cannot be enabled on a
+      particular ${/glossary/target:/term}.
     kind: member
     name: maybe_enable
   variants: []
@@ -61,13 +59,27 @@ definition:
     definition: bool ${.:name}
     description: |
       When an interrupt vector can be disabled, this means that the enabled
-      state can be changed from disabled to disabled and from enabled to
-      disabled.
+      state can be changed from enabled to disabled.  For an interrupt vector
+      which can be disabled it follows that it may be disabled.
     kind: member
     name: can_disable
   variants: []
 - default:
     brief: |
+      This member is true, if the interrupt vector may be disabled by
+      ${vector-disable:/name}, otherwise it is false.
+    definition: bool ${.:name}
+    description: |
+      When an interrupt vector may be disabled, this means that the enabled
+      state may be changed from enabled to disabled.  The requested enabled
+      state change should be checked by ${vector-is-enabled:/name}.  Some
+      interrupt vectors may be always enabled and cannot be disabled on a
+      particular ${/glossary/target:/term}.
+    kind: member
+    name: maybe_disable
+  variants: []
+- default:
+    brief: |
       This member is true, if the interrupt vector can be caused by
       ${cause:/name}, otherwise it is false.
     definition: bool ${.:name}
@@ -127,12 +139,12 @@ definition:
       vector can be triggered by a message.
     definition: bool ${.:name}
     description: |
-      Interrupts may be also triggered by signals, ${cause:/name} or
+      Interrupts may be also triggered by signals, ${cause:/name}, or
       ${cause-on:/name}.  Examples for message triggered interrupts are the
       PCIe MSI/MSI-X and the ARM GICv3 Locality-specific Peripheral Interrupts
       (LPI).
     kind: member
-    name: may_be_triggered_by_message
+    name: can_be_triggered_by_message
   variants: []
 - default:
     brief: |
@@ -140,8 +152,9 @@ definition:
       the interrupt vector.
     definition: ${signal-variant:/name} ${.:name}
     description: |
-      Interrupts may be also triggered by messages, ${cause:/name} or
-      ${cause-on:/name}.
+      Interrupts are normally triggered by signals which indicate an interrupt
+      request from a peripheral.  Interrupts may be also triggered by messages,
+      ${cause:/name}, or ${cause-on:/name}.
     kind: member
     name: trigger_signal
   variants: []
diff --git a/spec/rtems/intr/if/signal-no.yml b/spec/rtems/intr/if/signal-no.yml
new file mode 100644
index 0000000..9cc05a4
--- /dev/null
+++ b/spec/rtems/intr/if/signal-no.yml
@@ -0,0 +1,17 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+brief: |
+  This interrupt signal variant indicates that the interrupt cannot be
+  triggered by a signal.
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+definition:
+  default: null
+  variants: []
+description: null
+enabled-by: true
+index-entries: []
+interface-type: enumerator
+links: []
+name: RTEMS_INTERRUPT_NO_SIGNAL
+notes: null
+type: interface
diff --git a/spec/rtems/intr/if/signal-unspecified.yml b/spec/rtems/intr/if/signal-unspecified.yml
index 2850d2e..e30ce4d 100644
--- a/spec/rtems/intr/if/signal-unspecified.yml
+++ b/spec/rtems/intr/if/signal-unspecified.yml
@@ -12,6 +12,6 @@ enabled-by: true
 index-entries: []
 interface-type: enumerator
 links: []
-name: RTEMS_INTERRUPT_SIGNAL_UNSPECIFIED
+name: RTEMS_INTERRUPT_UNSPECIFIED_SIGNAL
 notes: null
 type: interface
diff --git a/spec/rtems/intr/if/signal-variant.yml b/spec/rtems/intr/if/signal-variant.yml
index eb30ea7..2e3ab17 100644
--- a/spec/rtems/intr/if/signal-variant.yml
+++ b/spec/rtems/intr/if/signal-variant.yml
@@ -16,6 +16,8 @@ links:
 - role: interface-enumerator
   uid: signal-unspecified
 - role: interface-enumerator
+  uid: signal-no
+- role: interface-enumerator
   uid: signal-level-low
 - role: interface-enumerator
   uid: signal-level-high
diff --git a/spec/rtems/intr/req/entry-install.yml b/spec/rtems/intr/req/entry-install.yml
index 67d2099..f7f0bb6 100644
--- a/spec/rtems/intr/req/entry-install.yml
+++ b/spec/rtems/intr/req/entry-install.yml
@@ -59,7 +59,7 @@ post-conditions:
       ${../../status/if/too-many:/name}.
   test-epilogue: null
   test-prologue: null
-- name: IsEnabled
+- name: Enable
   states:
   - name: Nop
     test-code: |
@@ -72,11 +72,30 @@ post-conditions:
       ${../if/entry-install:/name} call.
   - name: 'Yes'
     test-code: |
-      T_false( ctx->enabled_before );
-      T_true( ctx->enabled_after || ctx->interrupt_occurred );
+      if ( ctx->attributes.can_enable ) {
+        T_true( ctx->enabled_after || ctx->interrupt_occurred );
+      }
     text: |
       The interrupt vector specified by ${../if/entry-install:/params[0]/name}
       shall be enabled.
+  - name: Maybe
+    test-code: |
+      /* The comment of pre-condition ``CanEnable`` for the ``Yes`` state. */
+      if ( ctx->attributes.can_enable ) {
+        T_true( ctx->enabled_after || ctx->interrupt_occurred );
+      }
+    text: |
+      The interrupt vector specified by ${../if/entry-remove:/params[0]/name}
+      may be enabled.
+  - name: 'No'
+    test-code: |
+      /*
+       * Interrupt vectors which cannot be enabled are not selected as a
+       * testable interrupt vector by GetTestableInterruptVector().
+       */
+    text: |
+      The interrupt vector specified by ${../if/entry-remove:/params[0]/name}
+      shall not be enabled.
   test-epilogue: null
   test-prologue: null
 - name: Installed
@@ -113,7 +132,7 @@ post-conditions:
 
     ctx->visited_entries = 0;
     sc = rtems_interrupt_handler_iterate(
-      ctx->valid_vector,
+      ctx->test_vector,
       VisitInstalled,
       ctx
     );
@@ -123,7 +142,7 @@ pre-conditions:
   states:
   - name: Valid
     test-code: |
-      ctx->vector = ctx->valid_vector;
+      ctx->vector = ctx->test_vector;
     text: |
       While the ${../if/entry-install:/params[0]/name} parameter is
       associated with an interrupt vector.
@@ -230,6 +249,34 @@ pre-conditions:
       context.
   test-epilogue: null
   test-prologue: null
+- name: CanEnable
+  states:
+  - name: 'Yes'
+    test-code: |
+      /*
+       * This pre-condition depends on the attributes of an interrupt vector.
+       * For the validation test of ${../if/entry-install:/name} a testable
+       * interrupt vector is determined by GetTestableInterruptVector().  The
+       * implementation of ${../if/entry-install:/name} uses
+       * ${../if/vector-enable:/name} which is validated separately in detail.
+       */
+    text: |
+      While the interrupt vector associated with the
+      ${../if/entry-remove:/params[0]/name} parameter can be enabled.
+  - name: Maybe
+    test-code: |
+      /* See comment for ``Yes`` state */
+    text: |
+      While the interrupt vector associated with the
+      ${../if/entry-remove:/params[0]/name} parameter may be enabled.
+  - name: 'No'
+    test-code: |
+      /* See comment for ``Yes`` state */
+    text: |
+      While the interrupt vector associated with the
+      ${../if/entry-remove:/params[0]/name} parameter cannot be enabled.
+  test-epilogue: null
+  test-prologue: null
 - name: Installed
   states:
   - name: None
@@ -315,17 +362,17 @@ test-cleanup: |
   rtems_status_code sc;
 
   if ( ctx->third_installed ) {
-    sc = rtems_interrupt_entry_remove( ctx->valid_vector, &ctx->third_entry );
+    sc = rtems_interrupt_entry_remove( ctx->test_vector, &ctx->third_entry );
     T_rsc_success( sc );
   }
 
   if ( ctx->other_installed ) {
-    sc = rtems_interrupt_entry_remove( ctx->valid_vector, &ctx->other_entry );
+    sc = rtems_interrupt_entry_remove( ctx->test_vector, &ctx->other_entry );
     T_rsc_success( sc );
   }
 
   if ( ctx->status == RTEMS_SUCCESSFUL ) {
-    sc = rtems_interrupt_entry_remove( ctx->valid_vector, ctx->entry );
+    sc = rtems_interrupt_entry_remove( ctx->test_vector, ctx->entry );
     T_rsc_success( sc );
   }
 test-context:
@@ -340,10 +387,15 @@ test-context:
   member: |
     bool interrupt_occurred
 - brief: |
-    This member provides a valid interrupt vector number.
+    This member provides the vector number of a testable interrupt vector.
+  description: null
+  member: |
+    rtems_vector_number test_vector
+- brief: |
+    This member provides the attributes of the testable interrupt vector.
   description: null
   member: |
-    rtems_vector_number valid_vector
+    rtems_interrupt_attributes attributes
 - brief: |
     If this member is true, then the service shall be initialized.
   description: null
@@ -442,27 +494,12 @@ test-prepare: |
 test-setup:
   brief: null
   code: |
-    ctx->initialized_during_setup = bsp_interrupt_is_initialized();
+    rtems_status_code sc;
 
-    /* Find a valid interrupt vector for this test */
-    for (
-      ctx->valid_vector = 0;
-      ctx->valid_vector < BSP_INTERRUPT_VECTOR_COUNT;
-      ++ctx->valid_vector
-    ) {
-      rtems_status_code          sc;
-      rtems_interrupt_attributes attr;
-
-      sc = rtems_interrupt_get_attributes( ctx->valid_vector, &attr );
-
-      if (
-        sc == RTEMS_SUCCESSFUL && attr.can_enable && attr.can_disable &&
-        attr.is_maskable &&
-        !HasInterruptVectorEntriesInstalled( ctx->valid_vector )
-      ) {
-        break;
-      }
-    }
+    ctx->initialized_during_setup = bsp_interrupt_is_initialized();
+    ctx->test_vector = GetTestableInterruptVector();
+    sc = rtems_interrupt_get_attributes( ctx->test_vector, &ctx->attributes );
+    T_rsc_success( sc );
   description: null
 test-stop: null
 test-support: |
@@ -498,7 +535,7 @@ test-support: |
     );
 
     sc = rtems_interrupt_entry_install(
-      ctx->valid_vector,
+      ctx->test_vector,
       options,
       &ctx->other_entry
     );
@@ -514,7 +551,7 @@ test-support: |
 
     (void) arg;
     ctx = T_fixture_context();
-    sc = rtems_interrupt_vector_disable( ctx->valid_vector );
+    sc = rtems_interrupt_vector_disable( ctx->test_vector );
     T_rsc_success( sc );
 
     ctx->interrupt_occurred = true;
@@ -544,7 +581,7 @@ test-support: |
     );
 
     sc = rtems_interrupt_entry_install(
-      ctx->valid_vector,
+      ctx->test_vector,
       RTEMS_INTERRUPT_SHARED,
       &ctx->third_entry
     );
@@ -561,7 +598,7 @@ test-support: |
     ctx = arg;
 
     sc = rtems_interrupt_vector_is_enabled(
-      ctx->valid_vector,
+      ctx->test_vector,
       &ctx->enabled_before
     );
     T_rsc_success( sc );
@@ -583,7 +620,7 @@ test-support: |
     );
 
     sc = rtems_interrupt_vector_is_enabled(
-      ctx->valid_vector,
+      ctx->test_vector,
       &ctx->enabled_after
     );
     T_rsc_success( sc );
@@ -629,7 +666,8 @@ transition-map:
 - enabled-by: true
   post-conditions:
     Status: Ok
-    IsEnabled: 'Yes'
+    Enable:
+    - specified-by: CanEnable
     Installed: Last
   pre-conditions:
     Vector:
@@ -644,17 +682,14 @@ transition-map:
     - 'Yes'
     ISR:
     - 'No'
+    CanEnable: all
     Installed:
     - None
 - enabled-by: true
   post-conditions:
     Status: Ok
-    IsEnabled:
-    - if:
-        pre-conditions:
-          Installed: None
-      then: 'Yes'
-    - else: Nop
+    Enable:
+    - specified-by: CanEnable
     Installed: Last
   pre-conditions:
     Vector:
@@ -669,6 +704,7 @@ transition-map:
     - 'Yes'
     ISR:
     - 'No'
+    CanEnable: all
     Installed:
     - None
     - Other
@@ -677,7 +713,7 @@ transition-map:
 - enabled-by: true
   post-conditions:
     Status: InvAddr
-    IsEnabled: Nop
+    Enable: Nop
     Installed: N/A
   pre-conditions:
     Vector:
@@ -688,11 +724,12 @@ transition-map:
     Routine: N/A
     Init: all
     ISR: all
+    CanEnable: all
     Installed: all
 - enabled-by: true
   post-conditions:
     Status: InvAddr
-    IsEnabled: N/A
+    Enable: N/A
     Installed: N/A
   pre-conditions:
     Vector:
@@ -703,11 +740,12 @@ transition-map:
     Routine: N/A
     Init: all
     ISR: all
+    CanEnable: N/A
     Installed: N/A
 - enabled-by: true
   post-conditions:
     Status: IncStat
-    IsEnabled: Nop
+    Enable: Nop
     Installed: 'No'
   pre-conditions:
     Vector:
@@ -719,11 +757,12 @@ transition-map:
     Init:
     - 'No'
     ISR: all
+    CanEnable: all
     Installed: all
 - enabled-by: true
   post-conditions:
     Status: IncStat
-    IsEnabled: N/A
+    Enable: N/A
     Installed: N/A
   pre-conditions:
     Vector:
@@ -735,11 +774,12 @@ transition-map:
     Init:
     - 'No'
     ISR: all
+    CanEnable: N/A
     Installed: N/A
 - enabled-by: true
   post-conditions:
     Status: InvAddr
-    IsEnabled: Nop
+    Enable: Nop
     Installed: 'No'
   pre-conditions:
     Vector:
@@ -752,11 +792,12 @@ transition-map:
     Init:
     - 'Yes'
     ISR: all
+    CanEnable: all
     Installed: all
 - enabled-by: true
   post-conditions:
     Status: InvAddr
-    IsEnabled: N/A
+    Enable: N/A
     Installed: N/A
   pre-conditions:
     Vector:
@@ -769,11 +810,12 @@ transition-map:
     Init:
     - 'Yes'
     ISR: all
+    CanEnable: N/A
     Installed: N/A
 - enabled-by: true
   post-conditions:
     Status: InvId
-    IsEnabled: N/A
+    Enable: N/A
     Installed: N/A
   pre-conditions:
     Vector:
@@ -786,11 +828,12 @@ transition-map:
     Init:
     - 'Yes'
     ISR: all
+    CanEnable: N/A
     Installed: N/A
 - enabled-by: true
   post-conditions:
     Status: CalledFromISR
-    IsEnabled: Nop
+    Enable: Nop
     Installed: 'No'
   pre-conditions:
     Vector:
@@ -804,11 +847,12 @@ transition-map:
     - 'Yes'
     ISR:
     - 'Yes'
+    CanEnable: all
     Installed: all
 - enabled-by: true
   post-conditions:
     Status: InvNum
-    IsEnabled: Nop
+    Enable: Nop
     Installed: 'No'
   pre-conditions:
     Vector:
@@ -823,11 +867,12 @@ transition-map:
     - 'Yes'
     ISR:
     - 'No'
+    CanEnable: all
     Installed: all
 - enabled-by: true
   post-conditions:
     Status: InUse
-    IsEnabled: Nop
+    Enable: Nop
     Installed: 'No'
   pre-conditions:
     Vector:
@@ -842,6 +887,7 @@ transition-map:
     - 'Yes'
     ISR:
     - 'No'
+    CanEnable: all
     Installed:
     - Unique
     - Other
@@ -851,7 +897,7 @@ transition-map:
 - enabled-by: true
   post-conditions:
     Status: InUse
-    IsEnabled: Nop
+    Enable: Nop
     Installed: 'No'
   pre-conditions:
     Vector:
@@ -866,12 +912,13 @@ transition-map:
     - 'Yes'
     ISR:
     - 'No'
+    CanEnable: all
     Installed:
     - Unique
 - enabled-by: true
   post-conditions:
     Status: TooMany
-    IsEnabled: Nop
+    Enable: Nop
     Installed: 'No'
   pre-conditions:
     Vector:
@@ -886,6 +933,7 @@ transition-map:
     - 'Yes'
     ISR:
     - 'No'
+    CanEnable: all
     Installed:
     - Match
 type: requirement
diff --git a/spec/rtems/intr/req/entry-remove.yml b/spec/rtems/intr/req/entry-remove.yml
index bdde292..0310870 100644
--- a/spec/rtems/intr/req/entry-remove.yml
+++ b/spec/rtems/intr/req/entry-remove.yml
@@ -47,7 +47,7 @@ post-conditions:
       ${../../status/if/unsatisfied:/name}.
   test-epilogue: null
   test-prologue: null
-- name: IsEnabled
+- name: Disabled
   states:
   - name: Nop
     test-code: |
@@ -58,13 +58,32 @@ post-conditions:
       The enabled status of the interrupt vector specified by
       ${../if/entry-remove:/params[0]/name} shall not be modified by the
       ${../if/entry-remove:/name} call.
-  - name: 'No'
+  - name: 'Yes'
     test-code: |
-      T_true( ctx->enabled_before || ctx->interrupt_occurred );
-      T_false( ctx->enabled_after );
+      if ( ctx->attributes.can_disable ) {
+        T_false( ctx->enabled_after );
+      }
     text: |
       The interrupt vector specified by ${../if/entry-remove:/params[0]/name}
       shall be disabled.
+  - name: Maybe
+    test-code: |
+      /* The comment of pre-condition ``CanDisable`` for the ``Yes`` state. */
+      if ( ctx->attributes.can_disable ) {
+        T_false( ctx->enabled_after );
+      }
+    text: |
+      The interrupt vector specified by ${../if/entry-remove:/params[0]/name}
+      may be disabled.
+  - name: 'No'
+    test-code: |
+      /* The comment of pre-condition ``CanDisable`` for the ``Yes`` state. */
+      if ( ctx->attributes.can_disable ) {
+        T_false( ctx->enabled_after );
+      }
+    text: |
+      The interrupt vector specified by ${../if/entry-remove:/params[0]/name}
+      shall not be disabled.
   test-epilogue: null
   test-prologue: null
 - name: Installed
@@ -73,7 +92,7 @@ post-conditions:
     test-code: |
       ctx->visited_entries = 0;
       sc = rtems_interrupt_handler_iterate(
-        ctx->valid_vector,
+        ctx->test_vector,
         VisitInstalledNo,
         ctx
       );
@@ -91,13 +110,13 @@ post-conditions:
 
       if ( expected_entries > 0 ) {
         ctx->entry_counter = 0;
-        bsp_interrupt_handler_dispatch( ctx->valid_vector );
+        bsp_interrupt_handler_dispatch( ctx->test_vector );
         T_eq_u32( ctx->entry_counter, 0 );
       } else {
         rtems_interrupt_entry *first;
 
         first = bsp_interrupt_handler_table[
-          bsp_interrupt_handler_index( ctx->valid_vector )
+          bsp_interrupt_handler_index( ctx->test_vector )
         ];
         T_null( first );
       }
@@ -109,7 +128,7 @@ post-conditions:
     test-code: |
       ctx->visited_entries = 0;
       sc = rtems_interrupt_handler_iterate(
-        ctx->valid_vector,
+        ctx->test_vector,
         VisitInstalledNop,
         ctx
       );
@@ -129,7 +148,7 @@ post-conditions:
 
       if ( ctx->installed ) {
         ctx->entry_counter = 0;
-        bsp_interrupt_handler_dispatch( ctx->valid_vector );
+        bsp_interrupt_handler_dispatch( ctx->test_vector );
         T_eq_u32( ctx->entry_counter, 1 );
       }
     text: |
@@ -145,7 +164,7 @@ pre-conditions:
   states:
   - name: Valid
     test-code: |
-      ctx->vector = ctx->valid_vector;
+      ctx->vector = ctx->test_vector;
     text: |
       While the ${../if/entry-remove:/params[0]/name} parameter is
       associated with an interrupt vector.
@@ -267,6 +286,34 @@ pre-conditions:
       context.
   test-epilogue: null
   test-prologue: null
+- name: CanDisable
+  states:
+  - name: 'Yes'
+    test-code: |
+      /*
+       * This pre-condition depends on the attributes of an interrupt vector.
+       * For the validation test of ${../if/entry-remove:/name} a testable
+       * interrupt vector is determined by GetTestableInterruptVector().  The
+       * implementation of ${../if/entry-remove:/name} uses
+       * ${../if/vector-disable:/name} which is validated separately in detail.
+       */
+    text: |
+      While the interrupt vector associated with the
+      ${../if/entry-remove:/params[0]/name} parameter can be disabled.
+  - name: Maybe
+    test-code: |
+      /* See comment for ``Yes`` state */
+    text: |
+      While the interrupt vector associated with the
+      ${../if/entry-remove:/params[0]/name} parameter may be disabled.
+  - name: 'No'
+    test-code: |
+      /* See comment for ``Yes`` state */
+    text: |
+      While the interrupt vector associated with the
+      ${../if/entry-remove:/params[0]/name} parameter cannot be disabled.
+  test-epilogue: null
+  test-prologue: null
 - name: First
   states:
   - name: 'Yes'
@@ -348,17 +395,17 @@ test-cleanup: |
   rtems_status_code sc;
 
   if ( ctx->third_installed ) {
-    sc = rtems_interrupt_entry_remove( ctx->valid_vector, &ctx->third_entry );
+    sc = rtems_interrupt_entry_remove( ctx->test_vector, &ctx->third_entry );
     T_rsc_success( sc );
   }
 
   if ( ctx->other_installed ) {
-    sc = rtems_interrupt_entry_remove( ctx->valid_vector, &ctx->other_entry );
+    sc = rtems_interrupt_entry_remove( ctx->test_vector, &ctx->other_entry );
     T_rsc_success( sc );
   }
 
   if ( ctx->installed && ctx->status != RTEMS_SUCCESSFUL ) {
-    sc = rtems_interrupt_entry_remove( ctx->valid_vector, ctx->entry );
+    sc = rtems_interrupt_entry_remove( ctx->test_vector, ctx->entry );
     T_rsc_success( sc );
   }
 test-context:
@@ -419,10 +466,15 @@ test-context:
   member: |
     bool match
 - brief: |
-    This member provides a valid interrupt vector number.
+    This member provides the vector number of a testable interrupt vector.
+  description: null
+  member: |
+    rtems_vector_number test_vector
+- brief: |
+    This member provides the attributes of the testable interrupt vector.
   description: null
   member: |
-    rtems_vector_number valid_vector
+    rtems_interrupt_attributes attributes
 - brief: |
     If this member is true, then the service shall be initialized.
   description: null
@@ -490,27 +542,12 @@ test-prepare: |
 test-setup:
   brief: null
   code: |
-    ctx->initialized_during_setup = bsp_interrupt_is_initialized();
-
-    /* Find a valid interrupt vector for this test */
-    for (
-      ctx->valid_vector = 0;
-      ctx->valid_vector < BSP_INTERRUPT_VECTOR_COUNT;
-      ++ctx->valid_vector
-    ) {
-      rtems_status_code          sc;
-      rtems_interrupt_attributes attr;
-
-      sc = rtems_interrupt_get_attributes( ctx->valid_vector, &attr );
+    rtems_status_code sc;
 
-      if (
-        sc == RTEMS_SUCCESSFUL && attr.can_enable && attr.can_disable &&
-        attr.is_maskable &&
-        !HasInterruptVectorEntriesInstalled( ctx->valid_vector )
-      ) {
-        break;
-      }
-    }
+    ctx->initialized_during_setup = bsp_interrupt_is_initialized();
+    ctx->test_vector = GetTestableInterruptVector();
+    sc = rtems_interrupt_get_attributes( ctx->test_vector, &ctx->attributes );
+    T_rsc_success( sc );
   description: null
 test-stop: null
 test-support: |
@@ -541,7 +578,7 @@ test-support: |
     );
 
     sc = rtems_interrupt_entry_install(
-      ctx->valid_vector,
+      ctx->test_vector,
       RTEMS_INTERRUPT_SHARED,
       entry
     );
@@ -555,7 +592,7 @@ test-support: |
 
     (void) arg;
     ctx = T_fixture_context();
-    sc = rtems_interrupt_vector_disable( ctx->valid_vector );
+    sc = rtems_interrupt_vector_disable( ctx->test_vector );
     T_rsc_success( sc );
 
     ctx->interrupt_occurred = true;
@@ -586,7 +623,7 @@ test-support: |
     ctx = arg;
 
     sc = rtems_interrupt_vector_is_enabled(
-      ctx->valid_vector,
+      ctx->test_vector,
       &ctx->enabled_before
     );
     T_rsc_success( sc );
@@ -604,7 +641,7 @@ test-support: |
     );
 
     sc = rtems_interrupt_vector_is_enabled(
-      ctx->valid_vector,
+      ctx->test_vector,
       &ctx->enabled_after
     );
     T_rsc_success( sc );
@@ -694,12 +731,12 @@ transition-map:
 - enabled-by: true
   post-conditions:
     Status: Ok
-    IsEnabled:
+    Disabled:
     - if:
         pre-conditions:
           First: 'Yes'
           Last: 'Yes'
-      then: 'No'
+      then-specified-by: CanDisable
     - else: Nop
     Installed: 'No'
   pre-conditions:
@@ -715,12 +752,13 @@ transition-map:
     - 'Yes'
     ISR:
     - 'No'
+    CanDisable: all
     First: all
     Last: all
 - enabled-by: true
   post-conditions:
     Status: Unsat
-    IsEnabled: Nop
+    Disabled: Nop
     Installed: N/A
   pre-conditions:
     Vector:
@@ -736,12 +774,13 @@ transition-map:
     - 'Yes'
     ISR:
     - 'No'
+    CanDisable: all
     First: N/A
     Last: N/A
 - enabled-by: true
   post-conditions:
     Status: InvAddr
-    IsEnabled: Nop
+    Disabled: Nop
     Installed: N/A
   pre-conditions:
     Vector:
@@ -752,12 +791,13 @@ transition-map:
     EntryObj: N/A
     Init: all
     ISR: all
+    CanDisable: all
     First: N/A
     Last: N/A
 - enabled-by: true
   post-conditions:
     Status: InvAddr
-    IsEnabled: N/A
+    Disabled: N/A
     Installed: N/A
   pre-conditions:
     Vector:
@@ -768,15 +808,35 @@ transition-map:
     EntryObj: N/A
     Init: all
     ISR: all
+    CanDisable: N/A
     First: N/A
     Last: N/A
 - enabled-by: true
   post-conditions:
     Status: IncStat
-    IsEnabled: Nop
+    Disabled: Nop
     Installed: N/A
   pre-conditions:
-    Vector: all
+    Vector:
+    - Valid
+    Entry:
+    - Obj
+    Routine: all
+    EntryObj: N/A
+    Init:
+    - 'No'
+    ISR: all
+    CanDisable: all
+    First: N/A
+    Last: N/A
+- enabled-by: true
+  post-conditions:
+    Status: IncStat
+    Disabled: N/A
+    Installed: N/A
+  pre-conditions:
+    Vector:
+    - Invalid
     Entry:
     - Obj
     Routine: all
@@ -784,12 +844,13 @@ transition-map:
     Init:
     - 'No'
     ISR: all
+    CanDisable: N/A
     First: N/A
     Last: N/A
 - enabled-by: true
   post-conditions:
     Status: InvAddr
-    IsEnabled: Nop
+    Disabled: Nop
     Installed: N/A
   pre-conditions:
     Vector:
@@ -802,12 +863,13 @@ transition-map:
     Init:
     - 'Yes'
     ISR: all
+    CanDisable: all
     First: N/A
     Last: N/A
 - enabled-by: true
   post-conditions:
     Status: InvAddr
-    IsEnabled: N/A
+    Disabled: N/A
     Installed: N/A
   pre-conditions:
     Vector:
@@ -819,13 +881,14 @@ transition-map:
     EntryObj: N/A
     Init:
     - 'Yes'
+    CanDisable: N/A
     ISR: all
     First: N/A
     Last: N/A
 - enabled-by: true
   post-conditions:
     Status: InvId
-    IsEnabled: N/A
+    Disabled: N/A
     Installed: N/A
   pre-conditions:
     Vector:
@@ -838,12 +901,13 @@ transition-map:
     Init:
     - 'Yes'
     ISR: all
+    CanDisable: N/A
     First: N/A
     Last: N/A
 - enabled-by: true
   post-conditions:
     Status: CalledFromISR
-    IsEnabled: Nop
+    Disabled: Nop
     Installed: Nop
   pre-conditions:
     Vector:
@@ -858,12 +922,13 @@ transition-map:
     - 'Yes'
     ISR:
     - 'Yes'
+    CanDisable: all
     First: all
     Last: all
 - enabled-by: true
   post-conditions:
     Status: CalledFromISR
-    IsEnabled: Nop
+    Disabled: Nop
     Installed: N/A
   pre-conditions:
     Vector:
@@ -879,6 +944,7 @@ transition-map:
     - 'Yes'
     ISR:
     - 'Yes'
+    CanDisable: all
     First: N/A
     Last: N/A
 type: requirement
diff --git a/spec/rtems/intr/req/get-attributes.yml b/spec/rtems/intr/req/get-attributes.yml
index ca19c36..687c2f7 100644
--- a/spec/rtems/intr/req/get-attributes.yml
+++ b/spec/rtems/intr/req/get-attributes.yml
@@ -125,6 +125,7 @@ test-action: |
       }
 
       if ( ctx->attributes_obj.can_disable ) {
+        T_true( ctx->attributes_obj.maybe_disable );
         T_true(
           ctx->attributes_obj.can_enable || ctx->attributes_obj.maybe_enable
         );
diff --git a/spec/rtems/intr/req/vector-disable.yml b/spec/rtems/intr/req/vector-disable.yml
index 15ac756..187cef0 100644
--- a/spec/rtems/intr/req/vector-disable.yml
+++ b/spec/rtems/intr/req/vector-disable.yml
@@ -56,6 +56,15 @@ post-conditions:
     text: |
       The interrupt vector specified by ${../if/vector-disable:/params[0]/name}
       shall be disabled.
+  - name: Maybe
+    test-code: |
+      /*
+       * Validation is done by CheckVectorDisable() for each interrupt
+       * vector.
+       */
+    text: |
+      The interrupt vector specified by ${../if/vector-disable:/params[0]/name}
+      may be disabled.
   test-epilogue: null
   test-prologue: null
 pre-conditions:
@@ -107,7 +116,16 @@ pre-conditions:
        */
     text: |
       While the interrupt vector associated with the
-      ${../if/vector-disable:/params[0]/name} parameter can be enabled.
+      ${../if/vector-disable:/params[0]/name} parameter can be disabled.
+  - name: Maybe
+    test-code: |
+      /*
+       * This pre-condition depends on the attributes of an interrupt vector,
+       * see CheckVectorDisable().
+       */
+    text: |
+      While the interrupt vector associated with the
+      ${../if/vector-disable:/params[0]/name} parameter may be disabled.
   - name: 'No'
     test-code: |
       /*
@@ -116,7 +134,7 @@ pre-conditions:
        */
     text: |
       While the interrupt vector associated with the
-      ${../if/vector-disable:/params[0]/name} parameter cannot be enabled.
+      ${../if/vector-disable:/params[0]/name} parameter cannot be disabled.
   test-epilogue: null
   test-prologue: null
 rationale: null
@@ -144,7 +162,6 @@ test-action: |
       T_rsc_success( sc );
 
       has_installed_entries = HasInterruptVectorEntriesInstalled( ctx->vector );
-
       CheckVectorDisable( ctx, &attr, has_installed_entries );
     }
   } else {
@@ -262,21 +279,16 @@ test-support: |
   {
     rtems_status_code sc;
 
-    if ( has_installed_entries ) {
+    if ( !attr->maybe_disable ) {
+      CheckUnsatisfied( ctx );
+    } else if ( has_installed_entries ) {
       T_true( IsEnabled( ctx ) );
-
-      if ( attr->can_enable && attr->can_disable ) {
-        Disable( ctx );
-        T_false( IsEnabled( ctx ) );
-        Enable( ctx );
-      } else if ( !attr->can_disable ) {
-        CheckUnsatisfied( ctx );
-      }
-
+      Disable( ctx );
+      T_true( !attr->can_disable || !IsEnabled( ctx ) );
+      Enable( ctx );
       T_true( IsEnabled( ctx ) );
-    } else if ( attr->can_enable && attr->can_disable && attr->is_maskable ) {
+    } else if ( attr->is_maskable && attr->maybe_enable && attr->can_disable ) {
       rtems_interrupt_entry entry;
-      bool                  enabled;
 
       ctx->interrupt_occurred = false;
       rtems_interrupt_entry_initialize( &entry, EntryRoutine, ctx, "Info" );
@@ -287,21 +299,23 @@ test-support: |
       );
       T_rsc_success( sc );
 
-      Disable( ctx );
-      T_false( IsEnabled( ctx ) );
-      Enable( ctx );
+      if ( IsEnabled( ctx ) ) {
+        bool enabled;
 
-      enabled = false;
-      sc = rtems_interrupt_vector_is_enabled( ctx->vector, &enabled );
-      T_rsc_success( sc );
-      T_true( enabled || ctx->interrupt_occurred );
+        Disable( ctx );
+        T_false( IsEnabled( ctx ) );
+        Enable( ctx );
+
+        enabled = false;
+        sc = rtems_interrupt_vector_is_enabled( ctx->vector, &enabled );
+        T_rsc_success( sc );
+        T_true( enabled || ctx->interrupt_occurred );
+      }
 
       sc = rtems_interrupt_entry_remove( ctx->vector, &entry );
       T_rsc_success( sc );
 
       T_false( IsEnabled( ctx ) );
-    } else if ( !attr->can_disable ) {
-      CheckUnsatisfied( ctx );
     }
   }
 test-target: testsuites/validation/tc-intr-vector-disable.c
@@ -311,13 +325,19 @@ transition-map:
 - enabled-by: true
   post-conditions:
     Status: Ok
-    IsEnabled: 'No'
+    IsEnabled:
+    - if:
+        pre-conditions:
+          CanDisable: 'Yes'
+      then: 'No'
+    - else: Maybe
   pre-conditions:
     Vector:
     - Valid
     IsEnabled: all
     CanDisable:
     - 'Yes'
+    - Maybe
 - enabled-by: true
   post-conditions:
     Status: InvId



More information about the vc mailing list