Ejemplo n.º 1
0
/**
 * Set Engine to be allocated.
 *
 *
 * @param[in]  DescriptorIndex    UINT8 index
 * @param[in]  Engine             Pointer to engine config
 */
VOID
PcieAllocateEngine (
    IN      UINT8                       DescriptorIndex,
    IN      PCIe_ENGINE_CONFIG          *Engine
)
{
    PcieConfigSetDescriptorFlags (Engine, DESCRIPTOR_ALLOCATED);
    Engine->Scratch = DescriptorIndex;
}
Ejemplo n.º 2
0
AGESA_STATUS
PcieConfigurationInit (
  IN       AMD_CONFIG_PARAMS               *StdHeader
  )
{

  AGESA_STATUS          Status;
  PCIe_PLATFORM_CONFIG  *Pcie;
  PCIe_SILICON_CONFIG   *Silicon;
  UINT8                 SocketId;
  UINTN                 CurrentComplexesDataLength;
  UINTN                 ComplexesDataLength;
  UINT8                 ComplexIndex;
  VOID                  *Buffer;
  ComplexesDataLength = 0;
  Status = AGESA_SUCCESS;
  IDS_HDT_CONSOLE (GNB_TRACE, "PcieConfigurationInit Enter\n");
  for (SocketId = 0; SocketId < GetPlatformNumberOfSockets (); SocketId++) {
    if (IsProcessorPresent (SocketId, StdHeader)) {
      Status = PcieFmGetComplexDataLength (SocketId, &CurrentComplexesDataLength, StdHeader);
      ASSERT (Status == AGESA_SUCCESS);
      ComplexesDataLength += CurrentComplexesDataLength;
    }
  }
  ComplexIndex = 0;
  Pcie = GnbAllocateHeapBufferAndClear (AMD_PCIE_COMPLEX_DATA_HANDLE, sizeof (PCIe_PLATFORM_CONFIG) + ComplexesDataLength, StdHeader);
  ASSERT (Pcie != NULL);
  if (Pcie != NULL) {
    PcieConfigAttachChild (&Pcie->Header, &Pcie->ComplexList[ComplexIndex].Header);
    PcieConfigSetDescriptorFlags (Pcie, DESCRIPTOR_PLATFORM | DESCRIPTOR_TERMINATE_LIST | DESCRIPTOR_TERMINATE_TOPOLOGY);
    Buffer = (UINT8 *) (Pcie) + sizeof (PCIe_PLATFORM_CONFIG);
    for (SocketId = 0; SocketId < GetPlatformNumberOfSockets (); SocketId++) {
      if (IsProcessorPresent (SocketId, StdHeader)) {
        Pcie->ComplexList[ComplexIndex].SocketId = SocketId;
        //Attache Comples to Silicon which will be created by PcieFmBuildComplexConfiguration
        PcieConfigAttachChild (&Pcie->ComplexList[ComplexIndex].Header, &((PCIe_SILICON_CONFIG *) Buffer)->Header);
        //Attach Comples to Pcie
        PcieConfigAttachParent (&Pcie->Header, &Pcie->ComplexList[ComplexIndex].Header);
        PcieConfigSetDescriptorFlags (&Pcie->ComplexList[ComplexIndex], DESCRIPTOR_COMPLEX | DESCRIPTOR_TERMINATE_LIST | DESCRIPTOR_TERMINATE_GNB | DESCRIPTOR_TERMINATE_TOPOLOGY);
        PcieFmBuildComplexConfiguration (SocketId, Buffer, StdHeader);
        Silicon = PcieConfigGetChildSilicon (&Pcie->ComplexList[ComplexIndex]);
        while (Silicon != NULL) {
          PcieConfigAttachParent (&Pcie->ComplexList[ComplexIndex].Header, &Silicon->Header);
          GetNodeId (SocketId, Silicon->SiliconId, &Silicon->NodeId, StdHeader);
          GnbFmGetLinkId ((GNB_HANDLE*) Silicon, &Silicon->LinkId, StdHeader);
          Silicon = (PCIe_SILICON_CONFIG *) PcieConfigGetNextTopologyDescriptor (Silicon, DESCRIPTOR_TERMINATE_TOPOLOGY);
        }

        if (ComplexIndex > 0) {
          PcieConfigAttachComplexes (&Pcie->ComplexList[ComplexIndex - 1], &Pcie->ComplexList[ComplexIndex]);
        }
        PcieFmGetComplexDataLength (SocketId, &CurrentComplexesDataLength, StdHeader);
        Buffer = (VOID *) ((UINT8 *) Buffer + CurrentComplexesDataLength);
        ComplexIndex++;
      }
    }
  } else {
    Status = AGESA_FATAL;
  }
  IDS_HDT_CONSOLE (GNB_TRACE, "PcieConfigurationInit Exit [0x%x]\n", Status);
  return Status;
}