From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by mx.groups.io with SMTP id smtpd.web10.12440.1582886370482385115 for ; Fri, 28 Feb 2020 02:39:30 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=yL8KoKPn; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.221.65, mailfrom: pete@akeo.ie) Received: by mail-wr1-f65.google.com with SMTP id v2so2320180wrp.12 for ; Fri, 28 Feb 2020 02:39:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fLwPNZy9xReNEjjDQgYQQO4VnZpq3V6ENgg8koGKlj8=; b=yL8KoKPn6TUvpEaQe2wVtX7v63/88Ef3jjyVnR0S1R5dZdmwjaXs5CrUz05PhtqE6w WI0OU66LsxBMcBEaysTED3wGGQUD5Zo7e0xCrnnqUxdP+QIcUTgv1GnA9PZKjDrRdSLZ WlERfu+fTVy0cTwd222H8kd8A1K/HRUxDG8bqrfW9iBPk2hDqIdjOiyhbzsya0wKrW/Y C5T4yppLOBOFg2K3XMbX+IkP66oeJ2JuC1DATahEBLZpNLsmrHCRq8gDBOGZp/3qQ923 3FDIOaSPfWLO/8MdmrBHj3xASDwVFM7MCETZUuLiDAo7gdxz2IDcpm9FxFFBILTsmUOK 4fgw== 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:mime-version:content-transfer-encoding; bh=fLwPNZy9xReNEjjDQgYQQO4VnZpq3V6ENgg8koGKlj8=; b=l/pimasitClJR62ex6+jZ1ssMbFR9lm4CcDYgyHb/vjUbID5OyCp8bBu3Z2XjnMcAP ha/+tTFkDX7PiSHWfArk6DZMxmVV3MXrT4G1gq4QG3axTs+vWCU579L0q3VI9jkC5tfu l200fZtEpdqcuFJ838ZUG4GZlbi3GI+oNlCM4usgOJOqc5HQMCHfpCSaRxbjrMDnPV7l ycvAWL7eEXg9e5cZd3ayOkQkv1GCqsxYMOOrO1+UOd6aTYk3o/3g+C0o/mtipAbJmfvP OD79aamyXndM+rKJIrqRc5aisZDoXumGKHQRj7xEHCJIy6ax3FLjTI1MQOzK2dMceFzl uKlQ== X-Gm-Message-State: APjAAAWiC2549Cylik2jbSwmnuTD5c1gLzqfeKlbjxoTgE0aOQB0HTND sAt2WlYbjtbofeEGJdJK718KU//+urY= X-Google-Smtp-Source: APXvYqz9oDMaCWy5g54iWyI6i/qGZlTWvWvD2sdWe5kDDZBok/IzoiF5TFwvZrDaePCQS2zWOS7ftw== X-Received: by 2002:adf:de12:: with SMTP id b18mr4196143wrm.268.1582886368039; Fri, 28 Feb 2020 02:39:28 -0800 (PST) Return-Path: Received: from localhost.localdomain ([84.203.56.244]) by smtp.gmail.com with ESMTPSA id s8sm12341061wrt.57.2020.02.28.02.39.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Feb 2020 02:39:27 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif@nuviainc.com, philmd@redhat.com Subject: [edk2-platforms][PATCH 13/15] Platform/RPi4: Prepare ACPI code for factorization Date: Fri, 28 Feb 2020 10:38:53 +0000 Message-Id: <20200228103855.11352-14-pete@akeo.ie> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20200228103855.11352-1-pete@akeo.ie> References: <20200228103855.11352-1-pete@akeo.ie> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit * Update the OEM IDs and base revision numbers. * Move RPI_SYSTEM_TIMER_BASE_ADDRESS to AcpiTables.h. * Add RPi3 constants and conditional blocks according to model. Signed-off-by: Pete Batard --- Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h | 48 +++++++++++++++++--- Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl | 4 ++ Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc | 1 - Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc | 15 ++++++ 4 files changed, 61 insertions(+), 7 deletions(-) diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h index 3d1737aed41a..0b8a8494450c 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h +++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h @@ -1,7 +1,8 @@ /** @file * - * RPi4 defines for constructing ACPI tables + * RPi defines for constructing ACPI tables * + * Copyright (c) 2020, Pete Batard * Copyright (c) 2019, ARM Ltd. All rights reserved. * Copyright (c) 2018, Andrei Warkentin * Copyright (c) Microsoft Corporation. All rights reserved. @@ -23,11 +24,15 @@ CreateDwordField (^BufName, ^MemName._BAS, VarName) \ Add (BCM2836_SOC_REGISTERS, Offset, VarName) -#define EFI_ACPI_OEM_ID {'M','C','R','S','F','T'} // OEMID 6 bytes long -#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64 ('R','P','I','4','E','D','K','2') // OEM table id 8 bytes long -#define EFI_ACPI_OEM_REVISION 0x02000820 -#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('R','P','I','4') -#define EFI_ACPI_CREATOR_REVISION 0x00000097 +#if (RPI_MODEL == 3) +#define EFI_ACPI_OEM_ID {'B','C','2','8','3','6'} +#else +#define EFI_ACPI_OEM_ID {'M','C','R','S','F','T'} +#endif +#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64 ('R','P','I','_','E','D','K','2') +#define EFI_ACPI_OEM_REVISION 0x00000100 +#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('E','D','K','2') +#define EFI_ACPI_CREATOR_REVISION 0x00000100 #define EFI_ACPI_VENDOR_ID SIGNATURE_32 ('M','S','F','T') @@ -52,6 +57,12 @@ #define RPI_DMA_CHANNEL_COUNT 10 // All 10 DMA channels are listed, including the reserved ones #define RPI_DMA_USED_CHANNEL_COUNT 5 // Use 5 DMA channels +#if (RPI_MODEL == 3) +#define RPI_SYSTEM_TIMER_BASE_ADDRESS 0x4000001C +#elif (RPI_MODEL == 4) +#define RPI_SYSTEM_TIMER_BASE_ADDRESS 0xFF80001C +#endif + #define EFI_ACPI_5_1_CSRT_REVISION 0x00000000 typedef enum @@ -100,6 +111,30 @@ typedef struct //------------------------------------------------------------------------ // Interrupts. These are specific to each platform //------------------------------------------------------------------------ +#if (RPI_MODEL == 3) +#define BCM2836_V3D_BUS_INTERRUPT 0x2A +#define BCM2836_DMA_INTERRUPT 0x3B +#define BCM2836_SPI1_INTERRUPT 0x3D +#define BCM2836_SPI2_INTERRUPT 0x3D +#define BCM2836_HVS_INTERRUPT 0x41 +#define BCM2836_HDMI0_INTERRUPT 0x48 +#define BCM2836_HDMI1_INTERRUPT 0x49 +#define BCM2836_PV2_INTERRUPT 0x4A +#define BCM2836_PV0_INTERRUPT 0x4D +#define BCM2836_PV1_INTERRUPT 0x4E +#define BCM2836_MBOX_INTERRUPT 0x61 +#define BCM2836_VCHIQ_INTERRUPT 0x62 +#define BCM2386_GPIO_INTERRUPT0 0x51 +#define BCM2386_GPIO_INTERRUPT1 0x53 +#define BCM2836_I2C1_INTERRUPT 0x55 +#define BCM2836_I2C2_INTERRUPT 0x55 +#define BCM2836_SPI0_INTERRUPT 0x56 +#define BCM2836_USB_INTERRUPT 0x29 +#define BCM2836_SDHOST_INTERRUPT 0x58 +#define BCM2836_MMCHS1_INTERRUPT 0x5E +#define BCM2836_MINI_UART_INTERRUPT 0x3D +#define BCM2836_PL011_UART_INTERRUPT 0x59 +#elif (RPI_MODEL == 4) #define BCM2836_V3D_BUS_INTERRUPT 0x2A #define BCM2836_DMA_INTERRUPT 0x3B #define BCM2836_SPI1_INTERRUPT 0x3D @@ -124,5 +159,6 @@ typedef struct #define BCM2836_PL011_UART_INTERRUPT 0x99 #define GENET_INTERRUPT0 0xBD #define GENET_INTERRUPT1 0xBE +#endif #endif // __ACPITABLES_H__ diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl index e1ddb742376a..c2775088b5a2 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Dsdt.asl @@ -31,7 +31,9 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2) { include ("Sdhc.asl") include ("Pep.asl") +#if (RPI_MODEL == 4) include ("Xhci.asl") +#endif Device (CPU0) { @@ -286,6 +288,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2) } } +#if (RPI_MODEL == 4) Device (ETH0) { Name (_HID, "BCM6E4E") @@ -314,6 +317,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "MSFT", "EDK2", 2) } }) } +#endif // Description: I2C Device (I2C1) diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc index 7c2aa9389456..8453e487fb63 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc @@ -14,7 +14,6 @@ #include "AcpiTables.h" -#define RPI_SYSTEM_TIMER_BASE_ADDRESS 0xFF80001C #define RPI_GTDT_GLOBAL_FLAGS 0 #define RPI_GTDT_GTIMER_FLAGS EFI_ACPI_5_1_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc index f847a9310ff7..4029cd191ab5 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc @@ -23,7 +23,9 @@ typedef struct { EFI_ACPI_5_1_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header; EFI_ACPI_5_1_GIC_STRUCTURE GicInterfaces[4]; +#if (RPI_MODEL != 3) EFI_ACPI_5_1_GIC_DISTRIBUTOR_STRUCTURE GicDistributor; +#endif } PI_MULTIPLE_APIC_DESCRIPTION_TABLE; #pragma pack () @@ -42,6 +44,16 @@ PI_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = { 0, // Flags }, { +#if (RPI_MODEL == 3) + EFI_ACPI_5_1_GICC_STRUCTURE_INIT( + 0, 0, GET_MPID(0, 0), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0), + EFI_ACPI_5_1_GICC_STRUCTURE_INIT( + 1, 1, GET_MPID(0, 1), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0), + EFI_ACPI_5_1_GICC_STRUCTURE_INIT( + 2, 2, GET_MPID(0, 2), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0), + EFI_ACPI_5_1_GICC_STRUCTURE_INIT( + 3, 3, GET_MPID(0, 3), EFI_ACPI_5_1_GIC_ENABLED, 0x09, 0x40000000, 0, 0, 0, 0), +#elif (RPI_MODEL == 4) EFI_ACPI_5_1_GICC_STRUCTURE_INIT( 0, 0, GET_MPID(0, 0), EFI_ACPI_5_1_GIC_ENABLED, 48, FixedPcdGet64 (PcdGicInterruptInterfaceBase), 0xFF846000, 0xFF844000, 0x19, 0), @@ -54,8 +66,11 @@ PI_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = { EFI_ACPI_5_1_GICC_STRUCTURE_INIT( 3, 3, GET_MPID(0, 3), EFI_ACPI_5_1_GIC_ENABLED, 51, FixedPcdGet64 (PcdGicInterruptInterfaceBase), 0xFF846000, 0xFF844000, 0x19, 0), +#endif }, +#if (RPI_MODEL != 3) EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(0, FixedPcdGet64 (PcdGicDistributorBase), 0) +#endif }; // -- 2.21.0.windows.1