]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Library/BasePciCapLib/BasePciCapLib.h
e631745834d9cafc2904e905d537aa8e46268aac
[mirror_edk2.git] / OvmfPkg / Library / BasePciCapLib / BasePciCapLib.h
1 /** @file
2 Work with PCI capabilities in PCI config space -- internal type definitions.
3
4 Copyright (C) 2018, Red Hat, Inc.
5
6 This program and the accompanying materials are licensed and made available
7 under the terms and conditions of the BSD License which accompanies this
8 distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
12 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 **/
14
15 #ifndef __BASE_PCI_CAP_LIB_H__
16 #define __BASE_PCI_CAP_LIB_H__
17
18 #include <Library/OrderedCollectionLib.h>
19
20 #include <Library/PciCapLib.h>
21
22 //
23 // Structure that uniquely identifies a capability instance and serves as key
24 // for insertion and lookup.
25 //
26 typedef struct {
27 PCI_CAP_DOMAIN Domain;
28 UINT16 CapId;
29 UINT16 Instance;
30 } PCI_CAP_KEY;
31
32 //
33 // In Instance==0 PCI_CAP objects, store NumInstances directly. In Instance>0
34 // PCI_CAP objects, link Instance#0 of the same (Domain, CapId). This way
35 // NumInstances needs maintenance in one object only, per (Domain, CapId) pair.
36 //
37 typedef union {
38 UINT16 NumInstances;
39 PCI_CAP *InstanceZero;
40 } PCI_CAP_NUM_INSTANCES;
41
42 //
43 // Complete the incomplete PCI_CAP structure here.
44 //
45 struct PCI_CAP {
46 PCI_CAP_KEY Key;
47 PCI_CAP_NUM_INSTANCES NumInstancesUnion;
48 UINT16 Offset;
49 UINT16 MaxSizeHint;
50 UINT8 Version;
51 };
52
53 //
54 // Complete the incomplete PCI_CAP_LIST structure here.
55 //
56 struct PCI_CAP_LIST {
57 ORDERED_COLLECTION *Capabilities;
58 };
59
60 #endif // __BASE_PCI_CAP_LIB_H__