From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: ankit.sinha@intel.com) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by groups.io with SMTP; Wed, 04 Sep 2019 15:18:23 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Sep 2019 15:18:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,468,1559545200"; d="scan'208";a="334354855" Received: from ankitsin-desk1.amr.corp.intel.com ([10.7.159.71]) by orsmga004.jf.intel.com with ESMTP; 04 Sep 2019 15:18:23 -0700 From: "Sinha, Ankit" To: devel@edk2.groups.io Cc: Michael Kubacki , Chasel Chiu , Nate DeSimone , Liming Gao Subject: [edk2-platforms] [PATCH v3 1/1] MinPlatformPkg/Acpi: MADT NMI default flag set to Edge-Triggered Date: Wed, 4 Sep 2019 15:18:22 -0700 Message-Id: <20190904221822.30820-1-ankit.sinha@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 1. Default APIC NMI structure in MADT changed to expose Level-Triggered interrupts. 2. x2APIC NMI structure won't be exposed to OS if x2APIC is not enabled. Cc: Michael Kubacki Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Signed-off-by: Ankit Sinha --- Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 54 ++++++++++---------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c index 5eb727929bfb..1b251ca2962d 100644 --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c @@ -1,7 +1,7 @@ /** @file ACPI Platform Driver -Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -1049,7 +1049,7 @@ InstallMadtFromScratch ( LocalApciNmiStruct.Type = EFI_ACPI_4_0_LOCAL_APIC_NMI; LocalApciNmiStruct.Length = sizeof (EFI_ACPI_4_0_LOCAL_APIC_NMI_STRUCTURE); LocalApciNmiStruct.AcpiProcessorId = 0xFF; // Applies to all processors - LocalApciNmiStruct.Flags = 0x000D; // Flags - Level-tiggered, Active High + LocalApciNmiStruct.Flags = 0x0005; // Flags - Edge-tiggered, Active High LocalApciNmiStruct.LocalApicLint = 0x1; ASSERT (MadtStructsIndex < MaxMadtStructCount); @@ -1066,24 +1066,26 @@ InstallMadtFromScratch ( // // Build Local x2APIC NMI Structure // - LocalX2ApicNmiStruct.Type = EFI_ACPI_4_0_LOCAL_X2APIC_NMI; - LocalX2ApicNmiStruct.Length = sizeof (EFI_ACPI_4_0_LOCAL_X2APIC_NMI_STRUCTURE); - LocalX2ApicNmiStruct.Flags = 0x000D; // Flags - Level-tiggered, Active High - LocalX2ApicNmiStruct.AcpiProcessorUid = 0xFFFFFFFF; // Applies to all processors - LocalX2ApicNmiStruct.LocalX2ApicLint = 0x01; - LocalX2ApicNmiStruct.Reserved[0] = 0x00; - LocalX2ApicNmiStruct.Reserved[1] = 0x00; - LocalX2ApicNmiStruct.Reserved[2] = 0x00; + if (mX2ApicEnabled) { + LocalX2ApicNmiStruct.Type = EFI_ACPI_4_0_LOCAL_X2APIC_NMI; + LocalX2ApicNmiStruct.Length = sizeof (EFI_ACPI_4_0_LOCAL_X2APIC_NMI_STRUCTURE); + LocalX2ApicNmiStruct.Flags = 0x000D; // Flags - Level-tiggered, Active High + LocalX2ApicNmiStruct.AcpiProcessorUid = 0xFFFFFFFF; // Applies to all processors + LocalX2ApicNmiStruct.LocalX2ApicLint = 0x01; + LocalX2ApicNmiStruct.Reserved[0] = 0x00; + LocalX2ApicNmiStruct.Reserved[1] = 0x00; + LocalX2ApicNmiStruct.Reserved[2] = 0x00; - ASSERT (MadtStructsIndex < MaxMadtStructCount); - Status = CopyStructure ( - &MadtTableHeader.Header, - (STRUCTURE_HEADER *) &LocalX2ApicNmiStruct, - &MadtStructs[MadtStructsIndex++] - ); - if (EFI_ERROR (Status)) { - DEBUG ((EFI_D_ERROR, "CopyMadtStructure (x2APIC NMI) failed: %r\n", Status)); - goto Done; + ASSERT (MadtStructsIndex < MaxMadtStructCount); + Status = CopyStructure ( + &MadtTableHeader.Header, + (STRUCTURE_HEADER *) &LocalX2ApicNmiStruct, + &MadtStructs[MadtStructsIndex++] + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "CopyMadtStructure (x2APIC NMI) failed: %r\n", Status)); + goto Done; + } } // @@ -1167,7 +1169,7 @@ InstallMcfgFromScratch ( // // Set MCFG table "Length" field based on the number of PCIe segments enumerated so far // - McfgTable->Header.Length = (UINT32)(sizeof (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER) + + McfgTable->Header.Length = (UINT32)(sizeof (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER) + sizeof (EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE) * SegmentCount); Segment = (VOID *)(McfgTable + 1); @@ -1329,11 +1331,11 @@ PlatformUpdateTables ( HpetCapabilities.Uint64 = HpetCapabilitiesData; HpetCapabilitiesData = MmioRead32 (HpetBaseAddress + HPET_GENERAL_CAPABILITIES_ID_OFFSET + 4); HpetCapabilities.Uint64 |= LShiftU64 (HpetCapabilitiesData, 32); - HpetBlockId.Bits.Revision = HpetCapabilities.Bits.Revision; - HpetBlockId.Bits.NumberOfTimers = HpetCapabilities.Bits.NumberOfTimers; - HpetBlockId.Bits.CounterSize = HpetCapabilities.Bits.CounterSize; - HpetBlockId.Bits.Reserved = 0; - HpetBlockId.Bits.LegacyRoute = HpetCapabilities.Bits.LegacyRoute; + HpetBlockId.Bits.Revision = HpetCapabilities.Bits.Revision; + HpetBlockId.Bits.NumberOfTimers = HpetCapabilities.Bits.NumberOfTimers; + HpetBlockId.Bits.CounterSize = HpetCapabilities.Bits.CounterSize; + HpetBlockId.Bits.Reserved = 0; + HpetBlockId.Bits.LegacyRoute = HpetCapabilities.Bits.LegacyRoute; HpetBlockId.Bits.VendorId = HpetCapabilities.Bits.VendorId; HpetTable->EventTimerBlockId = HpetBlockId.Uint32; HpetTable->MainCounterMinimumClockTickInPeriodicMode = (UINT16)HpetCapabilities.Bits.CounterClockPeriod; @@ -1459,7 +1461,7 @@ UpdateLocalTable ( for (Index = 0; Index < sizeof(mLocalTable)/sizeof(mLocalTable[0]); Index++) { CurrentTable = mLocalTable[Index]; - + PlatformUpdateTables (CurrentTable, &Version); TableHandle = 0; -- 2.16.2.windows.1