]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[pci] Define pci_ioremap() for mapping PCI bus addresses
authorMichael Brown <mcb30@ipxe.org>
Thu, 24 Sep 2020 15:58:14 +0000 (16:58 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 24 Sep 2020 20:45:56 +0000 (21:45 +0100)
Define pci_ioremap() as a wrapper around ioremap() that could allow
for a non-zero address translation offset.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/x86/core/pcidirect.c
src/arch/x86/include/ipxe/pcibios.h
src/arch/x86/include/ipxe/pcidirect.h
src/arch/x86/interface/pcbios/pcibios.c
src/include/ipxe/efi/efi_pci_api.h
src/include/ipxe/linux/linux_pci.h
src/include/ipxe/pci_io.h
src/interface/efi/efi_pci.c

index 0d09be84b98ff1415425fb5bea8f0b73533d92ee..9b8226feac97855732399a8dc401d13b6b82bbd4 100644 (file)
@@ -52,3 +52,4 @@ PROVIDE_PCIAPI_INLINE ( direct, pci_read_config_dword );
 PROVIDE_PCIAPI_INLINE ( direct, pci_write_config_byte );
 PROVIDE_PCIAPI_INLINE ( direct, pci_write_config_word );
 PROVIDE_PCIAPI_INLINE ( direct, pci_write_config_dword );
+PROVIDE_PCIAPI_INLINE ( direct, pci_ioremap );
index 7e1bcd814bb67056a934c03f1e378704cd51ca6c..bae4eede1be1edae95d4459d8de91e003bf9530f 100644 (file)
@@ -132,4 +132,17 @@ PCIAPI_INLINE ( pcbios, pci_write_config_dword ) ( struct pci_device *pci,
        return pcibios_write ( pci, PCIBIOS_WRITE_CONFIG_DWORD | where, value);
 }
 
+/**
+ * Map PCI bus address as an I/O address
+ *
+ * @v bus_addr         PCI bus address
+ * @v len              Length of region
+ * @ret io_addr                I/O address, or NULL on error
+ */
+static inline __always_inline void *
+PCIAPI_INLINE ( pcbios, pci_ioremap ) ( struct pci_device *pci __unused,
+                                       unsigned long bus_addr, size_t len ) {
+       return ioremap ( bus_addr, len );
+}
+
 #endif /* _IPXE_PCIBIOS_H */
index d924f2f203c1e3ed072aec55bb221ffab713f787..9570fd7d6023977ba1956bc1cbe2d3876765683b 100644 (file)
@@ -138,4 +138,17 @@ PCIAPI_INLINE ( direct, pci_write_config_dword ) ( struct pci_device *pci,
        return 0;
 }
 
+/**
+ * Map PCI bus address as an I/O address
+ *
+ * @v bus_addr         PCI bus address
+ * @v len              Length of region
+ * @ret io_addr                I/O address, or NULL on error
+ */
+static inline __always_inline void *
+PCIAPI_INLINE ( direct, pci_ioremap ) ( struct pci_device *pci __unused,
+                                       unsigned long bus_addr, size_t len ) {
+       return ioremap ( bus_addr, len );
+}
+
 #endif /* _PCIDIRECT_H */
index 07ac0c18d3d997c03d7c87ae021d599574b8b855..bf812f77fee963ec371811e7959f82e48a99c99b 100644 (file)
@@ -121,3 +121,4 @@ PROVIDE_PCIAPI_INLINE ( pcbios, pci_read_config_dword );
 PROVIDE_PCIAPI_INLINE ( pcbios, pci_write_config_byte );
 PROVIDE_PCIAPI_INLINE ( pcbios, pci_write_config_word );
 PROVIDE_PCIAPI_INLINE ( pcbios, pci_write_config_dword );
+PROVIDE_PCIAPI_INLINE ( pcbios, pci_ioremap );
index 887d5ee14e8b3a525ea6f09ac859a2852e4382dc..df28cef34b4f9b6299a9d0c975d4a8fb71dccc87 100644 (file)
@@ -148,4 +148,17 @@ PCIAPI_INLINE ( efi, pci_write_config_dword ) ( struct pci_device *pci,
                              value );
 }
 
+/**
+ * Map PCI bus address as an I/O address
+ *
+ * @v bus_addr         PCI bus address
+ * @v len              Length of region
+ * @ret io_addr                I/O address, or NULL on error
+ */
+static inline __always_inline void *
+PCIAPI_INLINE ( efi, pci_ioremap ) ( struct pci_device *pci __unused,
+                                    unsigned long bus_addr, size_t len ) {
+       return ioremap ( bus_addr, len );
+}
+
 #endif /* _IPXE_EFI_PCI_API_H */
index 22ae7f1bc919458faf7b75ab3a3465076ebf4d46..76ed8f252b273444486da0c75f6fd6d406a99c19 100644 (file)
@@ -127,4 +127,17 @@ PCIAPI_INLINE ( linux, pci_write_config_dword ) ( struct pci_device *pci,
        return linux_pci_write ( pci, where, value, sizeof ( value ) );
 }
 
+/**
+ * Map PCI bus address as an I/O address
+ *
+ * @v bus_addr         PCI bus address
+ * @v len              Length of region
+ * @ret io_addr                I/O address, or NULL on error
+ */
+static inline __always_inline void *
+PCIAPI_INLINE ( linux, pci_ioremap ) ( struct pci_device *pci __unused,
+                                      unsigned long bus_addr, size_t len ) {
+       return ioremap ( bus_addr, len );
+}
+
 #endif /* _IPXE_LINUX_PCI_H */
index 10e69763e311cab00a68e30201a4d56b2ab74d9a..2dcdd9b28a6411f0015255ddc6e8bfc12eeda25b 100644 (file)
@@ -11,6 +11,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 
 #include <stdint.h>
 #include <ipxe/api.h>
+#include <ipxe/iomap.h>
 #include <config/ioapi.h>
 
 /**
@@ -122,4 +123,14 @@ int pci_write_config_word ( struct pci_device *pci, unsigned int where,
 int pci_write_config_dword ( struct pci_device *pci, unsigned int where,
                             uint32_t value );
 
+/**
+ * Map PCI bus address as an I/O address
+ *
+ * @v bus_addr         PCI bus address
+ * @v len              Length of region
+ * @ret io_addr                I/O address, or NULL on error
+ */
+void * pci_ioremap ( struct pci_device *pci, unsigned long bus_addr,
+                    size_t len );
+
 #endif /* _IPXE_PCI_IO_H */
index a298f240717a712ca30980d2cbe321de686917a2..6a929090cebf170d90c244fc829c4a0234ed627e 100644 (file)
@@ -231,6 +231,7 @@ PROVIDE_PCIAPI_INLINE ( efi, pci_read_config_dword );
 PROVIDE_PCIAPI_INLINE ( efi, pci_write_config_byte );
 PROVIDE_PCIAPI_INLINE ( efi, pci_write_config_word );
 PROVIDE_PCIAPI_INLINE ( efi, pci_write_config_dword );
+PROVIDE_PCIAPI_INLINE ( efi, pci_ioremap );
 
 /******************************************************************************
  *