blob: b459214e1b6d8a05f941f9d364064f4cad1e0c09 [file] [log] [blame]
Vishal Bhoj82c80712015-12-15 21:13:33 +05301/** @file
2 Internal include file of DXE CPU IO2 Library.
3
4 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
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#ifndef _DXE_CPUIO2_LIB_INTERNAL_H_
16#define _DXE_CPUIO2_LIB_INTERNAL_H_
17
18#include <PiDxe.h>
19
20#include <Protocol/CpuIo2.h>
21
22#include <Library/IoLib.h>
23#include <Library/UefiBootServicesTableLib.h>
24#include <Library/DebugLib.h>
25#include <Library/BaseLib.h>
26
27
28/**
29 Reads registers in the EFI CPU I/O space.
30
31 Reads the I/O port specified by Port with registers width specified by Width.
32 The read value is returned. If such operations are not supported, then ASSERT().
33 This function must guarantee that all I/O read and write operations are serialized.
34
35 @param Port The base address of the I/O operation.
36 The caller is responsible for aligning the Address if required.
37 @param Width The width of the I/O operation.
38
39 @return Data read from registers in the EFI CPU I/O space.
40
41**/
42UINT64
43EFIAPI
44IoReadWorker (
45 IN UINTN Port,
46 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
47 );
48
49/**
50 Writes registers in the EFI CPU I/O space.
51
52 Writes the I/O port specified by Port with registers width and value specified by Width
53 and Data respectively. Data is returned. If such operations are not supported, then ASSERT().
54 This function must guarantee that all I/O read and write operations are serialized.
55
56 @param Port The base address of the I/O operation.
57 The caller is responsible for aligning the Address if required.
58 @param Width The width of the I/O operation.
59 @param Data The value to write to the I/O port.
60
61 @return The paramter of Data.
62
63**/
64UINT64
65EFIAPI
66IoWriteWorker (
67 IN UINTN Port,
68 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
69 IN UINT64 Data
70 );
71
72/**
73 Reads memory-mapped registers in the EFI system memory space.
74
75 Reads the MMIO registers specified by Address with registers width specified by Width.
76 The read value is returned. If such operations are not supported, then ASSERT().
77 This function must guarantee that all MMIO read and write operations are serialized.
78
79 @param Address The MMIO register to read.
80 The caller is responsible for aligning the Address if required.
81 @param Width The width of the I/O operation.
82
83 @return Data read from registers in the EFI system memory space.
84
85**/
86UINT64
87EFIAPI
88MmioReadWorker (
89 IN UINTN Address,
90 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
91 );
92
93/**
94 Writes memory-mapped registers in the EFI system memory space.
95
96 Writes the MMIO registers specified by Address with registers width and value specified by Width
97 and Data respectively. Data is returned. If such operations are not supported, then ASSERT().
98 This function must guarantee that all MMIO read and write operations are serialized.
99
100 @param Address The MMIO register to read.
101 The caller is responsible for aligning the Address if required.
102 @param Width The width of the I/O operation.
103 @param Data The value to write to the I/O port.
104
105 @return Data read from registers in the EFI system memory space.
106
107**/
108UINT64
109EFIAPI
110MmioWriteWorker (
111 IN UINTN Address,
112 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
113 IN UINT64 Data
114 );
115
116#endif