<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en" style="--code-editor-font: var(--default-mono-font, "GitLab Mono"), JetBrains Mono, Menlo, DejaVu Sans Mono, Liberation Mono, Consolas, Ubuntu Mono, Courier New, andale mono, lucida console, monospace;">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>
GitLab
</title>

<style data-premailer="ignore" type="text/css">
a { color: #1068bf; }
</style>

<style>img {
max-width: 100%; height: auto;
}
body {
font-size: .875rem;
}
body {
-webkit-text-shadow: hsla(0,0%,100%,.01) 0 0 1px;
}
body {
font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; font-size: inherit;
}
</style>
</head>
<body style="font-size: inherit; -webkit-text-shadow: hsla(0,0%,100%,.01) 0 0 1px; font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";">
<div class="content">

<p class="details" style="font-style: italic; color: #626168;">
Issue created by <a href="https://gitlab.rtems.org/sebhub">Sebastian Huber</a>: <a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5790">#5790</a>
</p>
<div class="md" style="position: relative; z-index: 1; color: #3a383f; word-wrap: break-word;">
<h2 id="user-content-summary" dir="auto" style="margin-top: 0px; margin-bottom: 10px;" align="initial">Summary<a href="#summary" aria-label="Link to heading 'Summary'" data-heading-content="Summary" class="anchor" style="margin-top: 0px;"></a>
</h2>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">The drivers in <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">bsps/riscv/riscv/irq/irq.c</code> and
<code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">bsps/riscv/riscv/clock/clockdrv.c</code> read the hardware facts from the device
tree. These are the CLINT base, the PLIC base, the PLIC contexts, the
interrupt count, the timebase frequency and the hart count. A BSP which
finds them through AMBA Plug & Play or at fixed addresses cannot use the
drivers. Merge request <a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1471" title="bsps/riscv: Update NOEL BSPs" class="gfm gfm-merge_request" data-original="!1471" data-link="false" data-link-reference="false" data-merge-request="2983" data-project="26" data-project-path="rtems/rtos/rtems" data-iid="1471" data-container="body" data-placement="top" data-reference-type="merge_request">!1471</a> therefore copies both drivers into
<code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">bsps/riscv/noel/</code>. The copies diverge already. The NOEL copy assigns no
priority to the last PLIC source, so this source never fires.</p>
<h2 id="user-content-proposal" dir="auto" style="margin-top: 20px; margin-bottom: 10px;" align="initial">Proposal<a href="#proposal" aria-label="Link to heading 'Proposal'" data-heading-content="Proposal" class="anchor" style="margin-top: 0px;"></a>
</h2>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">Move the drivers to <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">bsps/riscv/shared/</code>. Each BSP provides
<code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;"><bsp/irqimpl.h></code>. It defines the hardware facts as static inline
functions:</p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre data-canonical-lang="c" class="code highlight js-syntax-highlight language-c" v-pre="true" style="display: block; font-size: 14px; color: #3a383f; line-height: 1.6em; overflow-x: auto; border-radius: .25rem; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: #fbfafd; margin: 0px 0 1rem; padding: 12px; border: 1px solid #dcdcde;"><code style="font-size: inherit; color: inherit; word-wrap: normal; word-break: keep-all; background-color: inherit; border-radius: .25rem; white-space: pre; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; overflow-wrap: normal; padding: unset;"><span id="LC1" class="line" data-lang="c" style="margin-top: 0px;"><span class="k" style="margin-top: 0px;">static</span> <span class="kr">inline</span> <span class="k">volatile</span> <span class="n">RISCV_CLINT_regs</span> <span class="o">*</span><span class="nf">riscv_clint_get</span><span class="p">(</span> <span class="kt">void</span> <span class="p">);</span></span>
<span id="LC2" class="line" data-lang="c"><span class="k" style="margin-top: 0px;">static</span> <span class="kr">inline</span> <span class="k">volatile</span> <span class="n">RISCV_PLIC_regs</span>  <span class="o">*</span><span class="nf">riscv_plic_get</span><span class="p">(</span> <span class="kt">void</span> <span class="p">);</span></span>
<span id="LC3" class="line" data-lang="c"><span class="k" style="margin-top: 0px;">static</span> <span class="kr">inline</span> <span class="kt">uint32_t</span> <span class="nf">riscv_plic_get_context</span><span class="p">(</span> <span class="kt">uint32_t</span> <span class="n">hart_index</span> <span class="p">);</span></span>
<span id="LC4" class="line" data-lang="c"><span class="k" style="margin-top: 0px;">static</span> <span class="kr">inline</span> <span class="kt">uint32_t</span> <span class="nf">riscv_plic_get_interrupt_count</span><span class="p">(</span> <span class="kt">void</span> <span class="p">);</span></span>
<span id="LC5" class="line" data-lang="c"><span class="k" style="margin-top: 0px;">static</span> <span class="kr">inline</span> <span class="kt">uint32_t</span> <span class="nf">riscv_get_timebase_frequency</span><span class="p">(</span> <span class="kt">void</span> <span class="p">);</span></span>
<span id="LC6" class="line" data-lang="c"><span class="k" style="margin-top: 0px;">static</span> <span class="kr">inline</span> <span class="kt">uint32_t</span> <span class="nf">riscv_get_hart_count</span><span class="p">(</span> <span class="kt">void</span> <span class="p">);</span></span></code></pre>
<copy-code></copy-code><insert-code-snippet></insert-code-snippet>
</div>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">The BSP chooses how each function gets its value:</p>
<table dir="auto" style="border-spacing: 0; text-align: initial; color: #3a383f; width: auto; border-collapse: collapse; border-width: 0;">
<thead style="margin-top: 0px;">
<tr style="margin-top: 0px;">
<th style="line-height: 1.25rem; color: #18171d; margin-top: 0px; padding: 10px 16px; border-color: #dcdcde; border-style: solid; border-width: 1px 1px 0;" valign="top">BSP</th>
<th style="line-height: 1.25rem; color: #18171d; padding: 10px 16px; border-color: #dcdcde; border-style: solid; border-width: 1px 1px 0;" valign="top">Value</th>
</tr>
</thead>
<tbody>
<tr style="margin-top: 0px;">
<td style="line-height: 1.25rem; margin-top: 0px; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top">riscv</td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top">variable, set from the device tree</td>
</tr>
<tr>
<td style="line-height: 1.25rem; margin-top: 0px; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top">noel</td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top">variable, set from AMBA Plug & Play</td>
</tr>
<tr>
<td style="line-height: 1.25rem; margin-top: 0px; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top">BSP with fixed addresses</td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top">constant from a BSP option</td>
</tr>
</tbody>
</table>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">The sparc BSPs use the same header and the same pattern, see
<code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">LEON3_IrqCtrl_Regs</code> in the leon3 <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;"><bsp/irqimpl.h></code>. The refactoring does
not change the behaviour of the existing BSPs. The author of <a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1471" title="bsps/riscv: Update NOEL BSPs" class="gfm gfm-merge_request" data-original="!1471" data-link="false" data-link-reference="false" data-merge-request="2983" data-project="26" data-project-path="rtems/rtos/rtems" data-iid="1471" data-container="body" data-placement="top" data-reference-type="merge_request">!1471</a> agreed
to the proposal on 2026-10-01.</p>
<p dir="auto" style="color: #3a383f; margin: 0px;" align="initial">This description was created with Claude Code assistance.</p>
</div>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #626168;">
—
<br>
<a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5790">View it on GitLab</a>.
<br>
You're receiving this email because of your account on <a target="_blank" rel="noopener noreferrer" href="https://gitlab.rtems.org">gitlab.rtems.org</a>. <a href="https://gitlab.rtems.org/-/namespace/49/sent_notifications/5-df2j3zqr3cgnjkxbarxu6vv1p-1d/unsubscribe" target="_blank" rel="noopener noreferrer">Unsubscribe</a> from this thread · <a href="https://gitlab.rtems.org/-/profile/notifications" target="_blank" rel="noopener noreferrer" class="mng-notif-link">Manage all notifications</a> · <a href="https://gitlab.rtems.org/help" target="_blank" rel="noopener noreferrer" class="help-link">Help</a>
<span style="color: transparent; font-size: 0; display: none; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0;">
Notification message regarding https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5790 at 1790837596
</span>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Work item","url":"https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5790"}}</script>


</p>
</div>
</body>
</html>