diff options
| author | Old-Ding <[email protected]> | 2026-07-06 04:30:13 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2026-07-08 14:03:38 +0800 |
| commit | c7f21bddeb25a37d03193054592a083e73bba37b (patch) | |
| tree | ce6cf26ca95330682e41b2d09a395b0a3b48ca03 /components/drivers | |
| parent | 3eac0a8a17dd425b0696b0155adfdda2b78af1d9 (diff) | |
drivers: pci: Fix endpoint MSI setup
rt_pci_ep_set_msi() checked the set_msix callback before calling set_msi. That rejects endpoint controllers that implement MSI without MSI-X, and can call through a NULL set_msi pointer when only MSI-X is provided.
The same helper converts a requested MSI vector count into the log2 field passed to the controller. Stop after the first value large enough for the request so smaller requests are not widened by later loop iterations.
Generated-by: OpenAI Codex
Signed-off-by: Old-Ding <[email protected]>
Diffstat (limited to 'components/drivers')
| -rw-r--r-- | components/drivers/pci/endpoint/endpoint.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/components/drivers/pci/endpoint/endpoint.c b/components/drivers/pci/endpoint/endpoint.c index 70dbe2ad27..a69384bd43 100644 --- a/components/drivers/pci/endpoint/endpoint.c +++ b/components/drivers/pci/endpoint/endpoint.c @@ -182,7 +182,7 @@ rt_err_t rt_pci_ep_set_msi(struct rt_pci_ep *ep, rt_uint8_t func_no, if (ep && ep->ops && func_no < ep->max_functions) { - if (ep->ops->set_msix) + if (ep->ops->set_msi) { err = -RT_EINVAL; @@ -193,6 +193,7 @@ rt_err_t rt_pci_ep_set_msi(struct rt_pci_ep *ep, rt_uint8_t func_no, rt_mutex_take(&ep->lock, RT_WAITING_FOREVER); err = ep->ops->set_msi(ep, func_no, log2); rt_mutex_release(&ep->lock); + break; } } } |
