hc
2024-03-25 edb30157bad0c0001c32b854271ace01d3b9a16a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/** @file
 
Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
 
**/
 
#ifndef __PCIE_MMCFG_H__
#define __PCIE_MMCFG_H__
 
#include <UsraAccessType.h>
 
 
//////////////////////////////////////////////////////////////////////////
//
// PCIE MMCFG Table definition
// This table was based on PCI Firmware Spec Rev 3.1
//
//////////////////////////////////////////////////////////////////////////
 
typedef struct
  {
    UINT8                         Signature[4];       // "MCFG" Signature For this Table
    UINT32                        Length;             // Length, in bytes, include base address allocation structures.
    UINT8                         Revision;           // "1"
    UINT8                         SegMax;             // The Maximum number of Segments
    UINT16                        ValidSegMap;        // Valid Segment Bit Map, LSB Bit0 for Seg0, bit1 for seg1 ...
    UINT8                         Reserved[4];        // Reserved
} PCIE_MMCFG_HEADER_TYPE;
 
typedef struct
  {
    UINT32                        BaseAddressL;       // Processor-relative Base Address (Lower 32-bit) for the Enhanced Configuration Access Mechanism
    UINT32                        BaseAddressH;       // Processor-relative Base Address (Upper 32-bit) for the Enhanced Configuration Access Mechanism
    UINT16                        Segment;            // PCI Segment Group Number. Default is 0.
    UINT8                         StartBus;           // Start PCI Bus number decoded by the host bridge
    UINT8                         EndBus;             // End PCI Bus number decoded by the host bridge
    UINT8                         Reserved[4];        // Reserved
} PCIE_MMCFG_BASE_ADDRESS_TYPE;
 
 
typedef struct
  {
    PCIE_MMCFG_HEADER_TYPE        Header;             // The header of MMCFG Table
    PCIE_MMCFG_BASE_ADDRESS_TYPE  MmcfgBase[1];       // First Array of base address allocation structures.
} PCIE_MMCFG_TABLE_TYPE;
 
 
/**
  This Lib is used for platform to set platform specific Pcie MMCFG Table
 
  @param[in] MmcfgTable           A pointer of the MMCFG Table structure for PCIE_MMCFG_TABLE_TYPE type
  @param[in] NumOfSeg             Number of Segments in the table
 
  @retval <>NULL                  The function completed successfully.
  @retval NULL                    Return Error
**/
UINTN
EFIAPI
SetPcieSegMmcfgTable (
  IN PCIE_MMCFG_TABLE_TYPE *MmcfgTable,
  IN UINT32                 NumOfSeg
);
 
/**
  This Lib return PCIE MMCFG Base Address
 
  @param[in] Address              A pointer of the address of the USRA Address Structure for PCIE type
 
  @retval <>NULL                  The function completed successfully.
  @retval NULL                    Return Error
**/
UINTN
EFIAPI
GetPcieSegMmcfgBaseAddress (
  IN USRA_ADDRESS    *Address
  );
 
 
#endif