1a3f0ef2caa64921e355325fe91a244cd71c5617
[mirror_edk2.git] / UefiCpuPkg / CpuIo2Dxe / X64 / IoFifo.asm
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
4 ;
5 ; This program and the accompanying materials are licensed and made available
6 ; under the terms and conditions of the BSD License which accompanies this
7 ; distribution. The full text of the license may be found at
8 ; http://opensource.org/licenses/bsd-license.php.
9 ;
10 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 ;
13 ;------------------------------------------------------------------------------
14
15 .code
16
17 ;------------------------------------------------------------------------------
18 ; VOID
19 ; EFIAPI
20 ; IoReadFifo8 (
21 ; IN UINTN Port, // rcx
22 ; IN UINTN Size, // rdx
23 ; IN VOID *Buffer // r8
24 ; );
25 ;------------------------------------------------------------------------------
26 IoReadFifo8 PROC
27 cld
28 xchg rcx, rdx
29 xchg rdi, r8 ; rdi: buffer address; r8: save rdi
30 rep insb
31 mov rdi, r8 ; restore rdi
32 ret
33 IoReadFifo8 ENDP
34
35 ;------------------------------------------------------------------------------
36 ; VOID
37 ; EFIAPI
38 ; IoReadFifo16 (
39 ; IN UINTN Port, // rcx
40 ; IN UINTN Size, // rdx
41 ; IN VOID *Buffer // r8
42 ; );
43 ;------------------------------------------------------------------------------
44 IoReadFifo16 PROC
45 cld
46 xchg rcx, rdx
47 xchg rdi, r8 ; rdi: buffer address; r8: save rdi
48 rep insw
49 mov rdi, r8 ; restore rdi
50 ret
51 IoReadFifo16 ENDP
52
53 ;------------------------------------------------------------------------------
54 ; VOID
55 ; EFIAPI
56 ; IoReadFifo32 (
57 ; IN UINTN Port, // rcx
58 ; IN UINTN Size, // rdx
59 ; IN VOID *Buffer // r8
60 ; );
61 ;------------------------------------------------------------------------------
62 IoReadFifo32 PROC
63 cld
64 xchg rcx, rdx
65 xchg rdi, r8 ; rdi: buffer address; r8: save rdi
66 rep insd
67 mov rdi, r8 ; restore rdi
68 ret
69 IoReadFifo32 ENDP
70
71 ;------------------------------------------------------------------------------
72 ; VOID
73 ; EFIAPI
74 ; IoWriteFifo8 (
75 ; IN UINTN Port, // rcx
76 ; IN UINTN Size, // rdx
77 ; IN VOID *Buffer // r8
78 ; );
79 ;------------------------------------------------------------------------------
80 IoWriteFifo8 PROC
81 cld
82 xchg rcx, rdx
83 xchg rsi, r8 ; rsi: buffer address; r8: save rsi
84 rep outsb
85 mov rsi, r8 ; restore rsi
86 ret
87 IoWriteFifo8 ENDP
88
89 ;------------------------------------------------------------------------------
90 ; VOID
91 ; EFIAPI
92 ; IoWriteFifo16 (
93 ; IN UINTN Port, // rcx
94 ; IN UINTN Size, // rdx
95 ; IN VOID *Buffer // r8
96 ; );
97 ;------------------------------------------------------------------------------
98 IoWriteFifo16 PROC
99 cld
100 xchg rcx, rdx
101 xchg rsi, r8 ; rsi: buffer address; r8: save rsi
102 rep outsw
103 mov rsi, r8 ; restore rsi
104 ret
105 IoWriteFifo16 ENDP
106
107 ;------------------------------------------------------------------------------
108 ; VOID
109 ; EFIAPI
110 ; IoWriteFifo32 (
111 ; IN UINTN Port, // rcx
112 ; IN UINTN Size, // rdx
113 ; IN VOID *Buffer // r8
114 ; );
115 ;------------------------------------------------------------------------------
116 IoWriteFifo32 PROC
117 cld
118 xchg rcx, rdx
119 xchg rsi, r8 ; rsi: buffer address; r8: save rsi
120 rep outsd
121 mov rsi, r8 ; restore rsi
122 ret
123 IoWriteFifo32 ENDP
124
125 END
126