From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.7635.1589180828065552903 for ; Mon, 11 May 2020 00:07:08 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A67BDD6E; Mon, 11 May 2020 00:07:07 -0700 (PDT) Received: from e123331-lin.nice.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 077CA3F68F; Mon, 11 May 2020 00:07:05 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Pete Batard , Jared McNeill , Andrei Warkentin , Samer El-Haj-Mahmoud Subject: [PATCH edk2-platforms v3 2/5] Silicon/Broadcom/BcmGenetDxe: add support for broadcast filtering Date: Mon, 11 May 2020 09:06:53 +0200 Message-Id: <20200511070656.32141-3-ard.biesheuvel@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511070656.32141-1-ard.biesheuvel@arm.com> References: <20200511070656.32141-1-ard.biesheuvel@arm.com> Add a helper to configure the first MDF filter for filtering the broadcast Ethernet address. Signed-off-by: Ard Biesheuvel --- Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.h | 7 ++++++ Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c | 24 ++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.h b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.h index 2e7b78322bcd..1dc7a51a1ca6 100644 --- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.h +++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.h @@ -107,6 +107,7 @@ #define GENET_UMAC_MDF_CTRL 0xe50 #define GENET_UMAC_MDF_ADDR0(n) (0xe54 + (n) * 0x8) #define GENET_UMAC_MDF_ADDR1(n) (0xe58 + (n) * 0x8) +#define GENET_MAX_MDF_FILTER 17 #define GENET_DMA_DESC_COUNT 256 #define GENET_DMA_DESC_SIZE 12 @@ -300,6 +301,12 @@ GenetSetPromisc ( IN BOOLEAN Enable ); +VOID +GenetEnableBroadcastFilter ( + IN GENET_PRIVATE_DATA *Genet, + IN BOOLEAN Enable + ); + VOID GenetDmaInitRings ( IN GENET_PRIVATE_DATA *Genet diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c index af7c06656433..2176bb451e7d 100644 --- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c +++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c @@ -492,6 +492,30 @@ GenetSetPromisc ( GenetMmioWrite (Genet, GENET_UMAC_CMD, Value); } +/** + Enable the MAC filter for the Ethernet broadcast address + + @param Genet[in] Pointer to GENET_PRIVATE_DATA. + @param Enable[in] Promiscuous mode state. + +**/ +VOID +GenetEnableBroadcastFilter ( + IN GENET_PRIVATE_DATA *Genet, + IN BOOLEAN Enable + ) +{ + UINT32 Value; + + Value = (1U << GENET_MAX_MDF_FILTER) - 1; + if (Enable) { + GenetMmioWrite (Genet, GENET_UMAC_MDF_ADDR0 (0), 0xffff); + GenetMmioWrite (Genet, GENET_UMAC_MDF_ADDR1 (0), 0xffffffff); + Value &= ~BIT0; + } + GenetMmioWrite (Genet, GENET_UMAC_MDF_CTRL, Value); +} + /** Configure DMA TX and RX queues, enabling them. -- 2.17.1