From patchwork Thu Feb 25 08:41:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 46226 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 65660B7C48 for ; Thu, 25 Feb 2010 20:05:10 +1100 (EST) Received: from localhost ([127.0.0.1]:44248 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkZZF-0005Jp-I0 for incoming@patchwork.ozlabs.org; Thu, 25 Feb 2010 03:59:33 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NkZHm-0006X3-Fj for qemu-devel@nongnu.org; Thu, 25 Feb 2010 03:41:30 -0500 Received: from [199.232.76.173] (port=52747 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkZHl-0006Wf-1z for qemu-devel@nongnu.org; Thu, 25 Feb 2010 03:41:29 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NkZHk-0007fO-0c for qemu-devel@nongnu.org; Thu, 25 Feb 2010 03:41:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15329) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NkZHj-0007fI-JA for qemu-devel@nongnu.org; Thu, 25 Feb 2010 03:41:27 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1P8fQ9Y018735 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 25 Feb 2010 03:41:26 -0500 Received: from zweiblum.home.kraxel.org (vpn1-7-164.ams2.redhat.com [10.36.7.164]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1P8fPtL006440; Thu, 25 Feb 2010 03:41:26 -0500 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 12B107010F; Thu, 25 Feb 2010 09:41:25 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 25 Feb 2010 09:41:25 +0100 Message-Id: <1267087285-15582-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Izik Eidus , Gerd Hoffmann Subject: [Qemu-devel] [PATCH] adding helper pci functions 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 From: Izik Eidus Signed-off-by: Izik Eidus Signed-off-by: Gerd Hoffmann --- hw/pci.h | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/hw/pci.h b/hw/pci.h index 37ebdc4..20c670e 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -301,11 +301,29 @@ pci_config_set_device_id(uint8_t *pci_config, uint16_t val) } static inline void +pci_config_set_revision(uint8_t *pci_config, uint8_t val) +{ + pci_set_byte(&pci_config[PCI_REVISION_ID], val); +} + +static inline void pci_config_set_class(uint8_t *pci_config, uint16_t val) { pci_set_word(&pci_config[PCI_CLASS_DEVICE], val); } +static inline void +pci_config_set_prog_interface(uint8_t *pci_config, uint8_t val) +{ + pci_set_byte(&pci_config[PCI_CLASS_PROG], val); +} + +static inline void +pci_config_set_interrupt_pin(uint8_t *pci_config, uint8_t val) +{ + pci_set_byte(&pci_config[PCI_INTERRUPT_PIN], val); +} + typedef int (*pci_qdev_initfn)(PCIDevice *dev); typedef struct { DeviceInfo qdev;