From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.groups.io with SMTP id smtpd.web12.8821.1576757691402261623 for ; Thu, 19 Dec 2019 04:14:52 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=wwaOZs7c; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.221.68, mailfrom: pete@akeo.ie) Received: by mail-wr1-f68.google.com with SMTP id c14so5743592wrn.7 for ; Thu, 19 Dec 2019 04:14:51 -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=Sjnt7yvpJKVy/X0pbZasD/8iD4hfANnfm405ReDa9EU=; b=wwaOZs7cI5wM37pBolrAA/No/vQ9Oh4gGKZUXrsPRGFoJt+FGOFd+NxF3Vk5jF2ZcX aeAuEs8YoE9dPDhoENuHtjLcoLQqie1HmQrJlK7kUcY1wVnJVJ+eBGEEaazEgoyzi8BW 4LxmsPMgDHsH+qtg31xCjuBn7y+tZdn3Dcv3uKEFBmTjYQgQ4h40jVdumx5JFKNVpbT9 Cm0qX3C6pwigDgFmoCCZmxXGRPsuDz8HHsE8cGb4M0FsjvWhm6DC56A7DHKrf9LuH2Sm Hz0ds6iFxH0+AsEZQ4JQrKoXdr1vXxPE6+O+g8nbeITRSAq6+qcVnVucsTZivy0fFmdD 2VaA== 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=Sjnt7yvpJKVy/X0pbZasD/8iD4hfANnfm405ReDa9EU=; b=GN17Q1L56cRPzeVbz989qtwtViG7/prlbHgpgWtGt+OgV0MvIMlHMNUm2yDnEYpOGY QOmh8aObH/ZnXvy4Mv/JwFTw2zSmcQo2DyojPet7BokAUiGweUNKDSC/Pm2YEctpnre3 joARxNG9Qn53JtOpF1p5ekaQsQsdEN2HfxQ6vJA65aqkW3bvPMiT2ZYXRcqlcBZoWxtr z+x366okHDN0xfTK+iUEqBp1li7Hi0nMcJdNmVoPBXV07YSqtZ2Zs/gipBoUJYfmZ8el kPH4giMPlYXzflYEkZpwOJJI4XrAbi3WXIiYO4AA7+oKCYjvbwj6t883RjnzywilpsLM LEqQ== X-Gm-Message-State: APjAAAXzef6FyCBdJP1mBbW7c1AhOiLjUCOlvQDsJMJe5DxFZnnWTHDh gbiFg+ATuhsa4kd9aM47rAP8sMJDtW0= X-Google-Smtp-Source: APXvYqz6AkCCwIyZ7uVVCsiecO+TPE2Tb4lH+A7KKEwV67IygtT9146PslGEJIQdz+qDoK27oor+hA== X-Received: by 2002:adf:a285:: with SMTP id s5mr9045721wra.118.1576757689550; Thu, 19 Dec 2019 04:14:49 -0800 (PST) Return-Path: Received: from localhost.localdomain ([84.203.77.210]) by smtp.gmail.com with ESMTPSA id u8sm5823147wmm.15.2019.12.19.04.14.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 04:14:48 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com Subject: [edk2-platforms][PATCH v2 2/7] Platform/RPi4: Clean up ACPI definitions Date: Thu, 19 Dec 2019 12:14:29 +0000 Message-Id: <20191219121434.2856-3-pete@akeo.ie> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20191219121434.2856-1-pete@akeo.ie> References: <20191219121434.2856-1-pete@akeo.ie> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit * Use ACPI 5.1 everywhere, since we are constrained to use v5.x for MADT compatibility. * Clean up whitespaces and reorganize header declaration. * Prefix all RPi related constant with RPI_ to make them clearer to differentiate from regular EDK2 ones. * Reference IndustryStandard/Acpi.h always. * Remove explicit references to RPI4 for sources that we may be factorized for both the Pi 3 and Pi 4 platform. Signed-off-by: Pete Batard --- Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h | 12 +++--- Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc | 42 ++++++++++---------- Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc | 30 +++++++------- Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc | 11 ++--- Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl | 4 +- Platform/RaspberryPi/RPi4/AcpiTables/Pep.c | 6 +-- Platform/RaspberryPi/RPi4/AcpiTables/Pep.h | 8 ++-- 7 files changed, 58 insertions(+), 55 deletions(-) diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h index e61f3fa0bcfa..dcdbac7a0b7b 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h +++ b/Platform/RaspberryPi/RPi4/AcpiTables/AcpiTables.h @@ -13,7 +13,7 @@ #ifndef __ACPITABLES_H__ #define __ACPITABLES_H__ -#include +#include #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 @@ -41,10 +41,10 @@ #define EFI_ACPI_CSRT_DEVICE_ID_DMA 0x00000009 // Fixed id #define EFI_ACPI_CSRT_RESOURCE_ID_IN_DMA_GRP 0x0 // Count up from 0 -#define RPI4_DMA_CHANNEL_COUNT 10 // All 10 DMA channels are listed, including the reserved ones -#define RPI4_DMA_USED_CHANNEL_COUNT 5 // Use 5 DMA channels +#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 -#define EFI_ACPI_5_0_CSRT_REVISION 0x00000000 +#define EFI_ACPI_5_1_CSRT_REVISION 0x00000000 typedef enum { @@ -76,7 +76,7 @@ typedef struct UINT16 Revision; // 2 bytes UINT16 Reserved; // 2 bytes UINT32 SharedInfoLength; // 4 bytes -} EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER; +} EFI_ACPI_5_1_CSRT_RESOURCE_GROUP_HEADER; //------------------------------------------------------------------------ // CSRT Resource Descriptor 12 bytes total @@ -87,6 +87,6 @@ typedef struct UINT16 ResourceType; // 2 bytes UINT16 ResourceSubType; // 2 bytes UINT32 UID; // 4 bytes -} EFI_ACPI_5_0_CSRT_RESOURCE_DESCRIPTOR_HEADER; +} EFI_ACPI_5_1_CSRT_RESOURCE_DESCRIPTOR_HEADER; #endif // __ACPITABLES_H__ diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc index 22a370d04017..f8bf3f26a341 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Csrt.aslc @@ -9,14 +9,16 @@ * **/ +#include + #include "AcpiTables.h" -#define DMA_MAX_REQ_LINES 32 +#define RPI_DMA_MAX_REQ_LINES 32 #pragma pack (push, 1) //------------------------------------------------------------------------ -// DMA Controller Vendor Data for RPi4 +// DMA Controller Vendor Data //------------------------------------------------------------------------ typedef struct { @@ -34,16 +36,16 @@ typedef struct } DMA_CONTROLLER_VENDOR_DATA; //------------------------------------------------------------------------ -// DMA Controller on RPi4 +// DMA Controller //------------------------------------------------------------------------ typedef struct { - EFI_ACPI_5_0_CSRT_RESOURCE_DESCRIPTOR_HEADER DmaControllerHeader; + EFI_ACPI_5_1_CSRT_RESOURCE_DESCRIPTOR_HEADER DmaControllerHeader; DMA_CONTROLLER_VENDOR_DATA ControllerVendorData; } RD_DMA_CONTROLLER; //------------------------------------------------------------------------ -// DMA Channel Vendor Data for RPi4 +// DMA Channel Vendor Data //------------------------------------------------------------------------ typedef struct { @@ -54,27 +56,27 @@ typedef struct } DMA_CHANNEL_VENDOR_DATA; //------------------------------------------------------------------------ -// DMA Channel on RPi4 +// DMA Channel //------------------------------------------------------------------------ typedef struct { - EFI_ACPI_5_0_CSRT_RESOURCE_DESCRIPTOR_HEADER DmaChannelHeader; + EFI_ACPI_5_1_CSRT_RESOURCE_DESCRIPTOR_HEADER DmaChannelHeader; DMA_CHANNEL_VENDOR_DATA ChannelVendorData; } RD_DMA_CHANNEL; //------------------------------------------------------------------------ -// DMA Resource Group on RPi4 +// DMA Resource Group //------------------------------------------------------------------------ typedef struct { - EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER ResGroupHeader; + EFI_ACPI_5_1_CSRT_RESOURCE_GROUP_HEADER ResGroupHeader; RD_DMA_CONTROLLER DmaController; - RD_DMA_CHANNEL DmaChannels[RPI4_DMA_CHANNEL_COUNT]; + RD_DMA_CHANNEL DmaChannels[RPI_DMA_CHANNEL_COUNT]; } RG_DMA; //---------------------------------------------------------------------------- -// CSRT table structure for RPi4 platform - current revision only includes DMA +// CSRT table structure - current revision only includes DMA //---------------------------------------------------------------------------- typedef struct { @@ -84,20 +86,20 @@ typedef struct // DMA Resource Group RG_DMA DmaResourceGroup; -} EFI_ACPI_5_0_CSRT_TABLE; +} EFI_ACPI_5_1_CSRT_TABLE; -EFI_ACPI_5_0_CSRT_TABLE Csrt = +EFI_ACPI_5_1_CSRT_TABLE Csrt = { //------------------------------------------------------------------------ // ACPI Table Header //------------------------------------------------------------------------ { - EFI_ACPI_5_0_CORE_SYSTEM_RESOURCE_TABLE_SIGNATURE, // Signature "CSRT" + EFI_ACPI_5_1_CORE_SYSTEM_RESOURCE_TABLE_SIGNATURE, // Signature "CSRT" sizeof (EFI_ACPI_DESCRIPTION_HEADER) + sizeof (RG_DMA), // Length - EFI_ACPI_5_0_CSRT_REVISION, // Revision + EFI_ACPI_5_1_CSRT_REVISION, // Revision 0x00, // Checksum calculated at runtime. - EFI_ACPI_OEM_ID, // OEMID is a 6 bytes long field "BC2836" - EFI_ACPI_OEM_TABLE_ID, // OEM table identification(8 bytes long) "RPI4EDK2" + EFI_ACPI_OEM_ID, // OEMID is a 6 bytes long field + EFI_ACPI_OEM_TABLE_ID, // OEM table identification (8 bytes long) EFI_ACPI_OEM_REVISION, // OEM revision number. EFI_ACPI_CREATOR_ID, // ASL compiler vendor ID. EFI_ACPI_CREATOR_REVISION // ASL compiler revision number. @@ -136,13 +138,13 @@ EFI_ACPI_5_0_CSRT_TABLE Csrt = sizeof (DMA_CONTROLLER_VENDOR_DATA), // Controller vendor data here 1, 0xFE007000, // Base address for channels - RPI4_DMA_CHANNEL_COUNT * 0x100, // Base size = Number of channels x 0x100 size for each channel + RPI_DMA_CHANNEL_COUNT * 0x100, // Base size = Number of channels x 0x100 size for each channel 0xFE007FE0, // Base address for controller 8, // Base size = two registers - RPI4_DMA_USED_CHANNEL_COUNT, + RPI_DMA_USED_CHANNEL_COUNT, 0, // cannot use controller interrupt 0, // Minimum Request Line - DMA_MAX_REQ_LINES - 1, // Maximum Request Line + RPI_DMA_MAX_REQ_LINES - 1, // Maximum Request Line FALSE, }, }, diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc index 293c6022d258..7c2aa9389456 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Gtdt.aslc @@ -8,41 +8,41 @@ * **/ +#include #include #include -#include #include "AcpiTables.h" -#define SYSTEM_TIMER_BASE_ADDRESS 0xFF80001C -#define GTDT_GLOBAL_FLAGS 0 -#define GTDT_GTIMER_FLAGS EFI_ACPI_6_0_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY +#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 #pragma pack (1) typedef struct { - EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt; -} EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLES; + EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt; +} EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLES; #pragma pack () -EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLES Gtdt = { +EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLES Gtdt = { { ACPI_HEADER( - EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, - EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLES, - EFI_ACPI_6_0_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION + EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLES, + EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION ), - SYSTEM_TIMER_BASE_ADDRESS, // UINT64 PhysicalAddress + RPI_SYSTEM_TIMER_BASE_ADDRESS, // UINT64 PhysicalAddress 0, // UINT32 Reserved FixedPcdGet32 (PcdArmArchTimerSecIntrNum), // UINT32 SecurePL1TimerGSIV - GTDT_GTIMER_FLAGS, // UINT32 SecurePL1TimerFlags + RPI_GTDT_GTIMER_FLAGS, // UINT32 SecurePL1TimerFlags FixedPcdGet32 (PcdArmArchTimerIntrNum), // UINT32 NonSecurePL1TimerGSIV - GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL1TimerFlags + RPI_GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL1TimerFlags FixedPcdGet32 (PcdArmArchTimerVirtIntrNum), // UINT32 VirtualTimerGSIV - GTDT_GTIMER_FLAGS, // UINT32 VirtualTimerFlags + RPI_GTDT_GTIMER_FLAGS, // UINT32 VirtualTimerFlags FixedPcdGet32 (PcdArmArchTimerHypIntrNum), // UINT32 NonSecurePL2TimerGSIV - GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL2TimerFlags + RPI_GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL2TimerFlags 0xFFFFFFFFFFFFFFFF, // UINT64 CntReadBasePhysicalAddress 0, // UINT32 PlatformTimerCount 0 // UINT32 PlatfromTimerOffset diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc b/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc index 0027cb9fe8bb..f847a9310ff7 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Madt.aslc @@ -8,11 +8,12 @@ * **/ -#include "AcpiTables.h" +#include #include #include #include -#include + +#include "AcpiTables.h" // // Multiple APIC Description Table @@ -45,13 +46,13 @@ PI_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = { 0, 0, GET_MPID(0, 0), EFI_ACPI_5_1_GIC_ENABLED, 48, FixedPcdGet64 (PcdGicInterruptInterfaceBase), 0xFF846000, 0xFF844000, 0x19, 0), EFI_ACPI_5_1_GICC_STRUCTURE_INIT( - 1, 1, GET_MPID(0, 1), EFI_ACPI_5_1_GIC_ENABLED, 49, FixedPcdGet64 (PcdGicInterruptInterfaceBase), + 1, 1, GET_MPID(0, 1), EFI_ACPI_5_1_GIC_ENABLED, 49, FixedPcdGet64 (PcdGicInterruptInterfaceBase), 0xFF846000, 0xFF844000, 0x19, 0), EFI_ACPI_5_1_GICC_STRUCTURE_INIT( - 2, 2, GET_MPID(0, 2), EFI_ACPI_5_1_GIC_ENABLED, 50, FixedPcdGet64 (PcdGicInterruptInterfaceBase), + 2, 2, GET_MPID(0, 2), EFI_ACPI_5_1_GIC_ENABLED, 50, FixedPcdGet64 (PcdGicInterruptInterfaceBase), 0xFF846000, 0xFF844000, 0x19, 0), EFI_ACPI_5_1_GICC_STRUCTURE_INIT( - 3, 3, GET_MPID(0, 3), EFI_ACPI_5_1_GIC_ENABLED, 51, FixedPcdGet64 (PcdGicInterruptInterfaceBase), + 3, 3, GET_MPID(0, 3), EFI_ACPI_5_1_GIC_ENABLED, 51, FixedPcdGet64 (PcdGicInterruptInterfaceBase), 0xFF846000, 0xFF844000, 0x19, 0), }, EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(0, FixedPcdGet64 (PcdGicDistributorBase), 0) diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl index 7096109f8819..8a0a44e1c4c9 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.asl @@ -13,9 +13,9 @@ Device(PEPD) { // - // RPI4 PEP virtual device. + // PEP virtual device. // - Name (_HID, "BCM2854") // Note: since pep on rpi4 is virtual device, + Name (_HID, "BCM2854") // Note: Since PEP on RPi is a virtual device, Name (_CID, "BCM2854") // its device id needs to be generated by Microsoft Name (_UID, 0x0) Name (_CRS, ResourceTemplate () diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c index 1a78392f05a0..f452580c703d 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.c @@ -12,7 +12,7 @@ #include "Pep.h" -PEP_PROCESSOR_TABLE_PLAT RPI4Processors = { +PEP_PROCESSOR_TABLE_PLAT RpiProcessors = { 1, // Version 1, // NumberProcessors { // ProcessorInfo @@ -30,7 +30,7 @@ PEP_PROCESSOR_TABLE_PLAT RPI4Processors = { } }; -PEP_COORDINATED_STATE_TABLE_PLAT RPI4CoordinatedStates = { +PEP_COORDINATED_STATE_TABLE_PLAT RpiCoordinatedStates = { 1, // Version 1, // CoordinatedStateCount { // CordinatedStates[] @@ -52,7 +52,7 @@ PEP_COORDINATED_STATE_TABLE_PLAT RPI4CoordinatedStates = { } }; -PEP_DEVICE_TABLE_PLAT RPI4Devices = { +PEP_DEVICE_TABLE_PLAT RpiDevices = { 1, // Version 1, // NumberDevices { // DeviceInfo diff --git a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h index 19b801caf783..30f6768f12a5 100644 --- a/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h +++ b/Platform/RaspberryPi/RPi4/AcpiTables/Pep.h @@ -14,10 +14,10 @@ * Note: Not everything is here. At least SOC_STATE_TYPE is missing. */ -#ifndef _RPI4PEP_H_INCLUDED_ -#define _RPI4PEP_H_INCLUDED_ +#ifndef _RPI_PEP_H_INCLUDED_ +#define _RPI_PEP_H_INCLUDED_ -#include +#include #define PEP_MAX_DEPENDENCIES_PER_STATE 16 #define MAX_PROCESSOR_PATH_LENGTH 16 @@ -118,4 +118,4 @@ typedef struct _PEP_DEVICE_TABLE_PLAT { PEP_DEVICE_INFO_PLAT DeviceInfo[P_NUMBER_DEVICES]; } PEP_DEVICE_TABLE_PLAT, *PPEP_DEVICE_TABLE_PLAT; -#endif // _RPI4PEP_H_INCLUDED_ +#endif // _RPI_PEP_H_INCLUDED_ -- 2.21.0.windows.1