]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/QemuVideoDxe/UnalignedIoGcc.c
OvmfPkg/Gop: clear the screen to black in SetMode()
[mirror_edk2.git] / OvmfPkg / QemuVideoDxe / UnalignedIoGcc.c
CommitLineData
05a53794
PDJ
1/** @file\r
2 Unaligned Port I/O. This file has compiler specifics for GCC as there is no\r
3 ANSI C standard for doing IO.\r
4\r
5 Based on IoLibGcc.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
21/**\r
22 Performs a 32-bit write to the specified, possibly unaligned I/O-type\r
23 address.\r
24\r
25 Writes the 32-bit I/O port specified by Port with the value specified by\r
26 Value and returns Value. This function must guarantee that all I/O read and\r
27 write operations are serialized.\r
28\r
29 If 32-bit unaligned I/O port operations are not supported, then ASSERT().\r
30\r
31 @param[in] Port I/O port address\r
32 @param[in] Value 32-bit word to write\r
33\r
34 @return The value written to the I/O port.\r
35\r
36**/\r
37UINT32\r
38UnalignedIoWrite32 (\r
39 IN UINTN Port,\r
40 IN UINT32 Value\r
41 )\r
42{\r
43 __asm__ __volatile__ ( "outl %0, %1" : : "a" (Value), "d" ((UINT16)Port) );\r
44 return Value;\r
45}\r
46\r
47/**\r
48 Reads a 32-bit word from the specified, possibly unaligned I/O-type address.\r
49\r
50 Reads the 32-bit I/O port specified by Port. The 32-bit read value is\r
51 returned. This function must guarantee that all I/O read and write operations\r
52 are serialized.\r
53\r
54 If 32-bit unaligned I/O port operations are not supported, then ASSERT().\r
55\r
56 @param[in] Port The I/O port to read.\r
57\r
58 @return The value read.\r
59\r
60**/\r
61UINT32\r
62UnalignedIoRead32 (\r
63 IN UINTN Port\r
64 )\r
65{\r
66 UINT32 Data;\r
67 __asm__ __volatile__ ( "inl %1, %0" : "=a" (Data) : "d" ((UINT16)Port) );\r
68 return Data;\r
69}\r
70\r