From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:4864:20::243; helo=mail-lj1-x243.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2276A20986AB2 for ; Fri, 13 Jul 2018 01:12:31 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id 1-v6so23872995ljv.9 for ; Fri, 13 Jul 2018 01:12:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ru2MJzHCsl8VSXcxUO4Bc7R3QXzGeOdTatqL62mo55s=; b=Kk/uTr6+CTCXqCwK7cusIiI0uUqyKCxvxRdCbzyzwKbjVrzQHoBC+2RD/JrlLU0kf0 QpOY+L8MUt3nOyNd3GUIYJf9CmaM7pDlIlgW0F3HBVUFzV8gCIraEtEG0QFiEpbxPH5h K5iE9MgdTmnxJtemuB5oWvPhjCLHvRWGMiSYeYWZQlVxHoSHfb4EHFVZitQdq+pLSGtm T+C/guyuSc0l8+Wl99lqWAw3Y+45DamtEIdmRZ+NY0osXbow3ISdXHC2V5RiUAmfpxpS WJAwfHHqKAXzKdM9pXMjAvovf+vYQV1pQWvv6W4sM4db620snBnz6Nf56C1BEhR5AnUC ThnQ== 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=ru2MJzHCsl8VSXcxUO4Bc7R3QXzGeOdTatqL62mo55s=; b=QfFVWkEpJMB4w9L+gzUwbxeu7sSBlnuOvn6PjKCDwDhtxl8qc4vVfHYNPEnmVuuJtU 0PHoemb+MgFXdYXyd5bULBSgUm330hSioi9tx4rmxn4fVRZIJxAnw9EdvloGioCIGREq DVQB7+dEcOAaiJQD/tDaFT+BMr7PKfRJacrfXxTEV8rJHXzvE8RzpwDDNg9g/IwdotwB ImwYrM4s3CiT6BXdGhMa0TGlE/bTNKHgn8aqqH55Xm6BiDEGVHQCdOI4RjpCdTKLEUX5 kSltojGOfOec7XttQew1oojb+As4A26/Ym0rLvvGMQ8Y/mlavVEAb1ySa7V2L/F2nL5k vGXw== X-Gm-Message-State: AOUpUlFhicCSG8bbsDplrLP7niaxNrE7c7yxFs3vShiGePYU0qct6r+I 2SnhbDDQRyCtTLAl8QW5SUUSkZ/K/H8= X-Google-Smtp-Source: AAOMgpdFIz0qw3oS4eZlEl7gCaDr1Stqwv/RvUdAK2yYLxF++Lkb/rlp+jeyQP77ZC1bPBVU62kGMw== X-Received: by 2002:a2e:291c:: with SMTP id u28-v6mr2591843lje.70.1531469549095; Fri, 13 Jul 2018 01:12:29 -0700 (PDT) Received: from gilgamesh.semihalf.com (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id m29-v6sm6485484lfj.45.2018.07.13.01.12.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Jul 2018 01:12:28 -0700 (PDT) From: Marcin Wojtas To: edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, nadavh@marvell.com, hannah@marvell.com, mw@semihalf.com, jsd@semihalf.com, jaz@semihalf.com Date: Fri, 13 Jul 2018 10:12:11 +0200 Message-Id: <1531469533-31787-5-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531469533-31787-1-git-send-email-mw@semihalf.com> References: <1531469533-31787-1-git-send-email-mw@semihalf.com> Subject: [platforms: PATCH v2 4/6] Marvell/Library: Armada7k8kSoCDescLib: Introduce ICU information X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 08:12:31 -0000 This patch introduces new library callback (ArmadaSoCDescIcuGet ()), which dynamically allocates and fills MV_SOC_ICU_DESC structure with the SoC description of ICU (Interrupt Consolidation Unit). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h | 12 ++++++ Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h | 30 +++++++++++++++ Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c | 39 ++++++++++++++++++++ 3 files changed, 81 insertions(+) diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h index 3072883..c14b985 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h @@ -44,6 +44,18 @@ #define MV_SOC_I2C_BASE(I2c) (0x701000 + ((I2c) * 0x100)) // +// Platform description of ICU (Interrupt Consolidation Unit) controllers +// +#define ICU_GIC_MAPPING_OFFSET 0 +#define ICU_NSR_SET_SPI_BASE 0xf03f0040 +#define ICU_NSR_CLEAR_SPI_BASE 0xf03f0048 +#define ICU_SEI_SET_SPI_BASE 0xf03f0230 +#define ICU_SEI_CLEAR_SPI_BASE 0xf03f0230 +#define ICU_REI_SET_SPI_BASE 0xf03f0270 +#define ICU_REI_CLEAR_SPI_BASE 0xf03f0270 +#define ICU_GROUP_UNSUPPORTED 0x0 + +// // Platform description of MDIO controllers // #define MV_SOC_MDIO_BASE(Cp) (MV_SOC_CP_BASE (Cp) + 0x12A200) diff --git a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h index 30e6378..cdfb51b 100644 --- a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h +++ b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h @@ -61,6 +61,36 @@ ArmadaSoCDescI2cGet ( ); // +// ICU (Interrupt Consolidation Unit) +// +typedef enum { + IcuGroupNsr = 0, + IcuGroupSr = 1, + IcuGroupLpi = 2, + IcuGroupVlpi = 3, + IcuGroupSei = 4, + IcuGroupRei = 5, + IcuGroupMax, +} ICU_GROUP; + +typedef struct { + ICU_GROUP Group; + UINTN SetSpiAddr; + UINTN ClrSpiAddr; +} ICU_MSI; + +typedef struct { + UINTN IcuSpiBase; + ICU_MSI IcuMsi[IcuGroupMax]; +} MV_SOC_ICU_DESC; + +EFI_STATUS +EFIAPI +ArmadaSoCDescIcuGet ( + IN OUT MV_SOC_ICU_DESC **IcuDesc + ); + +// // MDIO // typedef struct { diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c index 7184ab6..6902fda 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c @@ -103,6 +103,45 @@ ArmadaSoCDescI2cGet ( return EFI_SUCCESS; } +// +// Allocate the MSI address per interrupt Group, +// unsupported Groups get NULL address. +// +STATIC +MV_SOC_ICU_DESC mA7k8kIcuDescTemplate = { + ICU_GIC_MAPPING_OFFSET, + { + /* Non secure interrupts */ + { IcuGroupNsr, ICU_NSR_SET_SPI_BASE, ICU_NSR_CLEAR_SPI_BASE }, + /* Secure interrupts */ + { IcuGroupSr, ICU_GROUP_UNSUPPORTED, ICU_GROUP_UNSUPPORTED }, + /* LPI interrupts */ + { IcuGroupLpi, ICU_GROUP_UNSUPPORTED, ICU_GROUP_UNSUPPORTED }, + /* Virtual LPI interrupts */ + { IcuGroupVlpi, ICU_GROUP_UNSUPPORTED, ICU_GROUP_UNSUPPORTED }, + /* System error interrupts */ + { IcuGroupSei, ICU_SEI_SET_SPI_BASE, ICU_SEI_CLEAR_SPI_BASE }, + /* RAM error interrupts */ + { IcuGroupRei, ICU_REI_SET_SPI_BASE, ICU_REI_CLEAR_SPI_BASE }, + } +}; + +EFI_STATUS +EFIAPI +ArmadaSoCDescIcuGet ( + IN OUT MV_SOC_ICU_DESC **IcuDesc + ) +{ + *IcuDesc = AllocateCopyPool (sizeof (mA7k8kIcuDescTemplate), + &mA7k8kIcuDescTemplate); + if (*IcuDesc == NULL) { + DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__)); + return EFI_OUT_OF_RESOURCES; + } + + return EFI_SUCCESS; +} + EFI_STATUS EFIAPI ArmadaSoCDescMdioGet ( -- 2.7.4