Home | History | Annotate | Download | only in ArmJunoDxe
      1 /** @file
      2 
      3   This file contains support for ACPI Tables that are generated at boot time.
      4 
      5   Copyright (c) 2015, ARM Ltd. All rights reserved.<BR>
      6 
      7   This program and the accompanying materials
      8   are licensed and made available under the terms and conditions of the BSD License
      9   which accompanies this distribution.  The full text of the license may be found at
     10   http://opensource.org/licenses/bsd-license.php
     11 
     12   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     13   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     14 
     15 **/
     16 
     17 #include "ArmPlatform.h"
     18 #include "ArmJunoDxeInternal.h"
     19 
     20 #include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
     21 
     22 /*
     23  * Memory Mapped Configuration Space Access Table (MCFG)
     24  */
     25 typedef struct {
     26   EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER                        Header;
     27   EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE Entry;
     28 } MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ACCESS_TABLE;
     29 
     30 MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ACCESS_TABLE mAcpiMcfgTable = {
     31     {
     32         ARM_ACPI_HEADER (
     33           EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
     34           MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ACCESS_TABLE,
     35           EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION
     36         ),
     37         0, // Reserved
     38     }, {
     39         FixedPcdGet32 (PcdPciConfigurationSpaceBaseAddress),
     40         0, // PciSegmentGroupNumber
     41         FixedPcdGet32 (PcdPciBusMin),
     42         FixedPcdGet32 (PcdPciBusMax),
     43         0 // Reserved;
     44     }
     45 };
     46 
     47 /**
     48  * Callback called when ACPI Protocol is installed
     49  */
     50 VOID
     51 AcpiPciNotificationEvent (
     52   IN  EFI_EVENT                Event,
     53   IN  VOID                     *Context
     54   )
     55 {
     56   EFI_STATUS                Status;
     57   EFI_ACPI_TABLE_PROTOCOL   *AcpiTableProtocol;
     58   UINTN                     AcpiTableKey;
     59 
     60   //
     61   // Ensure the ACPI protocol is installed
     62   //
     63   Status = gBS->LocateProtocol (
     64                   &gEfiAcpiTableProtocolGuid,
     65                   NULL,
     66                   (VOID**)&AcpiTableProtocol
     67                   );
     68   if (EFI_ERROR (Status)) {
     69     return;
     70   }
     71 
     72   //
     73   // Install MCFG Table
     74   //
     75   AcpiTableKey = 0;
     76   Status = AcpiTableProtocol->InstallAcpiTable (AcpiTableProtocol, &mAcpiMcfgTable, sizeof (mAcpiMcfgTable), &AcpiTableKey);
     77   ASSERT_EFI_ERROR (Status);
     78 }
     79