]>
Commit | Line | Data |
---|---|---|
fb3df220 | 1 | /** @file\r |
50a64e5b | 2 | Provides services to access PCI Configuration Space on a platform with multiple PCI segments.\r |
badcbfb2 | 3 | \r |
4 | The PCI Segment Library function provide services to read, write, and modify the PCI configuration\r | |
5 | registers on PCI root bridges on any supported PCI segment. These library services take a single \r | |
6 | address parameter that encodes the PCI Segment, PCI Bus, PCI Device, PCI Function, and PCI Register. \r | |
7 | The layout of this address parameter is as follows:\r | |
8 | \r | |
40731047 | 9 | PCI Register: Bits 0..11\r |
10 | PCI Function Bits 12..14\r | |
11 | PCI Device Bits 15..19\r | |
12 | PCI Bus Bits 20..27\r | |
13 | Reserved Bits 28..31. Must be 0.\r | |
14 | PCI Segment Bits 32..47\r | |
15 | Reserved Bits 48..63. Must be 0.\r | |
badcbfb2 | 16 | \r |
17 | | Reserved (MBZ) | Segment | Reserved (MBZ) | Bus | Device | Function | Register |\r | |
18 | 63 48 47 32 31 28 27 20 19 15 14 12 11 0\r | |
19 | \r | |
20 | These functions perform PCI configuration cycles using the default PCI configuration access \r | |
21 | method. This may use I/O ports 0xCF8 and 0xCFC to perform PCI configuration accesses, or it \r | |
22 | may use MMIO registers relative to the PcdPciExpressBaseAddress, or it may use some alternate \r | |
23 | access method. Modules will typically use the PCI Segment Library for its PCI configuration \r | |
24 | accesses when PCI Segments other than Segment #0 must be accessed. \r | |
fb3df220 | 25 | \r |
94952554 | 26 | Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r |
9df063a0 | 27 | This program and the accompanying materials\r |
50a64e5b | 28 | are licensed and made available under the terms and conditions of the BSD License\r |
29 | which accompanies this distribution. The full text of the license may be found at\r | |
30 | http://opensource.org/licenses/bsd-license.php\r | |
fb3df220 | 31 | \r |
50a64e5b | 32 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
33 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
fb3df220 | 34 | \r |
fb3df220 | 35 | **/\r |
36 | \r | |
37 | #ifndef __PCI_SEGMENT_LIB__\r | |
38 | #define __PCI_SEGMENT_LIB__\r | |
39 | \r | |
40 | \r | |
41 | /**\r | |
42 | Macro that converts PCI Segment, PCI Bus, PCI Device, PCI Function,\r | |
43 | and PCI Register to an address that can be passed to the PCI Segment Library functions.\r | |
44 | \r | |
45 | Computes an address that is compatible with the PCI Segment Library functions.\r | |
46 | The unused upper bits of Segment, Bus, Device, Function,\r | |
47 | and Register are stripped prior to the generation of the address.\r | |
48 | \r | |
49 | @param Segment PCI Segment number. Range 0..65535.\r | |
50 | @param Bus PCI Bus number. Range 0..255.\r | |
51 | @param Device PCI Device number. Range 0..31.\r | |
52 | @param Function PCI Function number. Range 0..7.\r | |
53 | @param Register PCI Register number. Range 0..255 for PCI. Range 0..4095 for PCI Express.\r | |
54 | \r | |
55 | @return The address that is compatible with the PCI Segment Library functions.\r | |
56 | \r | |
57 | **/\r | |
58 | #define PCI_SEGMENT_LIB_ADDRESS(Segment,Bus,Device,Function,Register) \\r | |
59 | ( ((Register) & 0xfff) | \\r | |
60 | (((Function) & 0x07) << 12) | \\r | |
61 | (((Device) & 0x1f) << 15) | \\r | |
62 | (((Bus) & 0xff) << 20) | \\r | |
63 | (LShiftU64((Segment) & 0xffff, 32)) \\r | |
64 | )\r | |
65 | \r | |
f926e538 | 66 | /**\r |
67 | Register a PCI device so PCI configuration registers may be accessed after \r | |
68 | SetVirtualAddressMap().\r | |
69 | \r | |
59ceeabe | 70 | If any reserved bits in Address are set, then ASSERT().\r |
f926e538 | 71 | \r |
72 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
73 | Register.\r | |
74 | \r | |
75 | @retval RETURN_SUCCESS The PCI device was registered for runtime access.\r | |
76 | @retval RETURN_UNSUPPORTED An attempt was made to call this function \r | |
77 | after ExitBootServices().\r | |
78 | @retval RETURN_UNSUPPORTED The resources required to access the PCI device\r | |
79 | at runtime could not be mapped.\r | |
80 | @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to\r | |
81 | complete the registration.\r | |
82 | \r | |
83 | **/\r | |
84 | RETURN_STATUS\r | |
85 | EFIAPI\r | |
86 | PciSegmentRegisterForRuntimeAccess (\r | |
87 | IN UINTN Address\r | |
88 | );\r | |
89 | \r | |
fb3df220 | 90 | /**\r |
91 | Reads an 8-bit PCI configuration register.\r | |
92 | \r | |
93 | Reads and returns the 8-bit PCI configuration register specified by Address.\r | |
94 | This function must guarantee that all PCI read and write operations are serialized.\r | |
badcbfb2 | 95 | \r |
fb3df220 | 96 | If any reserved bits in Address are set, then ASSERT().\r |
97 | \r | |
98 | @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r | |
99 | \r | |
100 | @return The 8-bit PCI configuration register specified by Address.\r | |
101 | \r | |
102 | **/\r | |
103 | UINT8\r | |
104 | EFIAPI\r | |
105 | PciSegmentRead8 (\r | |
106 | IN UINT64 Address\r | |
ed66e1bc | 107 | );\r |
fb3df220 | 108 | \r |
109 | /**\r | |
110 | Writes an 8-bit PCI configuration register.\r | |
111 | \r | |
112 | Writes the 8-bit PCI configuration register specified by Address with the value specified by Value.\r | |
113 | Value is returned. This function must guarantee that all PCI read and write operations are serialized.\r | |
badcbfb2 | 114 | \r |
59ceeabe | 115 | If any reserved bits in Address are set, then ASSERT().\r |
fb3df220 | 116 | \r |
117 | @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r | |
118 | @param Value The value to write.\r | |
119 | \r | |
d5979dc0 | 120 | @return The value written to the PCI configuration register.\r |
fb3df220 | 121 | \r |
122 | **/\r | |
123 | UINT8\r | |
124 | EFIAPI\r | |
125 | PciSegmentWrite8 (\r | |
126 | IN UINT64 Address,\r | |
127 | IN UINT8 Value\r | |
ed66e1bc | 128 | );\r |
fb3df220 | 129 | \r |
130 | /**\r | |
62991af2 | 131 | Performs a bitwise OR of an 8-bit PCI configuration register with an 8-bit value.\r |
fb3df220 | 132 | \r |
133 | Reads the 8-bit PCI configuration register specified by Address,\r | |
62991af2 | 134 | performs a bitwise OR between the read result and the value specified by OrData,\r |
fb3df220 | 135 | and writes the result to the 8-bit PCI configuration register specified by Address.\r |
136 | The value written to the PCI configuration register is returned.\r | |
137 | This function must guarantee that all PCI read and write operations are serialized.\r | |
badcbfb2 | 138 | \r |
fb3df220 | 139 | If any reserved bits in Address are set, then ASSERT().\r |
140 | \r | |
141 | @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r | |
142 | @param OrData The value to OR with the PCI configuration register.\r | |
143 | \r | |
144 | @return The value written to the PCI configuration register.\r | |
145 | \r | |
146 | **/\r | |
147 | UINT8\r | |
148 | EFIAPI\r | |
149 | PciSegmentOr8 (\r | |
150 | IN UINT64 Address,\r | |
151 | IN UINT8 OrData\r | |
ed66e1bc | 152 | );\r |
fb3df220 | 153 | \r |
154 | /**\r | |
155 | Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value.\r | |
156 | \r | |
157 | Reads the 8-bit PCI configuration register specified by Address,\r | |
158 | performs a bitwise AND between the read result and the value specified by AndData,\r | |
159 | and writes the result to the 8-bit PCI configuration register specified by Address.\r | |
160 | The value written to the PCI configuration register is returned.\r | |
161 | This function must guarantee that all PCI read and write operations are serialized.\r | |
162 | If any reserved bits in Address are set, then ASSERT().\r | |
163 | \r | |
164 | @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r | |
7d9333a9 | 165 | @param AndData The value to AND with the PCI configuration register.\r |
fb3df220 | 166 | \r |
167 | @return The value written to the PCI configuration register.\r | |
168 | \r | |
169 | **/\r | |
170 | UINT8\r | |
171 | EFIAPI\r | |
172 | PciSegmentAnd8 (\r | |
173 | IN UINT64 Address,\r | |
174 | IN UINT8 AndData\r | |
ed66e1bc | 175 | );\r |
fb3df220 | 176 | \r |
177 | /**\r | |
178 | Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value,\r | |
62991af2 | 179 | followed a bitwise OR with another 8-bit value.\r |
fb3df220 | 180 | \r |
181 | Reads the 8-bit PCI configuration register specified by Address,\r | |
182 | performs a bitwise AND between the read result and the value specified by AndData,\r | |
62991af2 | 183 | performs a bitwise OR between the result of the AND operation and the value specified by OrData,\r |
fb3df220 | 184 | and writes the result to the 8-bit PCI configuration register specified by Address.\r |
185 | The value written to the PCI configuration register is returned.\r | |
186 | This function must guarantee that all PCI read and write operations are serialized.\r | |
badcbfb2 | 187 | \r |
fb3df220 | 188 | If any reserved bits in Address are set, then ASSERT().\r |
189 | \r | |
190 | @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r | |
42eedea9 | 191 | @param AndData The value to AND with the PCI configuration register.\r |
fb3df220 | 192 | @param OrData The value to OR with the PCI configuration register.\r |
193 | \r | |
194 | @return The value written to the PCI configuration register.\r | |
195 | \r | |
196 | **/\r | |
197 | UINT8\r | |
198 | EFIAPI\r | |
199 | PciSegmentAndThenOr8 (\r | |
200 | IN UINT64 Address,\r | |
201 | IN UINT8 AndData,\r | |
202 | IN UINT8 OrData\r | |
ed66e1bc | 203 | );\r |
fb3df220 | 204 | \r |
205 | /**\r | |
206 | Reads a bit field of a PCI configuration register.\r | |
207 | \r | |
d5979dc0 | 208 | Reads the bit field in an 8-bit PCI configuration register. The bit field is\r |
209 | specified by the StartBit and the EndBit. The value of the bit field is\r | |
210 | returned.\r | |
211 | \r | |
fb3df220 | 212 | If any reserved bits in Address are set, then ASSERT().\r |
213 | If StartBit is greater than 7, then ASSERT().\r | |
214 | If EndBit is greater than 7, then ASSERT().\r | |
215 | If EndBit is less than StartBit, then ASSERT().\r | |
216 | \r | |
d5979dc0 | 217 | @param Address PCI configuration register to read.\r |
fb3df220 | 218 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
d5979dc0 | 219 | Range 0..7.\r |
fb3df220 | 220 | @param EndBit The ordinal of the most significant bit in the bit field.\r |
d5979dc0 | 221 | Range 0..7.\r |
fb3df220 | 222 | \r |
d5979dc0 | 223 | @return The value of the bit field read from the PCI configuration register.\r |
fb3df220 | 224 | \r |
225 | **/\r | |
226 | UINT8\r | |
227 | EFIAPI\r | |
228 | PciSegmentBitFieldRead8 (\r | |
229 | IN UINT64 Address,\r | |
230 | IN UINTN StartBit,\r | |
231 | IN UINTN EndBit\r | |
ed66e1bc | 232 | );\r |
fb3df220 | 233 | \r |
234 | /**\r | |
235 | Writes a bit field to a PCI configuration register.\r | |
236 | \r | |
d5979dc0 | 237 | Writes Value to the bit field of the PCI configuration register. The bit\r |
238 | field is specified by the StartBit and the EndBit. All other bits in the\r | |
239 | destination PCI configuration register are preserved. The new value of the\r | |
240 | 8-bit register is returned.\r | |
241 | \r | |
fb3df220 | 242 | If any reserved bits in Address are set, then ASSERT().\r |
243 | If StartBit is greater than 7, then ASSERT().\r | |
244 | If EndBit is greater than 7, then ASSERT().\r | |
245 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 246 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 247 | \r |
d5979dc0 | 248 | @param Address PCI configuration register to write.\r |
fb3df220 | 249 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
d5979dc0 | 250 | Range 0..7.\r |
fb3df220 | 251 | @param EndBit The ordinal of the most significant bit in the bit field.\r |
d5979dc0 | 252 | Range 0..7.\r |
fb3df220 | 253 | @param Value New value of the bit field.\r |
254 | \r | |
d5979dc0 | 255 | @return The value written back to the PCI configuration register.\r |
fb3df220 | 256 | \r |
257 | **/\r | |
258 | UINT8\r | |
259 | EFIAPI\r | |
260 | PciSegmentBitFieldWrite8 (\r | |
261 | IN UINT64 Address,\r | |
262 | IN UINTN StartBit,\r | |
263 | IN UINTN EndBit,\r | |
264 | IN UINT8 Value\r | |
ed66e1bc | 265 | );\r |
fb3df220 | 266 | \r |
267 | /**\r | |
d5979dc0 | 268 | Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and\r |
269 | writes the result back to the bit field in the 8-bit port.\r | |
270 | \r | |
271 | Reads the 8-bit PCI configuration register specified by Address, performs a\r | |
62991af2 | 272 | bitwise OR between the read result and the value specified by\r |
d5979dc0 | 273 | OrData, and writes the result to the 8-bit PCI configuration register\r |
274 | specified by Address. The value written to the PCI configuration register is\r | |
275 | returned. This function must guarantee that all PCI read and write operations\r | |
276 | are serialized. Extra left bits in OrData are stripped.\r | |
277 | \r | |
badcbfb2 | 278 | If any reserved bits in Address are set, then ASSERT().\r |
279 | If StartBit is greater than 7, then ASSERT().\r | |
280 | If EndBit is greater than 7, then ASSERT().\r | |
281 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 282 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 283 | \r |
d5979dc0 | 284 | @param Address PCI configuration register to write.\r |
fb3df220 | 285 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
d5979dc0 | 286 | Range 0..7.\r |
fb3df220 | 287 | @param EndBit The ordinal of the most significant bit in the bit field.\r |
d5979dc0 | 288 | Range 0..7.\r |
289 | @param OrData The value to OR with the PCI configuration register.\r | |
fb3df220 | 290 | \r |
d5979dc0 | 291 | @return The value written back to the PCI configuration register.\r |
fb3df220 | 292 | \r |
293 | **/\r | |
294 | UINT8\r | |
295 | EFIAPI\r | |
296 | PciSegmentBitFieldOr8 (\r | |
297 | IN UINT64 Address,\r | |
298 | IN UINTN StartBit,\r | |
299 | IN UINTN EndBit,\r | |
300 | IN UINT8 OrData\r | |
ed66e1bc | 301 | );\r |
fb3df220 | 302 | \r |
303 | /**\r | |
d5979dc0 | 304 | Reads a bit field in an 8-bit PCI configuration register, performs a bitwise\r |
305 | AND, and writes the result back to the bit field in the 8-bit register.\r | |
306 | \r | |
307 | Reads the 8-bit PCI configuration register specified by Address, performs a\r | |
308 | bitwise AND between the read result and the value specified by AndData, and\r | |
309 | writes the result to the 8-bit PCI configuration register specified by\r | |
310 | Address. The value written to the PCI configuration register is returned.\r | |
311 | This function must guarantee that all PCI read and write operations are\r | |
312 | serialized. Extra left bits in AndData are stripped.\r | |
fb3df220 | 313 | \r |
fb3df220 | 314 | If any reserved bits in Address are set, then ASSERT().\r |
315 | If StartBit is greater than 7, then ASSERT().\r | |
316 | If EndBit is greater than 7, then ASSERT().\r | |
317 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 318 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 319 | \r |
d5979dc0 | 320 | @param Address PCI configuration register to write.\r |
fb3df220 | 321 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
d5979dc0 | 322 | Range 0..7.\r |
fb3df220 | 323 | @param EndBit The ordinal of the most significant bit in the bit field.\r |
d5979dc0 | 324 | Range 0..7.\r |
325 | @param AndData The value to AND with the PCI configuration register.\r | |
fb3df220 | 326 | \r |
d5979dc0 | 327 | @return The value written back to the PCI configuration register.\r |
fb3df220 | 328 | \r |
329 | **/\r | |
330 | UINT8\r | |
331 | EFIAPI\r | |
332 | PciSegmentBitFieldAnd8 (\r | |
333 | IN UINT64 Address,\r | |
334 | IN UINTN StartBit,\r | |
335 | IN UINTN EndBit,\r | |
336 | IN UINT8 AndData\r | |
ed66e1bc | 337 | );\r |
fb3df220 | 338 | \r |
339 | /**\r | |
d5979dc0 | 340 | Reads a bit field in an 8-bit port, performs a bitwise AND followed by a\r |
62991af2 | 341 | bitwise OR, and writes the result back to the bit field in the\r |
d5979dc0 | 342 | 8-bit port.\r |
343 | \r | |
344 | Reads the 8-bit PCI configuration register specified by Address, performs a\r | |
62991af2 | 345 | bitwise AND followed by a bitwise OR between the read result and\r |
d5979dc0 | 346 | the value specified by AndData, and writes the result to the 8-bit PCI\r |
347 | configuration register specified by Address. The value written to the PCI\r | |
348 | configuration register is returned. This function must guarantee that all PCI\r | |
349 | read and write operations are serialized. Extra left bits in both AndData and\r | |
350 | OrData are stripped.\r | |
351 | \r | |
fb3df220 | 352 | If any reserved bits in Address are set, then ASSERT().\r |
353 | If StartBit is greater than 7, then ASSERT().\r | |
354 | If EndBit is greater than 7, then ASSERT().\r | |
355 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
356 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
357 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
fb3df220 | 358 | \r |
d5979dc0 | 359 | @param Address PCI configuration register to write.\r |
fb3df220 | 360 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
d5979dc0 | 361 | Range 0..7.\r |
fb3df220 | 362 | @param EndBit The ordinal of the most significant bit in the bit field.\r |
d5979dc0 | 363 | Range 0..7.\r |
364 | @param AndData The value to AND with the PCI configuration register.\r | |
365 | @param OrData The value to OR with the result of the AND operation.\r | |
fb3df220 | 366 | \r |
d5979dc0 | 367 | @return The value written back to the PCI configuration register.\r |
fb3df220 | 368 | \r |
369 | **/\r | |
370 | UINT8\r | |
371 | EFIAPI\r | |
372 | PciSegmentBitFieldAndThenOr8 (\r | |
373 | IN UINT64 Address,\r | |
374 | IN UINTN StartBit,\r | |
375 | IN UINTN EndBit,\r | |
376 | IN UINT8 AndData,\r | |
377 | IN UINT8 OrData\r | |
ed66e1bc | 378 | );\r |
fb3df220 | 379 | \r |
380 | /**\r | |
381 | Reads a 16-bit PCI configuration register.\r | |
382 | \r | |
383 | Reads and returns the 16-bit PCI configuration register specified by Address.\r | |
384 | This function must guarantee that all PCI read and write operations are serialized.\r | |
badcbfb2 | 385 | \r |
fb3df220 | 386 | If any reserved bits in Address are set, then ASSERT().\r |
badcbfb2 | 387 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
fb3df220 | 388 | \r |
389 | @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r | |
390 | \r | |
391 | @return The 16-bit PCI configuration register specified by Address.\r | |
392 | \r | |
393 | **/\r | |
394 | UINT16\r | |
395 | EFIAPI\r | |
396 | PciSegmentRead16 (\r | |
397 | IN UINT64 Address\r | |
ed66e1bc | 398 | );\r |
fb3df220 | 399 | \r |
400 | /**\r | |
401 | Writes a 16-bit PCI configuration register.\r | |
402 | \r | |
403 | Writes the 16-bit PCI configuration register specified by Address with the value specified by Value.\r | |
404 | Value is returned. This function must guarantee that all PCI read and write operations are serialized.\r | |
badcbfb2 | 405 | \r |
406 | If any reserved bits in Address are set, then ASSERT().\r | |
407 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r | |
fb3df220 | 408 | \r |
409 | @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r | |
410 | @param Value The value to write.\r | |
411 | \r | |
412 | @return The parameter of Value.\r | |
413 | \r | |
414 | **/\r | |
415 | UINT16\r | |
416 | EFIAPI\r | |
417 | PciSegmentWrite16 (\r | |
418 | IN UINT64 Address,\r | |
419 | IN UINT16 Value\r | |
ed66e1bc | 420 | );\r |
fb3df220 | 421 | \r |
422 | /**\r | |
62991af2 | 423 | Performs a bitwise OR of a 16-bit PCI configuration register with\r |
d5979dc0 | 424 | a 16-bit value.\r |
425 | \r | |
426 | Reads the 16-bit PCI configuration register specified by Address, performs a\r | |
62991af2 | 427 | bitwise OR between the read result and the value specified by\r |
d5979dc0 | 428 | OrData, and writes the result to the 16-bit PCI configuration register\r |
429 | specified by Address. The value written to the PCI configuration register is\r | |
430 | returned. This function must guarantee that all PCI read and write operations\r | |
431 | are serialized.\r | |
fb3df220 | 432 | \r |
fb3df220 | 433 | If any reserved bits in Address are set, then ASSERT().\r |
badcbfb2 | 434 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
fb3df220 | 435 | \r |
d5979dc0 | 436 | @param Address Address that encodes the PCI Segment, Bus, Device, Function and\r |
437 | Register.\r | |
438 | @param OrData The value to OR with the PCI configuration register.\r | |
fb3df220 | 439 | \r |
d5979dc0 | 440 | @return The value written back to the PCI configuration register.\r |
fb3df220 | 441 | \r |
442 | **/\r | |
443 | UINT16\r | |
444 | EFIAPI\r | |
445 | PciSegmentOr16 (\r | |
446 | IN UINT64 Address,\r | |
447 | IN UINT16 OrData\r | |
ed66e1bc | 448 | );\r |
fb3df220 | 449 | \r |
450 | /**\r | |
451 | Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value.\r | |
452 | \r | |
453 | Reads the 16-bit PCI configuration register specified by Address,\r | |
454 | performs a bitwise AND between the read result and the value specified by AndData,\r | |
455 | and writes the result to the 16-bit PCI configuration register specified by Address.\r | |
456 | The value written to the PCI configuration register is returned.\r | |
457 | This function must guarantee that all PCI read and write operations are serialized.\r | |
badcbfb2 | 458 | \r |
fb3df220 | 459 | If any reserved bits in Address are set, then ASSERT().\r |
badcbfb2 | 460 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
461 | \r | |
fb3df220 | 462 | @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r |
7d9333a9 | 463 | @param AndData The value to AND with the PCI configuration register.\r |
fb3df220 | 464 | \r |
465 | @return The value written to the PCI configuration register.\r | |
466 | \r | |
467 | **/\r | |
468 | UINT16\r | |
469 | EFIAPI\r | |
470 | PciSegmentAnd16 (\r | |
471 | IN UINT64 Address,\r | |
472 | IN UINT16 AndData\r | |
ed66e1bc | 473 | );\r |
fb3df220 | 474 | \r |
475 | /**\r | |
476 | Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value,\r | |
62991af2 | 477 | followed a bitwise OR with another 16-bit value.\r |
fb3df220 | 478 | \r |
479 | Reads the 16-bit PCI configuration register specified by Address,\r | |
480 | performs a bitwise AND between the read result and the value specified by AndData,\r | |
62991af2 | 481 | performs a bitwise OR between the result of the AND operation and the value specified by OrData,\r |
fb3df220 | 482 | and writes the result to the 16-bit PCI configuration register specified by Address.\r |
483 | The value written to the PCI configuration register is returned.\r | |
484 | This function must guarantee that all PCI read and write operations are serialized.\r | |
badcbfb2 | 485 | \r |
fb3df220 | 486 | If any reserved bits in Address are set, then ASSERT().\r |
badcbfb2 | 487 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
fb3df220 | 488 | \r |
489 | @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r | |
42eedea9 | 490 | @param AndData The value to AND with the PCI configuration register.\r |
fb3df220 | 491 | @param OrData The value to OR with the PCI configuration register.\r |
492 | \r | |
493 | @return The value written to the PCI configuration register.\r | |
494 | \r | |
495 | **/\r | |
496 | UINT16\r | |
497 | EFIAPI\r | |
498 | PciSegmentAndThenOr16 (\r | |
499 | IN UINT64 Address,\r | |
500 | IN UINT16 AndData,\r | |
501 | IN UINT16 OrData\r | |
ed66e1bc | 502 | );\r |
fb3df220 | 503 | \r |
504 | /**\r | |
505 | Reads a bit field of a PCI configuration register.\r | |
506 | \r | |
d5979dc0 | 507 | Reads the bit field in a 16-bit PCI configuration register. The bit field is\r |
508 | specified by the StartBit and the EndBit. The value of the bit field is\r | |
509 | returned.\r | |
510 | \r | |
fb3df220 | 511 | If any reserved bits in Address are set, then ASSERT().\r |
badcbfb2 | 512 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
d5979dc0 | 513 | If StartBit is greater than 15, then ASSERT().\r |
514 | If EndBit is greater than 15, then ASSERT().\r | |
fb3df220 | 515 | If EndBit is less than StartBit, then ASSERT().\r |
516 | \r | |
d5979dc0 | 517 | @param Address PCI configuration register to read.\r |
fb3df220 | 518 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
d5979dc0 | 519 | Range 0..15.\r |
fb3df220 | 520 | @param EndBit The ordinal of the most significant bit in the bit field.\r |
d5979dc0 | 521 | Range 0..15.\r |
fb3df220 | 522 | \r |
d5979dc0 | 523 | @return The value of the bit field read from the PCI configuration register.\r |
fb3df220 | 524 | \r |
525 | **/\r | |
526 | UINT16\r | |
527 | EFIAPI\r | |
528 | PciSegmentBitFieldRead16 (\r | |
529 | IN UINT64 Address,\r | |
530 | IN UINTN StartBit,\r | |
531 | IN UINTN EndBit\r | |
ed66e1bc | 532 | );\r |
fb3df220 | 533 | \r |
534 | /**\r | |
535 | Writes a bit field to a PCI configuration register.\r | |
536 | \r | |
d5979dc0 | 537 | Writes Value to the bit field of the PCI configuration register. The bit\r |
538 | field is specified by the StartBit and the EndBit. All other bits in the\r | |
539 | destination PCI configuration register are preserved. The new value of the\r | |
540 | 16-bit register is returned.\r | |
541 | \r | |
fb3df220 | 542 | If any reserved bits in Address are set, then ASSERT().\r |
badcbfb2 | 543 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
d5979dc0 | 544 | If StartBit is greater than 15, then ASSERT().\r |
545 | If EndBit is greater than 15, then ASSERT().\r | |
fb3df220 | 546 | If EndBit is less than StartBit, then ASSERT().\r |
94952554 | 547 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 548 | \r |
d5979dc0 | 549 | @param Address PCI configuration register to write.\r |
fb3df220 | 550 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
d5979dc0 | 551 | Range 0..15.\r |
fb3df220 | 552 | @param EndBit The ordinal of the most significant bit in the bit field.\r |
d5979dc0 | 553 | Range 0..15.\r |
fb3df220 | 554 | @param Value New value of the bit field.\r |
555 | \r | |
d5979dc0 | 556 | @return The value written back to the PCI configuration register.\r |
fb3df220 | 557 | \r |
558 | **/\r | |
559 | UINT16\r | |
560 | EFIAPI\r | |
561 | PciSegmentBitFieldWrite16 (\r | |
562 | IN UINT64 Address,\r | |
563 | IN UINTN StartBit,\r | |
564 | IN UINTN EndBit,\r | |
565 | IN UINT16 Value\r | |
ed66e1bc | 566 | );\r |
fb3df220 | 567 | \r |
568 | /**\r | |
569 | Reads the 16-bit PCI configuration register specified by Address,\r | |
62991af2 | 570 | performs a bitwise OR between the read result and the value specified by OrData,\r |
fb3df220 | 571 | and writes the result to the 16-bit PCI configuration register specified by Address. \r |
572 | \r | |
badcbfb2 | 573 | If any reserved bits in Address are set, then ASSERT().\r |
574 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r | |
575 | If StartBit is greater than 15, then ASSERT().\r | |
576 | If EndBit is greater than 15, then ASSERT().\r | |
577 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 578 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
badcbfb2 | 579 | \r |
d5979dc0 | 580 | @param Address PCI configuration register to write.\r |
fb3df220 | 581 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
d5979dc0 | 582 | Range 0..15.\r |
fb3df220 | 583 | @param EndBit The ordinal of the most significant bit in the bit field.\r |
d5979dc0 | 584 | Range 0..15.\r |
585 | @param OrData The value to OR with the PCI configuration register.\r | |
fb3df220 | 586 | \r |
d5979dc0 | 587 | @return The value written back to the PCI configuration register.\r |
fb3df220 | 588 | \r |
589 | **/\r | |
590 | UINT16\r | |
591 | EFIAPI\r | |
592 | PciSegmentBitFieldOr16 (\r | |
593 | IN UINT64 Address,\r | |
594 | IN UINTN StartBit,\r | |
595 | IN UINTN EndBit,\r | |
596 | IN UINT16 OrData\r | |
ed66e1bc | 597 | );\r |
fb3df220 | 598 | \r |
599 | /**\r | |
600 | Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR,\r | |
601 | and writes the result back to the bit field in the 16-bit port.\r | |
602 | \r | |
603 | Reads the 16-bit PCI configuration register specified by Address,\r | |
62991af2 | 604 | performs a bitwise OR between the read result and the value specified by OrData,\r |
fb3df220 | 605 | and writes the result to the 16-bit PCI configuration register specified by Address.\r |
606 | The value written to the PCI configuration register is returned.\r | |
607 | This function must guarantee that all PCI read and write operations are serialized.\r | |
608 | Extra left bits in OrData are stripped.\r | |
badcbfb2 | 609 | \r |
fb3df220 | 610 | If any reserved bits in Address are set, then ASSERT().\r |
badcbfb2 | 611 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
fb3df220 | 612 | If StartBit is greater than 7, then ASSERT().\r |
613 | If EndBit is greater than 7, then ASSERT().\r | |
614 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 615 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 616 | \r |
617 | @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r | |
618 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
619 | The ordinal of the least significant bit in a byte is bit 0.\r | |
620 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
621 | The ordinal of the most significant bit in a byte is bit 7.\r | |
622 | @param AndData The value to AND with the read value from the PCI configuration register.\r | |
623 | \r | |
624 | @return The value written to the PCI configuration register.\r | |
625 | \r | |
626 | **/\r | |
627 | UINT16\r | |
628 | EFIAPI\r | |
629 | PciSegmentBitFieldAnd16 (\r | |
630 | IN UINT64 Address,\r | |
631 | IN UINTN StartBit,\r | |
632 | IN UINTN EndBit,\r | |
633 | IN UINT16 AndData\r | |
ed66e1bc | 634 | );\r |
fb3df220 | 635 | \r |
636 | /**\r | |
d5979dc0 | 637 | Reads a bit field in a 16-bit port, performs a bitwise AND followed by a\r |
62991af2 | 638 | bitwise OR, and writes the result back to the bit field in the\r |
d5979dc0 | 639 | 16-bit port.\r |
640 | \r | |
641 | Reads the 16-bit PCI configuration register specified by Address, performs a\r | |
62991af2 | 642 | bitwise AND followed by a bitwise OR between the read result and\r |
d5979dc0 | 643 | the value specified by AndData, and writes the result to the 16-bit PCI\r |
644 | configuration register specified by Address. The value written to the PCI\r | |
645 | configuration register is returned. This function must guarantee that all PCI\r | |
646 | read and write operations are serialized. Extra left bits in both AndData and\r | |
647 | OrData are stripped.\r | |
648 | \r | |
fb3df220 | 649 | If any reserved bits in Address are set, then ASSERT().\r |
d5979dc0 | 650 | If StartBit is greater than 15, then ASSERT().\r |
651 | If EndBit is greater than 15, then ASSERT().\r | |
fb3df220 | 652 | If EndBit is less than StartBit, then ASSERT().\r |
94952554 LG |
653 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
654 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
fb3df220 | 655 | \r |
d5979dc0 | 656 | @param Address PCI configuration register to write.\r |
fb3df220 | 657 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
d5979dc0 | 658 | Range 0..15.\r |
fb3df220 | 659 | @param EndBit The ordinal of the most significant bit in the bit field.\r |
d5979dc0 | 660 | Range 0..15.\r |
661 | @param AndData The value to AND with the PCI configuration register.\r | |
662 | @param OrData The value to OR with the result of the AND operation.\r | |
fb3df220 | 663 | \r |
d5979dc0 | 664 | @return The value written back to the PCI configuration register.\r |
fb3df220 | 665 | \r |
666 | **/\r | |
667 | UINT16\r | |
668 | EFIAPI\r | |
669 | PciSegmentBitFieldAndThenOr16 (\r | |
670 | IN UINT64 Address,\r | |
671 | IN UINTN StartBit,\r | |
672 | IN UINTN EndBit,\r | |
673 | IN UINT16 AndData,\r | |
674 | IN UINT16 OrData\r | |
ed66e1bc | 675 | );\r |
fb3df220 | 676 | \r |
677 | /**\r | |
678 | Reads a 32-bit PCI configuration register.\r | |
679 | \r | |
680 | Reads and returns the 32-bit PCI configuration register specified by Address.\r | |
681 | This function must guarantee that all PCI read and write operations are serialized.\r | |
fb3df220 | 682 | \r |
badcbfb2 | 683 | If any reserved bits in Address are set, then ASSERT().\r |
684 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r | |
685 | \r | |
fb3df220 | 686 | @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r |
687 | \r | |
688 | @return The 32-bit PCI configuration register specified by Address.\r | |
689 | \r | |
690 | **/\r | |
691 | UINT32\r | |
692 | EFIAPI\r | |
693 | PciSegmentRead32 (\r | |
694 | IN UINT64 Address\r | |
ed66e1bc | 695 | );\r |
fb3df220 | 696 | \r |
697 | /**\r | |
698 | Writes a 32-bit PCI configuration register.\r | |
699 | \r | |
700 | Writes the 32-bit PCI configuration register specified by Address with the value specified by Value.\r | |
701 | Value is returned. This function must guarantee that all PCI read and write operations are serialized.\r | |
badcbfb2 | 702 | \r |
703 | If any reserved bits in Address are set, then ASSERT().\r | |
704 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r | |
fb3df220 | 705 | \r |
706 | @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r | |
707 | @param Value The value to write.\r | |
708 | \r | |
709 | @return The parameter of Value.\r | |
710 | \r | |
711 | **/\r | |
712 | UINT32\r | |
713 | EFIAPI\r | |
714 | PciSegmentWrite32 (\r | |
715 | IN UINT64 Address,\r | |
716 | IN UINT32 Value\r | |
ed66e1bc | 717 | );\r |
fb3df220 | 718 | \r |
719 | /**\r | |
62991af2 | 720 | Performs a bitwise OR of a 32-bit PCI configuration register with a 32-bit value.\r |
fb3df220 | 721 | \r |
722 | Reads the 32-bit PCI configuration register specified by Address,\r | |
62991af2 | 723 | performs a bitwise OR between the read result and the value specified by OrData,\r |
fb3df220 | 724 | and writes the result to the 32-bit PCI configuration register specified by Address.\r |
725 | The value written to the PCI configuration register is returned.\r | |
726 | This function must guarantee that all PCI read and write operations are serialized.\r | |
badcbfb2 | 727 | \r |
fb3df220 | 728 | If any reserved bits in Address are set, then ASSERT().\r |
badcbfb2 | 729 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
fb3df220 | 730 | \r |
731 | @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r | |
732 | @param OrData The value to OR with the PCI configuration register.\r | |
733 | \r | |
734 | @return The value written to the PCI configuration register.\r | |
735 | \r | |
736 | **/\r | |
737 | UINT32\r | |
738 | EFIAPI\r | |
739 | PciSegmentOr32 (\r | |
740 | IN UINT64 Address,\r | |
741 | IN UINT32 OrData\r | |
ed66e1bc | 742 | );\r |
fb3df220 | 743 | \r |
744 | /**\r | |
745 | Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value.\r | |
746 | \r | |
747 | Reads the 32-bit PCI configuration register specified by Address,\r | |
748 | performs a bitwise AND between the read result and the value specified by AndData,\r | |
749 | and writes the result to the 32-bit PCI configuration register specified by Address.\r | |
750 | The value written to the PCI configuration register is returned.\r | |
751 | This function must guarantee that all PCI read and write operations are serialized.\r | |
badcbfb2 | 752 | \r |
fb3df220 | 753 | If any reserved bits in Address are set, then ASSERT().\r |
badcbfb2 | 754 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
fb3df220 | 755 | \r |
756 | @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r | |
7d9333a9 | 757 | @param AndData The value to AND with the PCI configuration register.\r |
fb3df220 | 758 | \r |
759 | @return The value written to the PCI configuration register.\r | |
760 | \r | |
761 | **/\r | |
762 | UINT32\r | |
763 | EFIAPI\r | |
764 | PciSegmentAnd32 (\r | |
765 | IN UINT64 Address,\r | |
766 | IN UINT32 AndData\r | |
ed66e1bc | 767 | );\r |
fb3df220 | 768 | \r |
769 | /**\r | |
770 | Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value,\r | |
62991af2 | 771 | followed a bitwise OR with another 32-bit value.\r |
fb3df220 | 772 | \r |
773 | Reads the 32-bit PCI configuration register specified by Address,\r | |
774 | performs a bitwise AND between the read result and the value specified by AndData,\r | |
62991af2 | 775 | performs a bitwise OR between the result of the AND operation and the value specified by OrData,\r |
fb3df220 | 776 | and writes the result to the 32-bit PCI configuration register specified by Address.\r |
777 | The value written to the PCI configuration register is returned.\r | |
778 | This function must guarantee that all PCI read and write operations are serialized.\r | |
badcbfb2 | 779 | \r |
fb3df220 | 780 | If any reserved bits in Address are set, then ASSERT().\r |
badcbfb2 | 781 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
fb3df220 | 782 | \r |
783 | @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r | |
7d9333a9 | 784 | @param AndData The value to AND with the PCI configuration register.\r |
fb3df220 | 785 | @param OrData The value to OR with the PCI configuration register.\r |
786 | \r | |
787 | @return The value written to the PCI configuration register.\r | |
788 | \r | |
789 | **/\r | |
790 | UINT32\r | |
791 | EFIAPI\r | |
792 | PciSegmentAndThenOr32 (\r | |
793 | IN UINT64 Address,\r | |
794 | IN UINT32 AndData,\r | |
795 | IN UINT32 OrData\r | |
ed66e1bc | 796 | );\r |
fb3df220 | 797 | \r |
798 | /**\r | |
799 | Reads a bit field of a PCI configuration register.\r | |
800 | \r | |
d5979dc0 | 801 | Reads the bit field in a 32-bit PCI configuration register. The bit field is\r |
802 | specified by the StartBit and the EndBit. The value of the bit field is\r | |
803 | returned.\r | |
804 | \r | |
fb3df220 | 805 | If any reserved bits in Address are set, then ASSERT().\r |
badcbfb2 | 806 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
d5979dc0 | 807 | If StartBit is greater than 31, then ASSERT().\r |
808 | If EndBit is greater than 31, then ASSERT().\r | |
fb3df220 | 809 | If EndBit is less than StartBit, then ASSERT().\r |
810 | \r | |
d5979dc0 | 811 | @param Address PCI configuration register to read.\r |
fb3df220 | 812 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
d5979dc0 | 813 | Range 0..31.\r |
fb3df220 | 814 | @param EndBit The ordinal of the most significant bit in the bit field.\r |
d5979dc0 | 815 | Range 0..31.\r |
fb3df220 | 816 | \r |
d5979dc0 | 817 | @return The value of the bit field read from the PCI configuration register.\r |
fb3df220 | 818 | \r |
819 | **/\r | |
820 | UINT32\r | |
821 | EFIAPI\r | |
822 | PciSegmentBitFieldRead32 (\r | |
823 | IN UINT64 Address,\r | |
824 | IN UINTN StartBit,\r | |
825 | IN UINTN EndBit\r | |
ed66e1bc | 826 | );\r |
fb3df220 | 827 | \r |
828 | /**\r | |
829 | Writes a bit field to a PCI configuration register.\r | |
830 | \r | |
d5979dc0 | 831 | Writes Value to the bit field of the PCI configuration register. The bit\r |
832 | field is specified by the StartBit and the EndBit. All other bits in the\r | |
833 | destination PCI configuration register are preserved. The new value of the\r | |
834 | 32-bit register is returned.\r | |
835 | \r | |
fb3df220 | 836 | If any reserved bits in Address are set, then ASSERT().\r |
badcbfb2 | 837 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
d5979dc0 | 838 | If StartBit is greater than 31, then ASSERT().\r |
839 | If EndBit is greater than 31, then ASSERT().\r | |
fb3df220 | 840 | If EndBit is less than StartBit, then ASSERT().\r |
94952554 | 841 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 842 | \r |
d5979dc0 | 843 | @param Address PCI configuration register to write.\r |
fb3df220 | 844 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
d5979dc0 | 845 | Range 0..31.\r |
fb3df220 | 846 | @param EndBit The ordinal of the most significant bit in the bit field.\r |
d5979dc0 | 847 | Range 0..31.\r |
fb3df220 | 848 | @param Value New value of the bit field.\r |
849 | \r | |
d5979dc0 | 850 | @return The value written back to the PCI configuration register.\r |
fb3df220 | 851 | \r |
852 | **/\r | |
853 | UINT32\r | |
854 | EFIAPI\r | |
855 | PciSegmentBitFieldWrite32 (\r | |
856 | IN UINT64 Address,\r | |
857 | IN UINTN StartBit,\r | |
858 | IN UINTN EndBit,\r | |
859 | IN UINT32 Value\r | |
ed66e1bc | 860 | );\r |
fb3df220 | 861 | \r |
862 | /**\r | |
d5979dc0 | 863 | Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and\r |
864 | writes the result back to the bit field in the 32-bit port.\r | |
865 | \r | |
866 | Reads the 32-bit PCI configuration register specified by Address, performs a\r | |
62991af2 | 867 | bitwise OR between the read result and the value specified by\r |
d5979dc0 | 868 | OrData, and writes the result to the 32-bit PCI configuration register\r |
869 | specified by Address. The value written to the PCI configuration register is\r | |
870 | returned. This function must guarantee that all PCI read and write operations\r | |
871 | are serialized. Extra left bits in OrData are stripped.\r | |
872 | \r | |
badcbfb2 | 873 | If any reserved bits in Address are set, then ASSERT().\r |
d5979dc0 | 874 | If StartBit is greater than 31, then ASSERT().\r |
875 | If EndBit is greater than 31, then ASSERT().\r | |
badcbfb2 | 876 | If EndBit is less than StartBit, then ASSERT().\r |
94952554 | 877 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
d5979dc0 | 878 | \r |
879 | @param Address PCI configuration register to write.\r | |
fb3df220 | 880 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
d5979dc0 | 881 | Range 0..31.\r |
fb3df220 | 882 | @param EndBit The ordinal of the most significant bit in the bit field.\r |
d5979dc0 | 883 | Range 0..31.\r |
884 | @param OrData The value to OR with the PCI configuration register.\r | |
fb3df220 | 885 | \r |
d5979dc0 | 886 | @return The value written back to the PCI configuration register.\r |
fb3df220 | 887 | \r |
888 | **/\r | |
889 | UINT32\r | |
890 | EFIAPI\r | |
891 | PciSegmentBitFieldOr32 (\r | |
892 | IN UINT64 Address,\r | |
893 | IN UINTN StartBit,\r | |
894 | IN UINTN EndBit,\r | |
895 | IN UINT32 OrData\r | |
ed66e1bc | 896 | );\r |
fb3df220 | 897 | \r |
898 | /**\r | |
d5979dc0 | 899 | Reads a bit field in a 32-bit PCI configuration register, performs a bitwise\r |
900 | AND, and writes the result back to the bit field in the 32-bit register.\r | |
fb3df220 | 901 | \r |
badcbfb2 | 902 | \r |
d5979dc0 | 903 | Reads the 32-bit PCI configuration register specified by Address, performs a bitwise\r |
904 | AND between the read result and the value specified by AndData, and writes the result\r | |
905 | to the 32-bit PCI configuration register specified by Address. The value written to\r | |
906 | the PCI configuration register is returned. This function must guarantee that all PCI\r | |
907 | read and write operations are serialized. Extra left bits in AndData are stripped.\r | |
fb3df220 | 908 | If any reserved bits in Address are set, then ASSERT().\r |
badcbfb2 | 909 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
d5979dc0 | 910 | If StartBit is greater than 31, then ASSERT().\r |
911 | If EndBit is greater than 31, then ASSERT().\r | |
fb3df220 | 912 | If EndBit is less than StartBit, then ASSERT().\r |
94952554 | 913 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 914 | \r |
d5979dc0 | 915 | @param Address PCI configuration register to write.\r |
fb3df220 | 916 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
d5979dc0 | 917 | Range 0..31.\r |
fb3df220 | 918 | @param EndBit The ordinal of the most significant bit in the bit field.\r |
d5979dc0 | 919 | Range 0..31.\r |
920 | @param AndData The value to AND with the PCI configuration register.\r | |
fb3df220 | 921 | \r |
d5979dc0 | 922 | @return The value written back to the PCI configuration register.\r |
fb3df220 | 923 | \r |
924 | **/\r | |
925 | UINT32\r | |
926 | EFIAPI\r | |
927 | PciSegmentBitFieldAnd32 (\r | |
928 | IN UINT64 Address,\r | |
929 | IN UINTN StartBit,\r | |
930 | IN UINTN EndBit,\r | |
931 | IN UINT32 AndData\r | |
ed66e1bc | 932 | );\r |
fb3df220 | 933 | \r |
934 | /**\r | |
d5979dc0 | 935 | Reads a bit field in a 32-bit port, performs a bitwise AND followed by a\r |
62991af2 | 936 | bitwise OR, and writes the result back to the bit field in the\r |
d5979dc0 | 937 | 32-bit port.\r |
938 | \r | |
939 | Reads the 32-bit PCI configuration register specified by Address, performs a\r | |
62991af2 | 940 | bitwise AND followed by a bitwise OR between the read result and\r |
d5979dc0 | 941 | the value specified by AndData, and writes the result to the 32-bit PCI\r |
942 | configuration register specified by Address. The value written to the PCI\r | |
943 | configuration register is returned. This function must guarantee that all PCI\r | |
944 | read and write operations are serialized. Extra left bits in both AndData and\r | |
945 | OrData are stripped.\r | |
946 | \r | |
fb3df220 | 947 | If any reserved bits in Address are set, then ASSERT().\r |
d5979dc0 | 948 | If StartBit is greater than 31, then ASSERT().\r |
949 | If EndBit is greater than 31, then ASSERT().\r | |
fb3df220 | 950 | If EndBit is less than StartBit, then ASSERT().\r |
94952554 LG |
951 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
952 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
fb3df220 | 953 | \r |
d5979dc0 | 954 | @param Address PCI configuration register to write.\r |
fb3df220 | 955 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
d5979dc0 | 956 | Range 0..31.\r |
fb3df220 | 957 | @param EndBit The ordinal of the most significant bit in the bit field.\r |
d5979dc0 | 958 | Range 0..31.\r |
959 | @param AndData The value to AND with the PCI configuration register.\r | |
960 | @param OrData The value to OR with the result of the AND operation.\r | |
fb3df220 | 961 | \r |
d5979dc0 | 962 | @return The value written back to the PCI configuration register.\r |
fb3df220 | 963 | \r |
964 | **/\r | |
965 | UINT32\r | |
966 | EFIAPI\r | |
967 | PciSegmentBitFieldAndThenOr32 (\r | |
968 | IN UINT64 Address,\r | |
969 | IN UINTN StartBit,\r | |
970 | IN UINTN EndBit,\r | |
971 | IN UINT32 AndData,\r | |
972 | IN UINT32 OrData\r | |
ed66e1bc | 973 | );\r |
fb3df220 | 974 | \r |
975 | /**\r | |
976 | Reads a range of PCI configuration registers into a caller supplied buffer.\r | |
977 | \r | |
d5979dc0 | 978 | Reads the range of PCI configuration registers specified by StartAddress and\r |
979 | Size into the buffer specified by Buffer. This function only allows the PCI\r | |
980 | configuration registers from a single PCI function to be read. Size is\r | |
981 | returned. When possible 32-bit PCI configuration read cycles are used to read\r | |
982 | from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit\r | |
983 | and 16-bit PCI configuration read cycles may be used at the beginning and the\r | |
984 | end of the range.\r | |
985 | \r | |
59ceeabe | 986 | If any reserved bits in StartAddress are set, then ASSERT().\r |
fb3df220 | 987 | If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().\r |
badcbfb2 | 988 | If Size > 0 and Buffer is NULL, then ASSERT().\r |
fb3df220 | 989 | \r |
d5979dc0 | 990 | @param StartAddress Starting address that encodes the PCI Segment, Bus, Device,\r |
991 | Function and Register.\r | |
fb3df220 | 992 | @param Size Size in bytes of the transfer.\r |
993 | @param Buffer Pointer to a buffer receiving the data read.\r | |
994 | \r | |
d5979dc0 | 995 | @return Size\r |
fb3df220 | 996 | \r |
997 | **/\r | |
998 | UINTN\r | |
999 | EFIAPI\r | |
1000 | PciSegmentReadBuffer (\r | |
1001 | IN UINT64 StartAddress,\r | |
1002 | IN UINTN Size,\r | |
1003 | OUT VOID *Buffer\r | |
ed66e1bc | 1004 | );\r |
fb3df220 | 1005 | \r |
1006 | /**\r | |
d5979dc0 | 1007 | Copies the data in a caller supplied buffer to a specified range of PCI\r |
1008 | configuration space.\r | |
1009 | \r | |
1010 | Writes the range of PCI configuration registers specified by StartAddress and\r | |
1011 | Size from the buffer specified by Buffer. This function only allows the PCI\r | |
1012 | configuration registers from a single PCI function to be written. Size is\r | |
1013 | returned. When possible 32-bit PCI configuration write cycles are used to\r | |
1014 | write from StartAdress to StartAddress + Size. Due to alignment restrictions,\r | |
1015 | 8-bit and 16-bit PCI configuration write cycles may be used at the beginning\r | |
1016 | and the end of the range.\r | |
1017 | \r | |
59ceeabe | 1018 | If any reserved bits in StartAddress are set, then ASSERT().\r |
fb3df220 | 1019 | If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().\r |
d5979dc0 | 1020 | If Size > 0 and Buffer is NULL, then ASSERT().\r |
fb3df220 | 1021 | \r |
d5979dc0 | 1022 | @param StartAddress Starting address that encodes the PCI Segment, Bus, Device,\r |
1023 | Function and Register.\r | |
fb3df220 | 1024 | @param Size Size in bytes of the transfer.\r |
1025 | @param Buffer Pointer to a buffer containing the data to write.\r | |
1026 | \r | |
badcbfb2 | 1027 | @return The parameter of Size.\r |
fb3df220 | 1028 | \r |
1029 | **/\r | |
1030 | UINTN\r | |
1031 | EFIAPI\r | |
1032 | PciSegmentWriteBuffer (\r | |
1033 | IN UINT64 StartAddress,\r | |
1034 | IN UINTN Size,\r | |
1035 | IN VOID *Buffer\r | |
ed66e1bc | 1036 | );\r |
fb3df220 | 1037 | \r |
1038 | #endif\r |