x86_io.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 FILE_LICENCE ( GPL2_OR_LATER );
00020
00021 #include <gpxe/io.h>
00022 #include <gpxe/x86_io.h>
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 static uint64_t x86_readq ( volatile uint64_t *io_addr ) {
00039 uint64_t data;
00040 __asm__ __volatile__ ( "pushl %%edx\n\t"
00041 "pushl %%eax\n\t"
00042 "movq (%1), %%mm0\n\t"
00043 "movq %%mm0, (%%esp)\n\t"
00044 "popl %%eax\n\t"
00045 "popl %%edx\n\t"
00046 "emms\n\t"
00047 : "=A" ( data ) : "r" ( io_addr ) );
00048 return data;
00049 }
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 static void x86_writeq ( uint64_t data, volatile uint64_t *io_addr ) {
00060 __asm__ __volatile__ ( "pushl %%edx\n\t"
00061 "pushl %%eax\n\t"
00062 "movq (%%esp), %%mm0\n\t"
00063 "movq %%mm0, (%1)\n\t"
00064 "popl %%eax\n\t"
00065 "popl %%edx\n\t"
00066 "emms\n\t"
00067 : : "A" ( data ), "r" ( io_addr ) );
00068 }
00069
00070 PROVIDE_IOAPI_INLINE ( x86, phys_to_bus );
00071 PROVIDE_IOAPI_INLINE ( x86, bus_to_phys );
00072 PROVIDE_IOAPI_INLINE ( x86, ioremap );
00073 PROVIDE_IOAPI_INLINE ( x86, iounmap );
00074 PROVIDE_IOAPI_INLINE ( x86, io_to_bus );
00075 PROVIDE_IOAPI_INLINE ( x86, readb );
00076 PROVIDE_IOAPI_INLINE ( x86, readw );
00077 PROVIDE_IOAPI_INLINE ( x86, readl );
00078 PROVIDE_IOAPI ( x86, readq, x86_readq );
00079 PROVIDE_IOAPI_INLINE ( x86, writeb );
00080 PROVIDE_IOAPI_INLINE ( x86, writew );
00081 PROVIDE_IOAPI_INLINE ( x86, writel );
00082 PROVIDE_IOAPI ( x86, writeq, x86_writeq );
00083 PROVIDE_IOAPI_INLINE ( x86, inb );
00084 PROVIDE_IOAPI_INLINE ( x86, inw );
00085 PROVIDE_IOAPI_INLINE ( x86, inl );
00086 PROVIDE_IOAPI_INLINE ( x86, outb );
00087 PROVIDE_IOAPI_INLINE ( x86, outw );
00088 PROVIDE_IOAPI_INLINE ( x86, outl );
00089 PROVIDE_IOAPI_INLINE ( x86, insb );
00090 PROVIDE_IOAPI_INLINE ( x86, insw );
00091 PROVIDE_IOAPI_INLINE ( x86, insl );
00092 PROVIDE_IOAPI_INLINE ( x86, outsb );
00093 PROVIDE_IOAPI_INLINE ( x86, outsw );
00094 PROVIDE_IOAPI_INLINE ( x86, outsl );
00095 PROVIDE_IOAPI_INLINE ( x86, iodelay );
00096 PROVIDE_IOAPI_INLINE ( x86, mb );