From patchwork Wed Oct 27 10:21:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 69338 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1D2C1B70E0 for ; Wed, 27 Oct 2010 22:16:35 +1100 (EST) Received: from localhost ([127.0.0.1]:39991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PB3zb-0003c2-Qc for incoming@patchwork.ozlabs.org; Wed, 27 Oct 2010 07:16:31 -0400 Received: from [140.186.70.92] (port=35740 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PB3Q5-0002VD-1u for qemu-devel@nongnu.org; Wed, 27 Oct 2010 06:39:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PB38H-0006DA-I5 for qemu-devel@nongnu.org; Wed, 27 Oct 2010 06:22:52 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:33484) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PB38H-0006CY-7I for qemu-devel@nongnu.org; Wed, 27 Oct 2010 06:21:25 -0400 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id 4660A87403; Wed, 27 Oct 2010 19:21:22 +0900 (JST) Received: (nullmailer pid 27272 invoked by uid 1000); Wed, 27 Oct 2010 10:21:21 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org Date: Wed, 27 Oct 2010 19:21:19 +0900 Message-Id: <67d0f3c8c7775d75654fb2921b7bb05976570bc6.1288174753.git.yamahata@valinux.co.jp> X-Mailer: git-send-email 1.7.1.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: skandasa@cisco.com, adnan@khaleel.us, wexu2@cisco.com, mst@redhat.com, yamahata@valinux.co.jp, etmartin@cisco.com Subject: [Qemu-devel] [PATCH 4/6] pcie/slot: factor out the logic to update hotplug event status. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch factors out the hot plug event logic. Signed-off-by: Isaku Yamahata --- hw/pcie.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/pcie.c b/hw/pcie.c index 37d7457..97d17fa 100644 --- a/hw/pcie.c +++ b/hw/pcie.c @@ -139,9 +139,8 @@ void pcie_cap_deverr_reset(PCIDevice *dev) PCI_EXP_DEVCTL_FERE | PCI_EXP_DEVCTL_URRE); } -static void hotplug_event_notify(PCIDevice *dev) +static void hotplug_event_update_event_status(PCIDevice *dev) { - bool prev = dev->exp.hpev_notified; uint32_t pos = dev->exp.exp_cap; uint8_t *exp_cap = dev->config + pos; uint16_t sltctl = pci_get_word(exp_cap + PCI_EXP_SLTCTL); @@ -149,6 +148,13 @@ static void hotplug_event_notify(PCIDevice *dev) dev->exp.hpev_notified = (sltctl & PCI_EXP_SLTCTL_HPIE) && (sltsta & sltctl & PCI_EXP_HP_EV_SUPPORTED); +} + +static void hotplug_event_notify(PCIDevice *dev) +{ + bool prev = dev->exp.hpev_notified; + + hotplug_event_update_event_status(dev); if (prev == dev->exp.hpev_notified) { return;