From patchwork Tue Nov 6 17:58:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 150308 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4192111ljp; Tue, 6 Nov 2018 09:59:11 -0800 (PST) X-Google-Smtp-Source: AJdET5dtZfkJixspjFh2neLQ9XVpVTzMwcSoNH3/iS1wWeW8keZtUp5B6NCtwkcSwNXIH9vPGc5l X-Received: by 2002:a17:902:67:: with SMTP id 94-v6mr15514548pla.225.1541527151011; Tue, 06 Nov 2018 09:59:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541527151; cv=none; d=google.com; s=arc-20160816; b=dB7u0E7yENo/C/2a5GvIyBhHcn3Ivd4HylS+j5pMdA1NU2qDQhv69f6H2C/HzXJzPP 5EfgI+5mQF7rtq31aUG89lbPtUqvhlG4DEvOQ9R28+cCOMF3s8wNeOuILVGMFExMEB3R y/qLcyAV5B2YXD71DxKeLUUW0H8SK7X83p6MsscWI7p+dJ3U3ieZbo5dpAlB5q5h7vyZ OoiuAym2fyH7XkdWMNqmI7B2a0f2QF0mG5XadyWjKoGxgbMAur3tWNO49ip7oCY+a25h xMBlo+YNboR1nuV9I15Dar/MIDHIuaX2XQTwpA4NlH5FrMoV33d1kTHG4BLPKzIk4xip LYqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=F1hAUd5yqByZco52kmPVT6Kc1ts6oAmUalSJAe5OA1M=; b=WKqrGJCQC9DK0QUCSOw9PLWG/mvPvWZfAoANiPCaOa7J4tvKsuGbtREGjWhvFhra8h Zj7BQshwak1Mf6iqbPI3bS7Y9ooXSOAws7zr8OTZjN1yxdLLfiIMDTHdDYYJBtXYC78j Q12MguVHEMlxiWN3Jomc21/LlcGvtmgaPO/gkmSkwYvOWRbGBTDHbC/cCfiW51MzFxD+ hW8aH/bNbu+GIbtr0j0umdVJuj4o5fnmiUfgJkx5cLrVlCDnNvHAvLwS7EICmVkmkUKc 7CONG7qAY0mLs+UTcQksJJifZN/9x9bHG4JiDfq+LCeG+qPRdMYOGTeg17U5PIWm4k1t myjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=JqkdFoel; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id o125-v6si45984167pgo.302.2018.11.06.09.59.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 09:59:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=JqkdFoel; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7AD772118C503; Tue, 6 Nov 2018 09:59:00 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::442; helo=mail-wr1-x442.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (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 D362B2118C500 for ; Tue, 6 Nov 2018 09:58:58 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id u9-v6so4227684wrr.0 for ; Tue, 06 Nov 2018 09:58:58 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=FS2K71xcx8etC4DojXEHB4gP06/JTl6yWsJVA1N5Vr0=; b=JqkdFoelIeLDGjZ6r5NlT7G5Z7pUBBU2aIEr9bYj7oIzn2nA2ovN/2fBgqfn36H323 f0RR1tMhbWduz2k6oS4dEfHERxZVjRbiNN6zXa82hs1PNQXiY68BIPZELV0U/DpPxsEX A7GT9KyGKg/aJTY2mmKZV4nI45crPGr9+vnSo= 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=FS2K71xcx8etC4DojXEHB4gP06/JTl6yWsJVA1N5Vr0=; b=pdSs/6RjYnO0HYb9lTAtNvr7EOQBLSuEmLr/K/rgp2UilPKVMIpTxR888tjH1WtupA A0CBY9A2wqytPcMbfq+yK0UoV7N6aRm/1s8fJ5LMzczBhz+6/pgo+2yix1byDnsYXb5y AQpViTmRGXpcnIB7YgE7SGRVp9kOG0saT0Z2y4It+o9f2O5FuY22bSXmEpV1y2Cy3v49 T2lWTiU4tAnP5mky9OVAi8atBR3jOhTRx51B7QSPe+2Vok0xs/Woq9xqqzu928S8jWUz ayeUufflh+u/AYB+1U0BfOHWA+8QBol65aOpcCcXWRzZTf+gUjId9TBXlHz7Q/InKMpE puWg== X-Gm-Message-State: AGRZ1gLYjmD9ljtaz8np6Ar6f54wZ/AEjmGJwea1LAxdeEciQaCrRDET dbdbQwz/F7YqJk9xlAhiqCK/qDX8xF8= X-Received: by 2002:adf:9c90:: with SMTP id d16-v6mr23808080wre.11.1541527137109; Tue, 06 Nov 2018 09:58:57 -0800 (PST) Received: from localhost.localdomain (laubervilliers-657-1-83-120.w92-154.abo.wanadoo.fr. [92.154.90.120]) by smtp.gmail.com with ESMTPSA id 134-v6sm2971522wmp.6.2018.11.06.09.58.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 09:58:56 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 6 Nov 2018 18:58:20 +0100 Message-Id: <20181106175833.26964-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181106175833.26964-1-ard.biesheuvel@linaro.org> References: <20181106175833.26964-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH edk2-staging 06/19] IntelUndiPkg/GigUndiDxe: use intermediate UINTN casts for pointers X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: michael.d.kinney@intel.com, eric.jin@intel.com Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Use intermediate (UINTN) casts when casting pointers to UINT64. This is needed to be able to build this code for 32-bit architectures such as ARM or IA32. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- IntelUndiPkg/GigUndiDxe/Dma.c | 8 ++++---- IntelUndiPkg/GigUndiDxe/DriverDiagnostics.c | 6 +++--- IntelUndiPkg/GigUndiDxe/Init.c | 6 +++--- IntelUndiPkg/GigUndiDxe/e1000.c | 10 +++++----- IntelUndiPkg/GigUndiDxe/e1000.h | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) -- 2.19.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Ryszard Knop diff --git a/IntelUndiPkg/GigUndiDxe/Dma.c b/IntelUndiPkg/GigUndiDxe/Dma.c index bf94c1e2fd54..eee2aa8a1ce3 100644 --- a/IntelUndiPkg/GigUndiDxe/Dma.c +++ b/IntelUndiPkg/GigUndiDxe/Dma.c @@ -127,7 +127,7 @@ FREE_BUF_ON_ERROR: PciIo->FreeBuffer ( PciIo, BytesToPages (DmaMapping->Size), - (VOID *) DmaMapping->UnmappedAddress + (VOID *)(UINTN)DmaMapping->UnmappedAddress ); DmaMapping->Size = 0; DmaMapping->UnmappedAddress = 0; @@ -173,7 +173,7 @@ UndiDmaFreeCommonBuffer ( PciIo->FreeBuffer ( PciIo, BytesToPages (DmaMapping->Size), - (VOID *) DmaMapping->UnmappedAddress + (VOID *)(UINTN)DmaMapping->UnmappedAddress ); DmaMapping->UnmappedAddress = 0; @@ -209,7 +209,7 @@ UndiDmaMapCommonBuffer ( return PciIo->Map ( PciIo, EfiPciIoOperationBusMasterCommonBuffer, - (VOID *) DmaMapping->UnmappedAddress, + (VOID *)(UINTN)DmaMapping->UnmappedAddress, &DmaMapping->Size, &DmaMapping->PhysicalAddress, &DmaMapping->Mapping @@ -243,7 +243,7 @@ UndiDmaMapMemoryRead ( return PciIo->Map ( PciIo, EfiPciIoOperationBusMasterRead, - (VOID *) DmaMapping->UnmappedAddress, + (VOID *)(UINTN)DmaMapping->UnmappedAddress, &DmaMapping->Size, &DmaMapping->PhysicalAddress, &DmaMapping->Mapping diff --git a/IntelUndiPkg/GigUndiDxe/DriverDiagnostics.c b/IntelUndiPkg/GigUndiDxe/DriverDiagnostics.c index 559f2133281e..aceb015e480f 100644 --- a/IntelUndiPkg/GigUndiDxe/DriverDiagnostics.c +++ b/IntelUndiPkg/GigUndiDxe/DriverDiagnostics.c @@ -1132,7 +1132,7 @@ GigUndiRunPhyLoopback ( while (j < PHY_LOOPBACK_ITERATIONS) { Status = E1000Transmit ( GigAdapterInfo, - (UINT64) &PxeCpbTransmit, + (UINT64)(UINTN)&PxeCpbTransmit, PXE_OPFLAGS_TRANSMIT_WHOLE ); _DisplayBuffersAndDescriptors (GigAdapterInfo); @@ -1161,8 +1161,8 @@ GigUndiRunPhyLoopback ( for (i = 0; i <= 100000; i++) { Status = E1000Receive ( GigAdapterInfo, - (UINT64) &CpbReceive, - (UINT64) &DbReceive + (UINT64)(UINTN)&CpbReceive, + (UINT64)(UINTN)&DbReceive ); gBS->Stall (10); diff --git a/IntelUndiPkg/GigUndiDxe/Init.c b/IntelUndiPkg/GigUndiDxe/Init.c index 74b933674589..f99734d72823 100644 --- a/IntelUndiPkg/GigUndiDxe/Init.c +++ b/IntelUndiPkg/GigUndiDxe/Init.c @@ -301,7 +301,7 @@ GigUndiPxeStructInit ( PXE_ROMID_IMP_TX_COMPLETE_INT_SUPPORTED | PXE_ROMID_IMP_PACKET_RX_INT_SUPPORTED; - PxePtr->EntryPoint = (UINT64) E1000UndiApiEntry; + PxePtr->EntryPoint = (UINT64)(UINTN)E1000UndiApiEntry; PxePtr->reserved2[0] = 0; PxePtr->reserved2[1] = 0; PxePtr->reserved2[2] = 0; @@ -842,7 +842,7 @@ InitNiiProtocol ( return EFI_INVALID_PARAMETER; } - NiiProtocol31->Id = (UINT64) (mE1000Pxe31); + NiiProtocol31->Id = (UINT64)(UINTN)mE1000Pxe31; NiiProtocol31->IfNum = mE1000Pxe31->IFcnt; NiiProtocol31->Revision = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION_31; @@ -938,7 +938,7 @@ InitUndiCallbackFunctions ( NicInfo->MapMem = (VOID *) 0; NicInfo->UnMapMem = (VOID *) 0; NicInfo->SyncMem = (VOID *) 0; - NicInfo->UniqueId = (UINT64) NicInfo; + NicInfo->UniqueId = (UINT64)(UINTN)NicInfo; NicInfo->VersionFlag = 0x31; } diff --git a/IntelUndiPkg/GigUndiDxe/e1000.c b/IntelUndiPkg/GigUndiDxe/e1000.c index 6f8529abf046..1f08a5d67b2d 100644 --- a/IntelUndiPkg/GigUndiDxe/e1000.c +++ b/IntelUndiPkg/GigUndiDxe/e1000.c @@ -128,7 +128,7 @@ E1000MapMem ( VirtualAddress, Size, TO_DEVICE, - (UINT64) MappedAddress + (UINT64)(UINTN)MappedAddress ); if (*MappedAddress == 0) { @@ -1079,7 +1079,7 @@ E1000TxRxConfigure ( ZeroMem (GigAdapter->TxBufferMappings, sizeof (GigAdapter->TxBufferMappings)); - RxBuffer = (LOCAL_RX_BUFFER *) GigAdapter->RxBufferMapping.PhysicalAddress; + RxBuffer = (LOCAL_RX_BUFFER *)(UINTN)GigAdapter->RxBufferMapping.PhysicalAddress; DEBUGPRINT ( E1000, ("Tx Ring %x Added %x\n", @@ -1578,17 +1578,17 @@ E1000Inititialize ( TempBar = NULL; ZeroMem ( - (VOID *) GigAdapter->RxRing.UnmappedAddress, + (VOID *)(UINTN)GigAdapter->RxRing.UnmappedAddress, RX_RING_SIZE ); ZeroMem ( - (VOID *) GigAdapter->TxRing.UnmappedAddress, + (VOID *)(UINTN)GigAdapter->TxRing.UnmappedAddress, TX_RING_SIZE ); ZeroMem ( - (VOID *) GigAdapter->RxBufferMapping.UnmappedAddress, + (VOID *)(UINTN)GigAdapter->RxBufferMapping.UnmappedAddress, RX_BUFFERS_SIZE ); diff --git a/IntelUndiPkg/GigUndiDxe/e1000.h b/IntelUndiPkg/GigUndiDxe/e1000.h index 71fe4591af05..a44fe3fa2ec8 100644 --- a/IntelUndiPkg/GigUndiDxe/e1000.h +++ b/IntelUndiPkg/GigUndiDxe/e1000.h @@ -233,7 +233,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @return Descriptor retrieved **/ #define E1000_RX_DESC(R, i) \ - (&(((struct e1000_rx_desc *) ((R)->UnmappedAddress))[i])) + (&(((struct e1000_rx_desc *)(UINTN)((R)->UnmappedAddress))[i])) /** Retrieves TX descriptor from TX ring structure @@ -243,7 +243,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @return Descriptor retrieved **/ #define E1000_TX_DESC(R, i) \ - (&(((struct e1000_tx_desc *) ((R)->UnmappedAddress))[i])) + (&(((struct e1000_tx_desc *)(UINTN)((R)->UnmappedAddress))[i])) /** Retrieves UNDI_PRIVATE_DATA structure using NII Protocol 3.1 instance