]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/QemuVideoDxe/UnalignedIoMsc.c
OvmfPkg/Gop: clear the screen to black in SetMode()
[mirror_edk2.git] / OvmfPkg / QemuVideoDxe / UnalignedIoMsc.c
CommitLineData
05a53794
PDJ
1/** @file\r
2 Unaligned port I/O. This file has compiler specifics for Microsoft C as there\r
3 is no ANSI C standard for doing IO.\r
4\r
5 Based on IoLibMsc.c\r
6\r
7 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
8 This program and the accompanying materials are licensed and made available\r
9 under the terms and conditions of the BSD License which accompanies this\r
10 distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php.\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17\r
18\r
19#include "UnalignedIoInternal.h"\r
20\r
21unsigned long _inpd (unsigned short port);\r
22unsigned long _outpd (unsigned short port, unsigned long dataword );\r
23void _ReadWriteBarrier (void);\r
24\r
25/**\r
26 Performs a 32-bit write to the specified, possibly unaligned I/O-type\r
27 address.\r
28\r
29 Writes the 32-bit I/O port specified by Port with the value specified by\r
30 Value and returns Value. This function must guarantee that all I/O read and\r
31 write operations are serialized.\r
32\r
33 If 32-bit unaligned I/O port operations are not supported, then ASSERT().\r
34\r
35 @param[in] Port I/O port address\r
36 @param[in] Value 32-bit word to write\r
37\r
38 @return The value written to the I/O port.\r
39\r
40**/\r
41UINT32\r
42UnalignedIoWrite32 (\r
43 IN UINTN Port,\r
44 IN UINT32 Value\r
45 )\r
46{\r
47 _ReadWriteBarrier ();\r
48 _outpd ((UINT16)Port, Value);\r
49 _ReadWriteBarrier ();\r
50 return Value;\r
51}\r
52\r
53/**\r
54 Reads a 32-bit word from the specified, possibly unaligned I/O-type address.\r
55\r
56 Reads the 32-bit I/O port specified by Port. The 32-bit read value is\r
57 returned. This function must guarantee that all I/O read and write operations\r
58 are serialized.\r
59\r
60 If 32-bit unaligned I/O port operations are not supported, then ASSERT().\r
61\r
62 @param[in] Port The I/O port to read.\r
63\r
64 @return The value read.\r
65\r
66**/\r
67UINT32\r
68UnalignedIoRead32 (\r
69 IN UINTN Port\r
70 )\r
71{\r
72 UINT32 Value;\r
73\r
74 _ReadWriteBarrier ();\r
75 Value = _inpd ((UINT16)Port);\r
76 _ReadWriteBarrier ();\r
77 return Value;\r
78}\r