• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Internal include file of DXE CPU IO Library.
3   It includes all necessary protocol/library class's header file
4   for implementation of IoLib library instance. It is included
5   all source code of this library instance.
6 
7   Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
8   This program and the accompanying materials
9   are licensed and made available under the terms and conditions of the BSD License
10   which accompanies this distribution.  The full text of the license may be found at
11   http://opensource.org/licenses/bsd-license.php
12 
13   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 
16   Module Name:  DxeCpuIoLibInternal.h
17 
18 **/
19 
20 #ifndef _DXE_CPUIO_LIB_INTERNAL_H_
21 #define _DXE_CPUIO_LIB_INTERNAL_H_
22 
23 
24 #include <FrameworkDxe.h>
25 
26 #include <Protocol/CpuIo.h>
27 
28 #include <Library/IoLib.h>
29 #include <Library/UefiBootServicesTableLib.h>
30 #include <Library/DebugLib.h>
31 #include <Library/BaseLib.h>
32 
33 
34 /**
35   Reads registers in the EFI CPU I/O space.
36 
37   Reads the I/O port specified by Port with registers width specified by Width.
38   The read value is returned. If such operations are not supported, then ASSERT().
39   This function must guarantee that all I/O read and write operations are serialized.
40 
41   @param  Port          The base address of the I/O operation.
42                         The caller is responsible for aligning the Address if required.
43   @param  Width         The width of the I/O operation.
44 
45   @return Data read from registers in the EFI CPU I/O space.
46 
47 **/
48 UINT64
49 EFIAPI
50 IoReadWorker (
51   IN      UINTN                     Port,
52   IN      EFI_CPU_IO_PROTOCOL_WIDTH Width
53   );
54 
55 /**
56   Writes registers in the EFI CPU I/O space.
57 
58   Writes the I/O port specified by Port with registers width and value specified by Width
59   and Data respectively.  Data is returned. If such operations are not supported, then ASSERT().
60   This function must guarantee that all I/O read and write operations are serialized.
61 
62   @param  Port          The base address of the I/O operation.
63                         The caller is responsible for aligning the Address if required.
64   @param  Width         The width of the I/O operation.
65   @param  Data          The value to write to the I/O port.
66 
67   @return The paramter of Data.
68 
69 **/
70 UINT64
71 EFIAPI
72 IoWriteWorker (
73   IN      UINTN                     Port,
74   IN      EFI_CPU_IO_PROTOCOL_WIDTH Width,
75   IN      UINT64                    Data
76   );
77 
78 /**
79   Reads memory-mapped registers in the EFI system memory space.
80 
81   Reads the MMIO registers specified by Address with registers width specified by Width.
82   The read value is returned. If such operations are not supported, then ASSERT().
83   This function must guarantee that all MMIO read and write operations are serialized.
84 
85   @param  Address       The MMIO register to read.
86                         The caller is responsible for aligning the Address if required.
87   @param  Width         The width of the I/O operation.
88 
89   @return Data read from registers in the EFI system memory space.
90 
91 **/
92 UINT64
93 EFIAPI
94 MmioReadWorker (
95   IN      UINTN                     Address,
96   IN      EFI_CPU_IO_PROTOCOL_WIDTH Width
97   );
98 
99 /**
100   Writes memory-mapped registers in the EFI system memory space.
101 
102   Writes the MMIO registers specified by Address with registers width and value specified by Width
103   and Data respectively. Data is returned. If such operations are not supported, then ASSERT().
104   This function must guarantee that all MMIO read and write operations are serialized.
105 
106   @param  Address       The MMIO register to read.
107                         The caller is responsible for aligning the Address if required.
108   @param  Width         The width of the I/O operation.
109   @param  Data          The value to write to the I/O port.
110 
111   @return Data read from registers in the EFI system memory space.
112 
113 **/
114 UINT64
115 EFIAPI
116 MmioWriteWorker (
117   IN      UINTN                     Address,
118   IN      EFI_CPU_IO_PROTOCOL_WIDTH Width,
119   IN      UINT64                    Data
120   );
121 
122 #endif
123