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