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