From patchwork Tue Feb 27 02:09:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 129728 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp868903lja; Mon, 26 Feb 2018 18:10:45 -0800 (PST) X-Google-Smtp-Source: AH8x227sxGnLAVHQc5XueB+1Ukucnep+CWLO0NZjT1jN+RxeixjC2J9jNgMUbwvrPtoUM4cTBu7b X-Received: by 2002:a17:902:bc85:: with SMTP id bb5-v6mr12916947plb.425.1519697445240; Mon, 26 Feb 2018 18:10:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519697445; cv=none; d=google.com; s=arc-20160816; b=m9ojUWmEl5go2n9JB42wJLfHyji9cJ2GSBqhLItiipIW3eLI8aGyG+O5s0BEvueRW9 Vy3ZAAyeosdKTyx7BaCYbYrEyuc1Ohmxnrb9kkXAQYlU1EyTumkQW5LckyG2Ql4/+xH8 Yjgv7MKKbvVeD4aDa/oaM0164z4uwc0/nUNWeQ6YNLkT1euvlFHPWXw7L+Rok/jbKcia /JowyLuvyC3wDcIGx3GSUdVSEqvh6vXUvBjEWuNletFq1Q/MSzWpwLczCpXqHlXMhkqE yqRnXMEpG+v01IOf1DOJb0X+Z12O3Auc/dj262+pWfx+sIC7dPVYgNDt9t2bXFg/Q1Br qleA== 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:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=3JnElqa6VU7rXEP7QyUC+Y22EvoSTaXgyEE0iqAMyAA=; b=WeBNZqXfsdlkMjPlXp5z+rh8z8B4vxG+5ZNJ1uHmBH01j6gjsQSYgLR/NRt53/wpyE URJjLm+xZXevyRC8CHysEsfspH8kDUfbwmhb6C/EL51WPXPm1tMJjrQaUV25hX3Q4wRX 4CMEIJnX+ScNr4mjBAmgCrhkLfhILUmcjGiK6K5wH6iY7s6pDXnZCXKkS+hcnvJaL28q 4jM1h6CWOnZtWOG/SKqZA78F2rz+MRX24Bps+P5ijf9DxWOkuZqdw2CqPtXozC5WjLoA c2OI4qgJEt8T/Fdm8Y1YCEUvFuZ/69EZM03exvu+oz85E3fNe2EE/D5QueTgmP4ZoL6R /NUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VheHcmNx; 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 p1-v6si7750561pld.80.2018.02.26.18.10.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Feb 2018 18:10:45 -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=VheHcmNx; 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 AC2FF2034D8DE; Mon, 26 Feb 2018 18:04:38 -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:c01::243; helo=mail-pl0-x243.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::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 291B8209574EF for ; Mon, 26 Feb 2018 18:04:37 -0800 (PST) Received: by mail-pl0-x243.google.com with SMTP id bb3so10472903plb.2 for ; Mon, 26 Feb 2018 18:10:42 -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; bh=0mcGucF8lG+T0nZ43SfAC2sNgO+JNbaaTJnMFPx7+48=; b=VheHcmNxCkRlUaPkx7Po3r/qvgFXfdJSF1Yr6MnNnrBrtcK94Mm1xB0DjxSU5O8MCi fmCI65NQ/M+e1F8dbgEB34nu0u0cPvvcT0Y6X16J4WBvGRo/oB9rJF1sWu95SNqQa43U oDMp1U4oKKYDK7M/2XtotPTQoGLPnCAA5uG4E= 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; bh=0mcGucF8lG+T0nZ43SfAC2sNgO+JNbaaTJnMFPx7+48=; b=q8NWjlJtQaYRvKs9MQq0Nd4APcjQzHmL4+W+cgpNruibFFfjhkD3E21M9JejqmWU7l xhue8bJtEC62tLmH+DZUuh8TcV4yiLU5Iob751fWnTmOEucu2/jexnZ/Xcw1xZ863AqF TAzygqSCLRTc39ru/c5at/3ByEr/eiyIdTODqv2hL+b//cb9Sn+kx6O6N1fnc093wkkV TKvU2+IPggc8HoNRspdx4GMz1AQvhNyAKATcamap2OpaDuV3l+Q7yJf5OubLAVRg7Td1 kJFxq3bpIY/jmHKXoTazC40EjnkGc8aBSIljx9k2Idg6915CqFgxo3iVqUGUkdpn4oNL hbsw== X-Gm-Message-State: APf1xPBPSLlxN2mNQhJiQyh7GJsv0zWZygHbGP3xcJwRmu7G6F96Qcko kIycnzpkQselayv94RB8Q/vFMfRPUco= X-Received: by 2002:a17:902:2863:: with SMTP id e90-v6mr12495191plb.232.1519697442239; Mon, 26 Feb 2018 18:10:42 -0800 (PST) Received: from localhost.localdomain ([104.237.91.49]) by smtp.gmail.com with ESMTPSA id a138sm21289210pfd.47.2018.02.26.18.10.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Feb 2018 18:10:41 -0800 (PST) From: Heyi Guo To: edk2-devel@lists.01.org Date: Tue, 27 Feb 2018 10:09:46 +0800 Message-Id: <1519697389-3525-1-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [RFC v4 0/3] Add translation support to generic PciHostBridge 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 , 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" Please note: this is still *RFC* version, so we have not gone thru all the code in EDK2 for applying the change of PciSegmentLib definition. v4: - Modify the code according to the comments from Ray, Laszlo and Ard (Please see the notes of Patch 1/3) - Ignore translation of bus in CreateRootBridge. v3: - Keep definition of Translation consistent in EDKII code: Translation = device address - host address. - Patch 2/2 is split into 2 patches (2/3 and 3/3). - Refine comments and commit messages to make the code easier to understand. v2: Changs are made according to the discussion on the mailing list, including: - PciRootBridgeIo->Configuration should return CPU view address, as well as PciIo->GetBarAttributes, and Translation Offset should be equal to PCI view address - CPU view address. - Add translation offset to PCI_ROOT_BRIDGE_APERTURE structure definition. - PciHostBridge driver internally used Base Address is still based on PCI view address, and translation offset = CPU view - PCI view, which follows the definition in ACPI, and not the same as that in UEFI spec. Cc: Ruiyu Ni Cc: Ard Biesheuvel Cc: Star Zeng Cc: Eric Dong Cc: Laszlo Ersek Cc: Michael D Kinney Heyi Guo (3): MdeModulePkg/PciHostBridgeDxe: Add support for address translation MdeModulePkg/PciBus: convert host address to device address MdeModulePkg/PciBus: return CPU address for GetBarAttributes MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostResource.h | 2 + MdeModulePkg/Include/Library/PciHostBridgeLib.h | 14 +++ MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c | 12 +- MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c | 85 +++++++++++--- MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c | 122 +++++++++++++++++--- 5 files changed, 204 insertions(+), 31 deletions(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel