Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef BOOT_IO_H
0003 #define BOOT_IO_H
0004 
0005 #include <asm/shared/io.h>
0006 
0007 #undef inb
0008 #undef inw
0009 #undef inl
0010 #undef outb
0011 #undef outw
0012 #undef outl
0013 
0014 struct port_io_ops {
0015     u8  (*f_inb)(u16 port);
0016     void    (*f_outb)(u8 v, u16 port);
0017     void    (*f_outw)(u16 v, u16 port);
0018 };
0019 
0020 extern struct port_io_ops pio_ops;
0021 
0022 /*
0023  * Use the normal I/O instructions by default.
0024  * TDX guests override these to use hypercalls.
0025  */
0026 static inline void init_default_io_ops(void)
0027 {
0028     pio_ops.f_inb  = __inb;
0029     pio_ops.f_outb = __outb;
0030     pio_ops.f_outw = __outw;
0031 }
0032 
0033 /*
0034  * Redirect port I/O operations via pio_ops callbacks.
0035  * TDX guests override these callbacks with TDX-specific helpers.
0036  */
0037 #define inb  pio_ops.f_inb
0038 #define outb pio_ops.f_outb
0039 #define outw pio_ops.f_outw
0040 
0041 #endif