]> git.proxmox.com Git - mirror_edk2.git/blob - DuetPkg/CpuIoDxe/Ia32/CpuIoAccess.asm
07b14ea554e7957f2566541396326943d8232f88
[mirror_edk2.git] / DuetPkg / CpuIoDxe / Ia32 / CpuIoAccess.asm
1 title CpuIoAccess.asm
2 ;------------------------------------------------------------------------------
3 ;*
4 ;* Copyright (c) 2005, Intel Corporation
5 ;* All rights reserved. This program and the accompanying materials
6 ;* are licensed and made available under the terms and conditions of the BSD License
7 ;* which accompanies this 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 ;* Module Name:
14 ;* CpuIoAccess.asm
15 ;*
16 ;* Abstract:
17 ;* Supports IA32 CPU IO operation
18 ;*
19 ;------------------------------------------------------------------------------
20 ;
21 ;
22 ;------------------------------------------------------------------------------
23
24 .686
25 .MODEL FLAT,C
26 .CODE
27
28
29 UINT8 TYPEDEF BYTE
30 UINT16 TYPEDEF WORD
31 UINT32 TYPEDEF DWORD
32 UINT64 TYPEDEF QWORD
33 UINTN TYPEDEF UINT32
34
35
36
37 ;------------------------------------------------------------------------------
38 ; UINT8
39 ; CpuIoRead8 (
40 ; IN UINT16 Port
41 ; )
42 ;------------------------------------------------------------------------------
43 CpuIoRead8 PROC PUBLIC Port:UINT16
44 mov dx, Port
45 in al, dx
46 ret
47 CpuIoRead8 ENDP
48
49 ;------------------------------------------------------------------------------
50 ; UINT16
51 ; CpuIoRead16 (
52 ; IN UINT16 Port
53 ; )
54 ;------------------------------------------------------------------------------
55 CpuIoRead16 PROC PUBLIC Port:UINT16
56 mov dx, Port
57 in ax, dx
58 ret
59 CpuIoRead16 ENDP
60
61 ;------------------------------------------------------------------------------
62 ; UINT32
63 ; CpuIoRead32 (
64 ; IN UINT16 Port
65 ; )
66 ;------------------------------------------------------------------------------
67 CpuIoRead32 PROC PUBLIC Port:UINT16
68 mov dx, Port
69 in eax, dx
70 ret
71 CpuIoRead32 ENDP
72
73
74
75 ;------------------------------------------------------------------------------
76 ; VOID
77 ; CpuIoWrite8 (
78 ; IN UINT16 Port,
79 ; IN UINT32 Data
80 ; )
81 ;------------------------------------------------------------------------------
82 CpuIoWrite8 PROC PUBLIC Port:UINT16, Data:UINT32
83 mov eax, Data
84 mov dx, Port
85 out dx, al
86 ret
87 CpuIoWrite8 ENDP
88
89
90 ;------------------------------------------------------------------------------
91 ; VOID
92 ; CpuIoWrite16 (
93 ; IN UINT16 Port,
94 ; IN UINT32 Data
95 ; )
96 ;------------------------------------------------------------------------------
97 CpuIoWrite16 PROC PUBLIC Port:UINT16, Data:UINT32
98 mov eax, Data
99 mov dx, Port
100 out dx, ax
101 ret
102 CpuIoWrite16 ENDP
103
104
105 ;------------------------------------------------------------------------------
106 ; VOID
107 ; CpuIoWrite32 (
108 ; IN UINT16 Port,
109 ; IN UINT32 Data
110 ; )
111 ;------------------------------------------------------------------------------
112 CpuIoWrite32 PROC PUBLIC Port:UINT16, Data:UINT32
113 mov eax, Data
114 mov dx, Port
115 out dx, eax
116 ret
117 CpuIoWrite32 ENDP
118
119
120 END