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