diff options
author | Michael Brown <mcb30@ipxe.org> | 2023-06-29 15:08:23 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2023-06-29 15:40:24 +0100 |
commit | c57887bfc808c2be485ed97f2dc709f927550161 (patch) | |
tree | 035687938616dfe6fdc22fb9ab4b4c8e717a19ae /src/arch | |
parent | 18af669701b5396af4073b9de4bdb6cd3aff68c1 (diff) | |
download | ipxe-c57887bfc808c2be485ed97f2dc709f927550161.tar.gz |
[ioapi] Centralise definitions for dummy PIO
There is no common standard for I/O-space access for non-x86 CPU
families, and non-MMIO peripherals are vanishingly rare.
Generalise the existing ARM definitions for dummy PIO to allow for
reuse by other CPU architectures.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/arm/core/arm_io.c | 2 | ||||
-rw-r--r-- | src/arch/arm/include/ipxe/arm_io.h | 54 |
2 files changed, 6 insertions, 50 deletions
diff --git a/src/arch/arm/core/arm_io.c b/src/arch/arm/core/arm_io.c index f8022715a..41b42389a 100644 --- a/src/arch/arm/core/arm_io.c +++ b/src/arch/arm/core/arm_io.c @@ -83,7 +83,6 @@ PROVIDE_IOAPI_INLINE ( arm, readl ); PROVIDE_IOAPI_INLINE ( arm, writeb ); PROVIDE_IOAPI_INLINE ( arm, writew ); PROVIDE_IOAPI_INLINE ( arm, writel ); -PROVIDE_IOAPI_INLINE ( arm, iodelay ); PROVIDE_IOAPI_INLINE ( arm, mb ); #ifdef __aarch64__ PROVIDE_IOAPI_INLINE ( arm, readq ); @@ -92,3 +91,4 @@ PROVIDE_IOAPI_INLINE ( arm, writeq ); PROVIDE_IOAPI ( arm, readq, arm32_readq ); PROVIDE_IOAPI ( arm, writeq, arm32_writeq ); #endif +PROVIDE_DUMMY_PIO ( arm ); diff --git a/src/arch/arm/include/ipxe/arm_io.h b/src/arch/arm/include/ipxe/arm_io.h index 046cbdb06..7ed38993d 100644 --- a/src/arch/arm/include/ipxe/arm_io.h +++ b/src/arch/arm/include/ipxe/arm_io.h @@ -15,6 +15,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #define IOAPI_PREFIX_arm __arm_ #endif +#include <ipxe/dummy_pio.h> + /* * Memory space mappings * @@ -78,55 +80,6 @@ ARM_WRITEX ( l, uint32_t, "", "" ); #endif /* - * Dummy PIO reads and writes up to 32 bits - * - * There is no common standard for I/O-space access for ARM, and - * non-MMIO peripherals are vanishingly rare. Provide dummy - * implementations that will allow code to link and should cause - * drivers to simply fail to detect hardware at runtime. - * - */ - -#define ARM_INX( _suffix, _type ) \ -static inline __always_inline _type \ -IOAPI_INLINE ( arm, in ## _suffix ) ( volatile _type *io_addr __unused) { \ - return ~( (_type) 0 ); \ -} \ -static inline __always_inline void \ -IOAPI_INLINE ( arm, ins ## _suffix ) ( volatile _type *io_addr __unused, \ - _type *data, unsigned int count ) { \ - memset ( data, 0xff, count * sizeof ( *data ) ); \ -} -ARM_INX ( b, uint8_t ); -ARM_INX ( w, uint16_t ); -ARM_INX ( l, uint32_t ); - -#define ARM_OUTX( _suffix, _type ) \ -static inline __always_inline void \ -IOAPI_INLINE ( arm, out ## _suffix ) ( _type data __unused, \ - volatile _type *io_addr __unused ) { \ - /* Do nothing */ \ -} \ -static inline __always_inline void \ -IOAPI_INLINE ( arm, outs ## _suffix ) ( volatile _type *io_addr __unused, \ - const _type *data __unused, \ - unsigned int count __unused ) { \ - /* Do nothing */ \ -} -ARM_OUTX ( b, uint8_t ); -ARM_OUTX ( w, uint16_t ); -ARM_OUTX ( l, uint32_t ); - -/* - * Slow down I/O - * - */ -static inline __always_inline void -IOAPI_INLINE ( arm, iodelay ) ( void ) { - /* Nothing to do */ -} - -/* * Memory barrier * */ @@ -140,4 +93,7 @@ IOAPI_INLINE ( arm, mb ) ( void ) { #endif } +/* Dummy PIO */ +DUMMY_PIO ( arm ); + #endif /* _IPXE_ARM_IO_H */ |