a9102619 |
1 | /** @file\r |
2 | PCI Incompatible device support Libary.\r |
3 | \r |
4 | Copyright (c) 2007 Intel Corporation. All rights reserved. <BR>\r |
5 | This software and associated documentation (if any) is furnished\r |
6 | under a license and may only be used or copied in accordance\r |
7 | with the terms of the license. Except as permitted by such\r |
8 | license, no part of this software or documentation may be\r |
9 | reproduced, stored in a retrieval system, or transmitted in any\r |
10 | form or by any means without the express written consent of\r |
11 | Intel Corporation.\r |
12 | \r |
13 | **/\r |
14 | \r |
15 | #define PCI_REGISTER_READ 0xfffffffffffffff1ULL\r |
16 | #define PCI_REGISTER_WRITE 0xfffffffffffffff2ULL\r |
17 | #define VALUE_NOCARE 0xffffffffffffffffULL\r |
18 | \r |
19 | //\r |
20 | // PCI device device information\r |
21 | //\r |
22 | typedef struct {\r |
23 | UINT64 VendorID;\r |
24 | UINT64 DeviceID;\r |
25 | UINT64 RevisionID;\r |
26 | UINT64 SubsystemVendorID;\r |
27 | UINT64 SubsystemID;\r |
28 | } EFI_PCI_DEVICE_INFO;\r |
29 | \r |
30 | \r |
31 | //\r |
32 | // store hardcode value of resgister\r |
33 | //\r |
34 | typedef struct {\r |
35 | UINT64 AndValue;\r |
36 | UINT64 OrValue;\r |
37 | } EFI_PCI_REGISTER_VALUE_DATA;\r |
38 | \r |
39 | //\r |
40 | // store access width information\r |
41 | //\r |
42 | typedef struct {\r |
43 | UINT64 StartOffset;\r |
44 | UINT64 EndOffset;\r |
45 | UINT64 Width;\r |
46 | } EFI_PCI_REGISTER_ACCESS_DATA;\r |
47 | \r |
48 | \r |
49 | //\r |
50 | // ACPI resource descriptor\r |
51 | //\r |
52 | typedef struct {\r |
53 | UINT64 ResType;\r |
54 | UINT64 GenFlag;\r |
55 | UINT64 SpecificFlag;\r |
56 | UINT64 AddrSpaceGranularity;\r |
57 | UINT64 AddrRangeMin;\r |
58 | UINT64 AddrRangeMax;\r |
59 | UINT64 AddrTranslationOffset;\r |
60 | UINT64 AddrLen;\r |
61 | } EFI_PCI_RESOUCE_DESCRIPTOR;\r |
62 | \r |
63 | /**\r |
64 | Checks the incompatible device list for ACPI resource update and return\r |
65 | the configuration.\r |
66 | \r |
67 | This function searches the incompatible device list according to request\r |
68 | information. If the PCI device belongs to the devices list, corresponding\r |
69 | configuration informtion will be returned, in the meantime return EFI_SUCCESS.\r |
70 | \r |
71 | @param PciDeviceInfo A pointer to PCI device information.\r |
72 | @param Configuration Returned information.\r |
73 | \r |
74 | @retval returns EFI_SUCCESS if check incompatible device ok.\r |
75 | Otherwise return EFI_UNSUPPORTED.\r |
76 | **/\r |
77 | RETURN_STATUS\r |
78 | EFIAPI\r |
79 | PciResourceUpdateCheck (\r |
80 | IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,\r |
81 | OUT VOID *Configuration\r |
82 | );\r |
83 | \r |
84 | /**\r |
85 | Checks the incompatible device list and return configuration register mask values.\r |
86 | \r |
87 | This function searches the incompatible device list according to request\r |
88 | information. If the PCI device belongs to the devices list, corresponding\r |
89 | configuration informtion will be returned, in the meantime return EFI_SUCCESS.\r |
90 | \r |
91 | @param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.\r |
92 | @param AccessType Access Type, READ or WRITE.\r |
93 | @param Offset The address within the PCI configuration space.\r |
94 | @param Configuration Returned information.\r |
95 | \r |
96 | @retval returns EFI_SUCCESS if check incompatible device ok.\r |
97 | Otherwise return EFI_UNSUPPORTED.\r |
98 | **/\r |
99 | RETURN_STATUS\r |
100 | EFIAPI\r |
101 | PciRegisterUpdateCheck (\r |
102 | IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,\r |
103 | IN UINT64 AccessType,\r |
104 | IN UINT64 Offset,\r |
105 | OUT VOID *Configuration\r |
106 | );\r |
107 | \r |
108 | /**\r |
109 | Checks the incompatible device list for access width incompatibility and\r |
110 | return the configuration\r |
111 | \r |
112 | This function searches the incompatible device list for access width\r |
113 | incompatibility according to request information. If the PCI device\r |
114 | belongs to the devices list, corresponding configuration informtion\r |
115 | will be returned, in the meantime return EFI_SUCCESS.\r |
116 | \r |
117 | @param PciDeviceInfo A pointer to PCI device information.\r |
118 | @param AccessType Access type, READ or WRITE.\r |
119 | @param Offset The address within the PCI configuration space.\r |
120 | @param AccessWidth Access width needs to check incompatibility.\r |
121 | @param Configuration Returned information.\r |
122 | \r |
123 | @retval returns EFI_SUCCESS if check incompatible device ok.\r |
124 | Otherwise return EFI_UNSUPPORTED.\r |
125 | **/\r |
126 | RETURN_STATUS\r |
127 | EFIAPI\r |
128 | PciRegisterAccessCheck (\r |
129 | IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,\r |
130 | IN UINT64 AccessType,\r |
131 | IN UINT64 Offset,\r |
132 | IN UINT64 AccessWidth,\r |
133 | OUT VOID *Configuration\r |
134 | );\r |