From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by mx.groups.io with SMTP id smtpd.web12.3216.1604002884458481326 for ; Thu, 29 Oct 2020 13:21:24 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=NNlyId94; spf=pass (domain: linaro.org, ip: 209.85.222.194, mailfrom: shashi.mallela@linaro.org) Received: by mail-qk1-f194.google.com with SMTP id x20so3120616qkn.1 for ; Thu, 29 Oct 2020 13:21:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5nQkFRFad/7SyT5P+WzlMFkKVAbXVmsxJMMaZ5O/vcE=; b=NNlyId94R2VhsEEJftc0Vk57wiymZLXQ0tvHs7OFJ8IxflorJYOtFiX8ywolgY6cwP pV+jZecW6yWHYgTFxK4xqSRMZXNzWHsFL4SU//2MGzc94ZEC8Dj8UYrQ9PYaxmWiaXK2 jRp7A/tdDTuFAqMxjeywjyXIb2UMhRFgQz0fLe7q5gRyKeIdOJR9K9DmINGmApsDhXap EtjXHdjmtc0MA8mWfJeMgsMsZS3qxEfWxu9K2hqzypHiLgbFk1GCAYtKQXYq3bIRXzUM MQ8oJqO9sckUxfbbS8ts2S+AX8RR8BXmHIwKwRTGsJi17ol8BLR0CVa6unbXsSPUztc1 vYYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5nQkFRFad/7SyT5P+WzlMFkKVAbXVmsxJMMaZ5O/vcE=; b=SY5xVCU70WpZJmCgD0wtISgpxC4CEJm6E9cpQ8hVmYbWF+eAyIRwaCJuTdRCdL1dEJ t9BRd/E2nQW1JaEhO6wjMnahCN2Rg8Xz5INs9hemiiFB44SeOjprku22A7m1vD4Yg1C0 4TNtBsWQEBVMFgS5oxh2xv/MsQSfRt0XQDmMea4+r9LgT/253xttcuieez2VA02me4S9 M0iO0M6/5j1KezGQOuA4hE9kgb/pM4i8ykELD5fhowGwu1U3u1QfGxRx61ZE3sDzySHu RVKdig46tAlmrhkahrv7aay522U8WnH1Yv7Z0ohkppZae5e4i+IGnah4OPxMuu0u/+wE Y3Bg== X-Gm-Message-State: AOAM530Dzb+2P0FBNppc1uFABzT3xk8o6dmfoPJIM+OrMTVSmL9txCkJ 1fLJbjCG9i2Ai2nnWuVt++a5Gw== X-Google-Smtp-Source: ABdhPJysslj8WW67vFVSRHXq65KzzQjmfe9mUhm5NRaKgJFNSQPuw+2nRGb7YaoeldWtl9F42PzHwg== X-Received: by 2002:a37:5f42:: with SMTP id t63mr5856168qkb.449.1604002883631; Thu, 29 Oct 2020 13:21:23 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([142.114.143.244]) by smtp.googlemail.com with ESMTPSA id q3sm1667353qkf.24.2020.10.29.13.21.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 13:21:23 -0700 (PDT) From: "Shashi Mallela" To: leif@nuviainc.com, ard.biesheuvel@arm.com, graeme@nuviainc.com Cc: devel@edk2.groups.io Subject: [PATCH v3 1/1] Silicon/Qemu/Sbsa: Add SBSA-wdt entry to GTDT Date: Thu, 29 Oct 2020 16:21:21 -0400 Message-Id: <20201029202121.26710-2-shashi.mallela@linaro.org> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20201029202121.26710-1-shashi.mallela@linaro.org> References: <20201029202121.26710-1-shashi.mallela@linaro.org> SBSA generic watchdog timer structure entry has been added to GTDT table as per SBSAv6.0. This enables acpi detection of wdt in qemu sbsa platform Cc: Leif Lindholm Cc: Ard Biesheuvel Cc: Graeme Gregory Signed-off-by: Shashi Mallela --- Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc | 87 ++++++++++++++------ 1 file changed, 62 insertions(+), 25 deletions(-) diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc b/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc index d16778e01a5c..1713c203766e 100644 --- a/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc +++ b/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc @@ -24,42 +24,79 @@ #define SYSTEM_TIMER_BASE_ADDRESS 0xFFFFFFFFFFFFFFFF #endif -#define GTDT_TIMER_EDGE_TRIGGERED EFI_ACPI_5_0_GTDT_TIMER_FLAG_TIMER_INTERRUPT_MODE +#define GTDT_TIMER_EDGE_TRIGGERED EFI_ACPI_6_3_GTDT_TIMER_FLAG_TIMER_INTERRUPT_MODE #define GTDT_TIMER_LEVEL_TRIGGERED 0 -#define GTDT_TIMER_ACTIVE_LOW EFI_ACPI_5_0_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY +#define GTDT_TIMER_ACTIVE_LOW EFI_ACPI_6_3_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY #define GTDT_TIMER_ACTIVE_HIGH 0 #define GTDT_GTIMER_FLAGS (GTDT_TIMER_ACTIVE_LOW | GTDT_TIMER_LEVEL_TRIGGERED) +#define SBSA_PLATFORM_WATCHDOG_COUNT 1 +#define SBSA_PLATFORM_TIMER_COUNT (SBSA_PLATFORM_WATCHDOG_COUNT) + +#define SBSAQEMU_WDT_REFRESH_FRAME_BASE 0x50010000 +#define SBSAQEMU_WDT_CONTROL_FRAME_BASE 0x50011000 +#define SBSAQEMU_WDT_IRQ 44 + +#define GTDT_WDTIMER_EDGE_TRIGGERED EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_FLAG_TIMER_INTERRUPT_MODE +#define GTDT_WDTIMER_LEVEL_TRIGGERED 0 +#define GTDT_WDTIMER_ACTIVE_LOW EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_FLAG_TIMER_INTERRUPT_POLARITY +#define GTDT_WDTIMER_ACTIVE_HIGH 0 + +#define GTDT_WDTIMER_FLAGS (GTDT_WDTIMER_ACTIVE_HIGH | GTDT_WDTIMER_LEVEL_TRIGGERED) + +#define EFI_ACPI_6_3_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT( \ + RefreshFramePhysicalAddress, ControlFramePhysicalAddress, \ + WatchdogTimerGSIV, WatchdogTimerFlags) \ + { \ + EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG, \ + sizeof(EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE), \ + EFI_ACPI_RESERVED_WORD, \ + RefreshFramePhysicalAddress, \ + ControlFramePhysicalAddress, \ + WatchdogTimerGSIV, \ + WatchdogTimerFlags \ + } + #pragma pack (1) typedef struct { - EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt; - } GENERIC_TIMER_DESCRIPTION_TABLE; + EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt; + EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE Gwdt; + } GENERIC_TIMER_DESCRIPTION_TABLES; #pragma pack () - GENERIC_TIMER_DESCRIPTION_TABLE Gtdt = { - { - SBSAQEMU_ACPI_HEADER( - EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, - GENERIC_TIMER_DESCRIPTION_TABLE, - EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION - ), - SYSTEM_TIMER_BASE_ADDRESS, // UINT64 PhysicalAddress - 0, // UINT32 Reserved - FixedPcdGet32 (PcdArmArchTimerSecIntrNum), // UINT32 SecurePL1TimerGSIV - GTDT_GTIMER_FLAGS, // UINT32 SecurePL1TimerFlags - FixedPcdGet32 (PcdArmArchTimerIntrNum), // UINT32 NonSecurePL1TimerGSIV - GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL1TimerFlags - FixedPcdGet32 (PcdArmArchTimerVirtIntrNum), // UINT32 VirtualTimerGSIV - GTDT_GTIMER_FLAGS, // UINT32 VirtualTimerFlags - FixedPcdGet32 (PcdArmArchTimerHypIntrNum), // UINT32 NonSecurePL2TimerGSIV - GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL2TimerFlags - 0xFFFFFFFFFFFFFFFF, // UINT64 CntReadBasePhysicalAddress - 0, // UINT32 PlatformTimerCount - 0 - }, + GENERIC_TIMER_DESCRIPTION_TABLES Gtdt = { + { + SBSAQEMU_ACPI_HEADER( + EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, + GENERIC_TIMER_DESCRIPTION_TABLES, + EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION + ), + SYSTEM_TIMER_BASE_ADDRESS, // UINT64 PhysicalAddress + 0, // UINT32 Reserved + FixedPcdGet32 (PcdArmArchTimerSecIntrNum), // UINT32 SecurePL1TimerGSIV + GTDT_GTIMER_FLAGS, // UINT32 SecurePL1TimerFlags + FixedPcdGet32 (PcdArmArchTimerIntrNum), // UINT32 NonSecurePL1TimerGSIV + GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL1TimerFlags + FixedPcdGet32 (PcdArmArchTimerVirtIntrNum), // UINT32 VirtualTimerGSIV + GTDT_GTIMER_FLAGS, // UINT32 VirtualTimerFlags + FixedPcdGet32 (PcdArmArchTimerHypIntrNum), // UINT32 NonSecurePL2TimerGSIV + GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL2TimerFlags + 0xFFFFFFFFFFFFFFFF, // UINT64 CntReadBasePhysicalAddress + SBSA_PLATFORM_TIMER_COUNT, // UINT32 PlatformTimerCount + sizeof(EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE), + // UINT32 PlatformTimerOffset + 0, // UINT32 VirtualPL2TimerGSIV + 0 // UINT32 VirtualPL2TimerFlags + }, + EFI_ACPI_6_3_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT( + SBSAQEMU_WDT_REFRESH_FRAME_BASE, + SBSAQEMU_WDT_CONTROL_FRAME_BASE, + SBSAQEMU_WDT_IRQ, + GTDT_WDTIMER_FLAGS + ) }; // Reference the table being generated to prevent the optimizer from removing the -- 2.18.4