You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ra...@apache.org on 2024/10/10 13:31:16 UTC
(nuttx) 02/16: pci.c: add pci_read/write_io_qword support
This is an automated email from the ASF dual-hosted git repository.
raiden00 pushed a commit to branch releases/12.7
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 1e091fb2e09df662c95cf417d3347d674e46b10d
Author: wangyongrong <wa...@xiaomi.com>
AuthorDate: Thu May 9 16:55:45 2024 +0800
pci.c: add pci_read/write_io_qword support
Signed-off-by: wangyongrong <wa...@xiaomi.com>
---
include/nuttx/pci/pci.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/include/nuttx/pci/pci.h b/include/nuttx/pci/pci.h
index 43c4ef1f04..80660c3bdf 100644
--- a/include/nuttx/pci/pci.h
+++ b/include/nuttx/pci/pci.h
@@ -161,6 +161,17 @@
#define pci_read_io_dword(dev, addr, val) \
pci_bus_read_io_dword((dev)->bus, addr, val)
+#define pci_read_io_qword(dev, addr, val) \
+ do \
+ { \
+ uint32_t valhi; \
+ uint32_t vallo; \
+ pci_bus_read_io_dword((dev)->bus, addr, &vallo); \
+ pci_bus_read_io_dword((dev)->bus, (uintptr_t)(addr) + sizeof(uint32_t), &valhi); \
+ *(val) = ((uint64_t)valhi << 32) | (uint64_t)vallo; \
+ } \
+ while (0)
+
#define pci_write_io_byte(dev, addr, val) \
pci_bus_write_io_byte((dev)->bus, addr, val)
@@ -170,6 +181,14 @@
#define pci_write_io_dword(dev, addr, val) \
pci_bus_write_io_dword((dev)->bus, addr, val)
+#define pci_write_io_qword(dev, addr, val) \
+ do \
+ { \
+ pci_bus_write_io_dword((dev)->bus, addr, (uint32_t)(val)); \
+ pci_bus_write_io_dword((dev)->bus, (uintptr_t)(addr) + sizeof(uint32_t), (val) >> 32); \
+ } \
+ while (0)
+
#define pci_write_mmio_byte(dev, addr, val) \
(*((FAR volatile uint8_t *)(addr))) = val