From 1e091fb2e09df662c95cf417d3347d674e46b10d Mon Sep 17 00:00:00 2001 From: wangyongrong Date: Thu, 9 May 2024 16:55:45 +0800 Subject: [PATCH] pci.c: add pci_read/write_io_qword support Signed-off-by: wangyongrong --- 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