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