From patchwork Thu Mar 1 06:57:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 130111 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp2452365edc; Wed, 28 Feb 2018 22:58:13 -0800 (PST) X-Google-Smtp-Source: AG47ELvZuVqHJMXSUREoWvogsxJ162RL9av4CgoKnJtZbiUb9B+6HiwOaBE8TQVlAMrEO8OTuhN5 X-Received: by 2002:a17:902:4301:: with SMTP id i1-v6mr376867pld.227.1519887493715; Wed, 28 Feb 2018 22:58:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519887493; cv=none; d=google.com; s=arc-20160816; b=gwSSSJB45Y8mrpAGAUsTmE+VRNlHKfvUvArD+tUDCQMjYBsear2JNxnPrnCtC5pcC/ iedorJWflrQ/nCf2sdix62UgIzJLqN7y/CQjY6mF6O1WkrCIu/ZqTDJftbKP6WWIpT/K 1Zyc16aTTm35r0zz4fI4xIdmfEN5vx1x7n7uN/ayIGj6qtAUVo+ojz//Y0FeTmmYO0pS TzIqfS/YiFfA13OcgEmWEP3J5eq9Fc58iYo5Xqe6dAdYTjZzG5wrlJlAa+h7zY94vDS9 SvK51RmDMJtz/vYuVz9mi4fs/GQ5L+ScOUx6YLnQ8PYyQD0J83j5IEwIK7PRihElZwsh hgIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=fFeUJGovordShiH9sgOxWCZLg0cQQLXqEjk3EivqNik=; b=VJ1Qsk0Shhm5UhVY/SazJopMioezr95FJUvtJ7sM7/ZzN6jxd3QQIbCPXx2FW6GHle NVS/nEjr7/FQ9WAKgvkRcfitNwvEnulhI+yazvf7WMc3o+T2z6ViFo7Cllrhl6HL7Whj qAz9/6QmI9GgQTqqcSPpXmVITmkChBPfTHP07Drw4A6UnD1N2vQV8Bu5GU/70QxHwmh1 r/Om02H0UHKeLAPRSC4tUFjJFPM6LceTOxYkeU3CfkwjmQhEWvVLPeNn+5bpRlM++uZU 2Qxz36r0iM4yu56rMs51k9svTr9UwZMZrJkVWjxW/F+qNM30W5g122uzu1zVL/6+P+AM i+6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Yn2WaFMl; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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. [198.145.21.10]) by mx.google.com with ESMTPS id f1si1693409pgr.761.2018.02.28.22.58.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 22:58:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Yn2WaFMl; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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 EE4B42242385B; Wed, 28 Feb 2018 22:52:04 -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=2607:f8b0:400e:c00::243; helo=mail-pf0-x243.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com [IPv6:2607:f8b0:400e:c00::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 CB3DD22423858 for ; Wed, 28 Feb 2018 22:52:02 -0800 (PST) Received: by mail-pf0-x243.google.com with SMTP id a16so2083481pfn.9 for ; Wed, 28 Feb 2018 22:58:10 -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; bh=3GDIjan80cUAO1zWBjouETK+quCYmkK8qXQ6hlijggY=; b=Yn2WaFMlUIauQuGaa+wFWZffxZYVooPRh43kc+86tA36kXQEyup/w7rPM9eeQBIYW7 xq62fCzc8d35EngHMKFGWF/ZnK8+vIGIqiyOZW7tXvNhYpWxqG/icVRIGDwigjAYuQyb F8u8hh6y29FIlJ9Q4Reg5YsXNeFP2bdT1pyiY= 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=3GDIjan80cUAO1zWBjouETK+quCYmkK8qXQ6hlijggY=; b=htiXZIbxzUldANqxuvjs2L+Xa4LBoWx5aQnoxbpgBpa+ObUpHv1jqkH5RZuvrnlkOB sEdXq0NuGwQX8Wxw9ezBpRhbdgxvlft5Kywx4HgV9p0pNgA0bpa8m16vSQrptuVeinTd byiYEcdAtKGHx8vKESz3sm2Uwmur0y/VQasLJJ7tMP6HuYLWp0DCyPD4dWrv96SS9dFv 93Jq7HbOEyfeqcSxXOAP4o9jVcLCSteRRhuH8Jrt/wCaoz+pe1ZOnMDZVdNEncU5kZQZ MWAWkMN6Y5uZmRQtXE9dxXCxgJo0zHHm0xjguJzmxoxA7GwppFr9zN5qOaxxFNznGxtD nEgg== X-Gm-Message-State: APf1xPBUakJrGKs3qe2Vteh2t6Z2+NcOX+8QR6k6lfFYSsP4SPl7wUyM eoWwJcLQX4HsvIEjcSKhH2f6na00TDw= X-Received: by 10.98.219.129 with SMTP id f123mr901934pfg.195.1519887490479; Wed, 28 Feb 2018 22:58:10 -0800 (PST) Received: from localhost.localdomain ([45.56.152.115]) by smtp.gmail.com with ESMTPSA id p63sm6489867pfk.74.2018.02.28.22.58.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Feb 2018 22:58:10 -0800 (PST) From: Heyi Guo To: edk2-devel@lists.01.org Date: Thu, 1 Mar 2018 14:57:21 +0800 Message-Id: <1519887444-75510-4-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519887444-75510-1-git-send-email-heyi.guo@linaro.org> References: <1519887444-75510-1-git-send-email-heyi.guo@linaro.org> Subject: [edk2] [PATCH v5 3/6] MdeModulePkg/PciHostBridgeLib.h: add address Translation X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heyi Guo MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Add Translation field to PCI_ROOT_BRIDGE_APERTURE. Translation is used to represent the difference between device address and host address, if they are not the same on some platforms. In UEFI 2.7, "Address Translation Offset" is "Offset to apply to the Starting address to convert it to a PCI address". This means: Translation = device address - host address So we also use the above calculation for this Translation field to keep consistent. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Heyi Guo --- MdeModulePkg/Include/Library/PciHostBridgeLib.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdeModulePkg/Include/Library/PciHostBridgeLib.h b/MdeModulePkg/Include/Library/PciHostBridgeLib.h index d42e9ecdd763..18963a0d3821 100644 --- a/MdeModulePkg/Include/Library/PciHostBridgeLib.h +++ b/MdeModulePkg/Include/Library/PciHostBridgeLib.h @@ -20,8 +20,27 @@ // (Base > Limit) indicates an aperture is not available. // typedef struct { + // + // Base and Limit are the device address instead of host address when + // Translation is not zero + // UINT64 Base; UINT64 Limit; + // + // According to UEFI 2.7, Device Address = Host Address + Translation, + // so Translation = Device Address - Host Address. + // On platforms where Translation is not zero, the subtraction is probably to + // be performed with UINT64 wrap-around semantics, for we may translate an + // above-4G host address into a below-4G device address for legacy PCIe device + // compatibility. + // + // NOTE: The alignment of Translation is required to be larger than any BAR + // alignment in the same root bridge, so that the same alignment can be + // applied to both device address and host address, which simplifies the + // situation and makes the current resource allocation code in generic PCI + // host bridge driver still work. + // + UINT64 Translation; } PCI_ROOT_BRIDGE_APERTURE; typedef struct {