From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AG47ELtn7VkdI8bPo/03o/BDZltkpkCjDBlh47gbmdTpLy6dTg4zSLsXXxhMLfPpEYonRRyVXSV1EA== 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 Cc: Heyi Guo , Yi Li , Ruiyu Ni , Ard Biesheuvel , Star Zeng , Eric Dong , Laszlo Ersek , Michael D Kinney 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: [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: , X-List-Received-Date: Thu, 15 Mar 2018 05:58:55 -0000 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(+) 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 { -- 2.7.4