4 Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 - PCI Firmware Specification - Revision 3.2, January 26, 2015.
17 #include <IndustryStandard/Acpi.h>
18 #include <Library/UefiLib.h>
19 #include "AcpiParser.h"
20 #include "AcpiTableParser.h"
23 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo
;
26 An ACPI_PARSER array describing the ACPI MCFG Table.
28 STATIC CONST ACPI_PARSER McfgParser
[] = {
29 PARSE_ACPI_HEADER (&AcpiHdrInfo
),
30 {L
"Reserved", 8, 36, L
"0x%lx", NULL
, NULL
, NULL
, NULL
},
34 An ACPI_PARSER array describing the PCI configuration Space Base Address structure.
36 STATIC CONST ACPI_PARSER PciCfgSpaceBaseAddrParser
[] = {
37 {L
"Base Address", 8, 0, L
"0x%lx", NULL
, NULL
, NULL
, NULL
},
38 {L
"PCI Segment Group No.", 2, 8, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
39 {L
"Start Bus No.", 1, 10, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
40 {L
"End Bus No.", 1, 11, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
41 {L
"Reserved", 4, 12, L
"0x%x", NULL
, NULL
, NULL
, NULL
}
45 This function parses the ACPI MCFG table.
46 When trace is enabled this function parses the MCFG table and
47 traces the ACPI table fields.
49 This function also performs validation of the ACPI table fields.
51 @param [in] Trace If TRUE, trace the ACPI fields.
52 @param [in] Ptr Pointer to the start of the buffer.
53 @param [in] AcpiTableLength Length of the ACPI table.
54 @param [in] AcpiTableRevision Revision of the ACPI table.
61 IN UINT32 AcpiTableLength
,
62 IN UINT8 AcpiTableRevision
67 UINT8
* PciCfgSpacePtr
;
79 PARSER_PARAMS (McfgParser
)
82 PciCfgSpacePtr
= Ptr
+ Offset
;
84 while (Offset
< AcpiTableLength
) {
85 PciCfgOffset
= ParseAcpi (
88 "PCI Configuration Space",
90 (AcpiTableLength
- Offset
),
91 PARSER_PARAMS (PciCfgSpaceBaseAddrParser
)
93 PciCfgSpacePtr
+= PciCfgOffset
;
94 Offset
+= PciCfgOffset
;