From owner-svn-src-head@FreeBSD.ORG Mon Mar 22 03:06:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 049C0106566B; Mon, 22 Mar 2010 03:06:12 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E87BE8FC14; Mon, 22 Mar 2010 03:06:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2M36Bhg095029; Mon, 22 Mar 2010 03:06:11 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2M36B1h095027; Mon, 22 Mar 2010 03:06:11 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201003220306.o2M36B1h095027@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 22 Mar 2010 03:06:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205432 - head/sys/ia64/pci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2010 03:06:12 -0000 Author: marcel Date: Mon Mar 22 03:06:11 2010 New Revision: 205432 URL: http://svn.freebsd.org/changeset/base/205432 Log: Disable interrupts when calling into SAL for PCI configuration cycles. This serves 2 purposes: 1. It prevents preemption and CPU migration while running SAL code. 2. It reduces the chance of stack overflows: we're supposed to enter SAL with at least 16KB of either memory- or register stack space, which we can't do without switching to a different stack. Modified: head/sys/ia64/pci/pci_cfgreg.c Modified: head/sys/ia64/pci/pci_cfgreg.c ============================================================================== --- head/sys/ia64/pci/pci_cfgreg.c Mon Mar 22 02:01:33 2010 (r205431) +++ head/sys/ia64/pci/pci_cfgreg.c Mon Mar 22 03:06:11 2010 (r205432) @@ -28,6 +28,7 @@ */ #include +#include #include #include @@ -66,6 +67,7 @@ uint32_t pci_cfgregread(int bus, int slot, int func, int reg, int len) { struct ia64_sal_result res; + register_t is; u_long addr; addr = pci_sal_address(0, bus, slot, func, reg); @@ -75,17 +77,18 @@ pci_cfgregread(int bus, int slot, int fu if (!pci_valid_access(reg, len)) return (~0); + is = intr_disable(); res = ia64_sal_entry(SAL_PCI_CONFIG_READ, addr, len, 0, 0, 0, 0, 0); - if (res.sal_status < 0) - return (~0); + intr_restore(is); - return (res.sal_result[0]); + return ((res.sal_status < 0) ? ~0 : res.sal_result[0]); } void pci_cfgregwrite(int bus, int slot, int func, int reg, uint32_t data, int len) { struct ia64_sal_result res; + register_t is; u_long addr; addr = pci_sal_address(0, bus, slot, func, reg); @@ -95,5 +98,7 @@ pci_cfgregwrite(int bus, int slot, int f if (!pci_valid_access(reg, len)) return; + is = intr_disable(); res = ia64_sal_entry(SAL_PCI_CONFIG_WRITE, addr, len, data, 0, 0, 0, 0); + intr_restore(is); }