audk/DuetPkg/CpuIoDxe/Ia32/CpuIoAccess.asm

120 lines
3.5 KiB
NASM

title CpuIoAccess.asm
;------------------------------------------------------------------------------
;*
;* Copyright (c) 2005, Intel Corporation
;* All rights reserved. This program and the accompanying materials
;* are licensed and made available under the terms and conditions of the BSD License
;* which accompanies this distribution. The full text of the license may be found at
;* http://opensource.org/licenses/bsd-license.php
;*
;* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
;* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;*
;* Module Name:
;* CpuIoAccess.asm
;*
;* Abstract:
;* Supports IA32 CPU IO operation
;*
;------------------------------------------------------------------------------
;
;
;------------------------------------------------------------------------------
.686
.MODEL FLAT,C
.CODE
UINT8 TYPEDEF BYTE
UINT16 TYPEDEF WORD
UINT32 TYPEDEF DWORD
UINT64 TYPEDEF QWORD
UINTN TYPEDEF UINT32
;------------------------------------------------------------------------------
; UINT8
; CpuIoRead8 (
; IN UINT16 Port
; )
;------------------------------------------------------------------------------
CpuIoRead8 PROC PUBLIC Port:UINT16
mov dx, Port
in al, dx
ret
CpuIoRead8 ENDP
;------------------------------------------------------------------------------
; UINT16
; CpuIoRead16 (
; IN UINT16 Port
; )
;------------------------------------------------------------------------------
CpuIoRead16 PROC PUBLIC Port:UINT16
mov dx, Port
in ax, dx
ret
CpuIoRead16 ENDP
;------------------------------------------------------------------------------
; UINT32
; CpuIoRead32 (
; IN UINT16 Port
; )
;------------------------------------------------------------------------------
CpuIoRead32 PROC PUBLIC Port:UINT16
mov dx, Port
in eax, dx
ret
CpuIoRead32 ENDP
;------------------------------------------------------------------------------
; VOID
; CpuIoWrite8 (
; IN UINT16 Port,
; IN UINT32 Data
; )
;------------------------------------------------------------------------------
CpuIoWrite8 PROC PUBLIC Port:UINT16, Data:UINT32
mov eax, Data
mov dx, Port
out dx, al
ret
CpuIoWrite8 ENDP
;------------------------------------------------------------------------------
; VOID
; CpuIoWrite16 (
; IN UINT16 Port,
; IN UINT32 Data
; )
;------------------------------------------------------------------------------
CpuIoWrite16 PROC PUBLIC Port:UINT16, Data:UINT32
mov eax, Data
mov dx, Port
out dx, ax
ret
CpuIoWrite16 ENDP
;------------------------------------------------------------------------------
; VOID
; CpuIoWrite32 (
; IN UINT16 Port,
; IN UINT32 Data
; )
;------------------------------------------------------------------------------
CpuIoWrite32 PROC PUBLIC Port:UINT16, Data:UINT32
mov eax, Data
mov dx, Port
out dx, eax
ret
CpuIoWrite32 ENDP
END