From patchwork Thu Mar 15 06:04:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 131748 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp703179ljb; Wed, 14 Mar 2018 23:05:20 -0700 (PDT) X-Google-Smtp-Source: AG47ELvw68V4M9saL3bXk7NGYwgwxfMxDmDY1F3HfA568uHoFnCHRmqRKr3QxTkho9yu0BNn/jM8 X-Received: by 10.101.96.141 with SMTP id t13mr5940842pgu.427.1521093920518; Wed, 14 Mar 2018 23:05:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521093920; cv=none; d=google.com; s=arc-20160816; b=JeEvU68el++fDJd1GvTcFkiD1AMSSy+8zVX+yLp5nAnIVQzaXETDL36qQY90DDTDgH DSpZzQ8q9jKRAyJjQHr7NX5r7M1gTIRUqw6oDNZrX4DMJu9xtaUHwlFNK74C3xnLPYew 4PcLXtC1IcF5cARn4nhoQDuCwwRyo7ogLNstNFJhh8VHN+jplR532NjVOubjECkUeD8E uLYa/pXAEb0c9N22jcNgPBxte8ajeQxxsT3ReHIazIpsn2f1zmf6n2GQWhFI5aTOdBh3 /sUs264mM3+J+iI+CNRPPO8Xa8pe8HdY2HRTDU5PegFhpQuPu5GDNvxcjmocJMUGVKv2 GpJw== 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=BZjB6yxIXxaf5mnPnYKlA2dXf6iMhuD69nU3aA4Rtl8=; b=yArSCaOplwpkZtfuSrmoaU0f2oxhJW2GJQa/AKmH+4j7t4NboVROpL16WffB7k2NCN tiku0nsyKNOdUGJz5irgRDgkBfXJeL+vUzFxk0JGjPV2rmC8RIM/INo1ojMZhsWnEjEO 1XVkFDFXdRMQwZJhbxJYy7+lxgt71hRuOwDe5y/Znu6wPxHmIDB8lV4oHx2Jo35EGeGU b+K50idCKuBS8R8CfpzZwe/W1UDe8gQThAKah7bDRwhyA2epUlsdBkLfvpggmV/lxCBx E8xR6/IOp2D1lK4QbHlgANOigpkwM018Djrr1M17OmZLXLw4+eBY8RATngWXZwyo3uRa by6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=S6zV2R5g; 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 g9si3271906pfi.310.2018.03.14.23.05.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Mar 2018 23:05:20 -0700 (PDT) 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=S6zV2R5g; 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 40C402202E4B1; Wed, 14 Mar 2018 22:58:56 -0700 (PDT) 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:c01::241; helo=mail-pl0-x241.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pl0-x241.google.com (mail-pl0-x241.google.com [IPv6:2607:f8b0:400e:c01::241]) (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 AEDBF21E08283 for ; Wed, 14 Mar 2018 22:58:54 -0700 (PDT) Received: by mail-pl0-x241.google.com with SMTP id u13-v6so3171904plq.1 for ; Wed, 14 Mar 2018 23:05:18 -0700 (PDT) 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=33f0/vbuAnA/bRbJS0DhfcvbaWajDYS11I220APWgI0=; b=S6zV2R5gDFkt83eTLw1EsMca0e3h2uqkOAqQ4g9Y2xscYKk8hFKnqckDcmJJPqNXg5 VT7zUPtKwrOqVdcVevdkV0rFGcdNEpPTMwX23NOf/w4hlXjtFcJrARVycWncsI2y0o7g LBYE7+qwr94gH2Ha6w/uLNDZ7NwkGKqkCd+hM= 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=33f0/vbuAnA/bRbJS0DhfcvbaWajDYS11I220APWgI0=; b=HJDPtCp4FBKqCTXZCdd5cVTBwneZdTgztxXx9mbiaOB9r5dd+W1bZRGjs8I9XZ2PZT sbWHOIi0PfszUfHAcay0Ct5rUlaF3Gr++5gUJyeW0uCED7R6VUvAxAWkhcLVwT2JuHd5 oh/1yxl9ecflYx+QFxOm1J2OLt2G1zhlcqP9yXmc3QzqdLHllW6oSdLq8yxbJSv8l/kN NP+l2VRrPElEhT5EXDVXgP1HkXN9FfCa7ttSqQ2WadO9gx2/PzwTrkhszwiKoOe7Qod1 l6B8HaBbvxL+doR485pg8AyAiyix2Nzm0bcI1wHTROnU+oTDiYrIxNANCI0SRJS0aGub HffQ== X-Gm-Message-State: AElRT7HuHEp2JuXR5Mit9t3HOUakE6Cv/9C8kWw8x98/Tec7XUS5ulVX 4LQQ+SuuAYSDwOFX2k9T8Vpsz0udmy8= X-Received: by 2002:a17:902:5a0b:: with SMTP id q11-v6mr6929070pli.199.1521093918048; Wed, 14 Mar 2018 23:05:18 -0700 (PDT) Received: from localhost.localdomain ([45.56.152.100]) by smtp.gmail.com with ESMTPSA id 70sm7436192pgb.86.2018.03.14.23.05.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Mar 2018 23:05:17 -0700 (PDT) From: Heyi Guo To: edk2-devel@lists.01.org Date: Thu, 15 Mar 2018 14:04:00 +0800 Message-Id: <1521093843-48615-4-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521093843-48615-1-git-send-email-heyi.guo@linaro.org> References: <1521093843-48615-1-git-send-email-heyi.guo@linaro.org> Subject: [edk2] [PATCH v7 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: Ruiyu Ni , Yi Li , Eric Dong , Ard Biesheuvel , Heyi Guo , Michael D Kinney , Laszlo Ersek , Star Zeng 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 Signed-off-by: Yi Li Reviewed-by: Ni Ruiyu Cc: Ruiyu Ni Cc: Ard Biesheuvel Cc: Star Zeng Cc: Eric Dong Cc: Laszlo Ersek Cc: Michael D Kinney --- 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 {