From patchwork Sun Sep 19 22:02:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 194012 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8JM3MnD027904 for ; Sun, 19 Sep 2010 22:03:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752241Ab0ISWDV (ORCPT ); Sun, 19 Sep 2010 18:03:21 -0400 Received: from ogre.sisk.pl ([217.79.144.158]:46916 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751924Ab0ISWDU (ORCPT ); Sun, 19 Sep 2010 18:03:20 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id F2D9E1963BF; Sun, 19 Sep 2010 23:41:30 +0200 (CEST) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 13835-04; Sun, 19 Sep 2010 23:41:23 +0200 (CEST) Received: from ferrari.rjw.lan (220-bem-13.acn.waw.pl [82.210.184.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id C63BF195C6E; Sun, 19 Sep 2010 23:41:23 +0200 (CEST) From: "Rafael J. Wysocki" To: Jesse Barnes Subject: [PATCH] PCI / PCIe / AER: Disable native AER service if BIOS has precedence Date: Mon, 20 Sep 2010 00:02:15 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.36-rc4-rjw+; KDE/4.4.4; x86_64; ; ) Cc: LKML , linux-pci@vger.kernel.org, Huang Ying , Hidetoshi Seto , Kenji Kaneshige , Matthew Garrett , ACPI Devel Maling List MIME-Version: 1.0 Message-Id: <201009200002.15609.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sun, 19 Sep 2010 22:03:22 +0000 (UTC) Index: linux-2.6/drivers/pci/pcie/aer/aerdrv_acpi.c =================================================================== --- linux-2.6.orig/drivers/pci/pcie/aer/aerdrv_acpi.c +++ linux-2.6/drivers/pci/pcie/aer/aerdrv_acpi.c @@ -93,4 +93,35 @@ int pcie_aer_get_firmware_first(struct p aer_set_firmware_first(dev); return dev->__aer_firmware_first; } + +static bool aer_firmware_first; + +static int aer_hest_parse_aff(struct acpi_hest_header *hest_hdr, void *data) +{ + if (aer_firmware_first) + return 0; + + switch (hest_hdr->type) { + case ACPI_HEST_TYPE_AER_ROOT_PORT: + case ACPI_HEST_TYPE_AER_ENDPOINT: + case ACPI_HEST_TYPE_AER_BRIDGE: + aer_firmware_first = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST); + default: + return 0; + } +} + +/** + * aer_acpi_firmware_first - Check if APEI should control AER. + */ +bool aer_acpi_firmware_first(void) +{ + static bool parsed = false; + + if (!parsed) { + apei_hest_parse(aer_hest_parse_aff, NULL); + parsed = true; + } + return aer_firmware_first; +} #endif Index: linux-2.6/drivers/pci/pcie/aer/aerdrv.h =================================================================== --- linux-2.6.orig/drivers/pci/pcie/aer/aerdrv.h +++ linux-2.6/drivers/pci/pcie/aer/aerdrv.h @@ -132,6 +132,7 @@ static inline int aer_osc_setup(struct p #ifdef CONFIG_ACPI_APEI extern int pcie_aer_get_firmware_first(struct pci_dev *pci_dev); +extern bool aer_acpi_firmware_first(void); #else static inline int pcie_aer_get_firmware_first(struct pci_dev *pci_dev) { @@ -139,6 +140,8 @@ static inline int pcie_aer_get_firmware_ return pci_dev->__aer_firmware_first; return 0; } + +static inline bool aer_acpi_firmware_first(void) { return false; } #endif static inline void pcie_aer_force_firmware_first(struct pci_dev *pci_dev, Index: linux-2.6/drivers/pci/pcie/aer/aerdrv.c =================================================================== --- linux-2.6.orig/drivers/pci/pcie/aer/aerdrv.c +++ linux-2.6/drivers/pci/pcie/aer/aerdrv.c @@ -416,7 +416,7 @@ static void aer_error_resume(struct pci_ */ static int __init aer_service_init(void) { - if (!pci_aer_available()) + if (!pci_aer_available() || aer_acpi_firmware_first()) return -ENXIO; return pcie_port_service_register(&aerdriver); } Index: linux-2.6/drivers/pci/pcie/portdrv_acpi.c =================================================================== --- linux-2.6.orig/drivers/pci/pcie/portdrv_acpi.c +++ linux-2.6/drivers/pci/pcie/portdrv_acpi.c @@ -49,7 +49,7 @@ int pcie_port_acpi_setup(struct pci_dev | OSC_PCI_EXPRESS_PME_CONTROL; if (pci_aer_available()) { - if (pcie_aer_get_firmware_first(port)) + if (aer_acpi_firmware_first()) dev_dbg(&port->dev, "PCIe errors handled by BIOS.\n"); else flags |= OSC_PCI_EXPRESS_AER_CONTROL;