]>
Commit | Line | Data |
---|---|---|
3eb9473e | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2004, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | IoLib.c\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | Light weight lib to support Tiano drivers.\r | |
19 | \r | |
20 | --*/\r | |
21 | \r | |
22 | #include "Tiano.h"\r | |
23 | #include "EfiRuntimeLib.h"\r | |
24 | #include EFI_PROTOCOL_DEFINITION (CpuIo)\r | |
25 | \r | |
26 | extern EFI_CPU_IO_PROTOCOL *gCpuIo;\r | |
27 | \r | |
28 | EFI_STATUS\r | |
29 | EfiIoRead (\r | |
30 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
31 | IN UINT64 Address,\r | |
32 | IN UINTN Count,\r | |
33 | IN OUT VOID *Buffer\r | |
34 | )\r | |
35 | /*++\r | |
36 | \r | |
37 | Routine Description:\r | |
38 | Perform an IO read into Buffer.\r | |
39 | \r | |
40 | Arguments:\r | |
41 | Width - Width of read transaction, and repeat operation to use\r | |
42 | Address - IO address to read\r | |
43 | Count - Number of times to read the IO address.\r | |
44 | Buffer - Buffer to read data into. size is Width * Count\r | |
45 | \r | |
46 | Returns: \r | |
47 | BugBug: Check with Mike to see if I can find this #define some ware else\r | |
48 | \r | |
49 | --*/\r | |
50 | {\r | |
51 | return gCpuIo->Io.Read (gCpuIo, Width, Address, Count, Buffer);\r | |
52 | }\r | |
53 | \r | |
54 | EFI_STATUS\r | |
55 | EfiIoWrite (\r | |
56 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
57 | IN UINT64 Address,\r | |
58 | IN UINTN Count,\r | |
59 | IN OUT VOID *Buffer\r | |
60 | )\r | |
61 | /*++\r | |
62 | \r | |
63 | Routine Description:\r | |
64 | Perform an IO write into Buffer.\r | |
65 | \r | |
66 | Arguments:\r | |
67 | Width - Width of write transaction, and repeat operation to use\r | |
68 | Address - IO address to write\r | |
69 | Count - Number of times to write the IO address.\r | |
70 | Buffer - Buffer to write data from. size is Width * Count\r | |
71 | \r | |
72 | Returns: \r | |
73 | BugBug: Check with Mike to see if I can find this #define some ware else\r | |
74 | \r | |
75 | --*/\r | |
76 | {\r | |
77 | return gCpuIo->Io.Write (gCpuIo, Width, Address, Count, Buffer);\r | |
78 | }\r | |
79 | \r | |
80 | EFI_STATUS\r | |
81 | EfiMemRead (\r | |
82 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
83 | IN UINT64 Address,\r | |
84 | IN UINTN Count,\r | |
85 | IN OUT VOID *Buffer\r | |
86 | )\r | |
87 | /*++\r | |
88 | \r | |
89 | Routine Description:\r | |
90 | Perform a Memory mapped IO read into Buffer.\r | |
91 | \r | |
92 | Arguments:\r | |
93 | Width - Width of each read transaction.\r | |
94 | Address - Memory mapped IO address to read\r | |
95 | Count - Number of Width quanta to read\r | |
96 | Buffer - Buffer to read data into. size is Width * Count\r | |
97 | \r | |
98 | Returns: \r | |
99 | BugBug: Check with Mike to see if I can find this #define some ware else\r | |
100 | \r | |
101 | --*/\r | |
102 | {\r | |
103 | return gCpuIo->Mem.Read (gCpuIo, Width, Address, Count, Buffer);\r | |
104 | }\r | |
105 | \r | |
106 | EFI_STATUS\r | |
107 | EfiMemWrite (\r | |
108 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
109 | IN UINT64 Address,\r | |
110 | IN UINTN Count,\r | |
111 | IN OUT VOID *Buffer\r | |
112 | )\r | |
113 | /*++\r | |
114 | \r | |
115 | Routine Description:\r | |
116 | Perform a memory mapped IO write into Buffer.\r | |
117 | \r | |
118 | Arguments:\r | |
119 | Width - Width of write transaction, and repeat operation to use\r | |
120 | Address - IO address to write\r | |
121 | Count - Number of times to write the IO address.\r | |
122 | Buffer - Buffer to write data from. size is Width * Count\r | |
123 | \r | |
124 | Returns: \r | |
125 | BugBug: Check with Mike to see if I can find this #define some ware else\r | |
126 | \r | |
127 | --*/\r | |
128 | {\r | |
129 | return gCpuIo->Mem.Write (gCpuIo, Width, Address, Count, Buffer);\r | |
130 | }\r |