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#------------------------------------------------------------------------------
16#  VOID
17#  EFIAPI
18#  IoReadFifo8 (
19#    IN UINTN                  Port,              // rcx
20#    IN UINTN                  Count,             // rdx
21#    IN VOID                   *Buffer            // r8
22#    );
23#------------------------------------------------------------------------------
24ASM_GLOBAL ASM_PFX(IoReadFifo8)
25ASM_PFX(IoReadFifo8):
26    cld
27    xchg    %rcx, %rdx
28    xchg    %r8, %rdi           # rdi: buffer address; r8: save register
29rep insb
30    mov     %r8, %rdi           # restore rdi
31    ret
32
33#------------------------------------------------------------------------------
34#  VOID
35#  EFIAPI
36#  IoReadFifo16 (
37#    IN UINTN                  Port,              // rcx
38#    IN UINTN                  Count,             // rdx
39#    IN VOID                   *Buffer            // r8
40#    );
41#------------------------------------------------------------------------------
42ASM_GLOBAL ASM_PFX(IoReadFifo16)
43ASM_PFX(IoReadFifo16):
44    cld
45    xchg    %rcx, %rdx
46    xchg    %r8, %rdi           # rdi: buffer address; r8: save register
47rep insw
48    mov     %r8, %rdi           # restore rdi
49    ret
50
51#------------------------------------------------------------------------------
52#  VOID
53#  EFIAPI
54#  IoReadFifo32 (
55#    IN UINTN                  Port,              // rcx
56#    IN UINTN                  Count,             // rdx
57#    IN VOID                   *Buffer            // r8
58#    );
59#------------------------------------------------------------------------------
60ASM_GLOBAL ASM_PFX(IoReadFifo32)
61ASM_PFX(IoReadFifo32):
62    cld
63    xchg    %rcx, %rdx
64    xchg    %r8, %rdi           # rdi: buffer address; r8: save register
65rep insl
66    mov     %r8, %rdi           # restore rdi
67    ret
68
69#------------------------------------------------------------------------------
70#  VOID
71#  EFIAPI
72#  IoWriteFifo8 (
73#    IN UINTN                  Port,              // rcx
74#    IN UINTN                  Count,             // rdx
75#    IN VOID                   *Buffer            // r8
76#    );
77#------------------------------------------------------------------------------
78ASM_GLOBAL ASM_PFX(IoWriteFifo8)
79ASM_PFX(IoWriteFifo8):
80    cld
81    xchg    %rcx, %rdx
82    xchg    %r8, %rsi           # rsi: buffer address; r8: save register
83rep outsb
84    mov     %r8, %rsi           # restore rsi
85    ret
86
87#------------------------------------------------------------------------------
88#  VOID
89#  EFIAPI
90#  IoWriteFifo16 (
91#    IN UINTN                  Port,              // rcx
92#    IN UINTN                  Count,             // rdx
93#    IN VOID                   *Buffer            // r8
94#    );
95#------------------------------------------------------------------------------
96ASM_GLOBAL ASM_PFX(IoWriteFifo16)
97ASM_PFX(IoWriteFifo16):
98    cld
99    xchg    %rcx, %rdx
100    xchg    %r8, %rsi           # rsi: buffer address; r8: save register
101rep outsw
102    mov     %r8, %rsi           # restore rsi
103    ret
104
105#------------------------------------------------------------------------------
106#  VOID
107#  EFIAPI
108#  IoWriteFifo32 (
109#    IN UINTN                  Port,              // rcx
110#    IN UINTN                  Count,             // rdx
111#    IN VOID                   *Buffer            // r8
112#    );
113#------------------------------------------------------------------------------
114ASM_GLOBAL ASM_PFX(IoWriteFifo32)
115ASM_PFX(IoWriteFifo32):
116    cld
117    xchg    %rcx, %rdx
118    xchg    %r8, %rsi           # rsi: buffer address; r8: save register
119rep outsl
120    mov     %r8, %rsi           # restore rsi
121    ret
122
123