From patchwork Thu Dec 13 09:19:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 205790 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D04462C0089 for ; Thu, 13 Dec 2012 20:45:18 +1100 (EST) Received: from localhost ([::1]:48921 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tj4y4-0005Oz-Vt for incoming@patchwork.ozlabs.org; Thu, 13 Dec 2012 04:20:36 -0500 Received: from eggs.gnu.org ([208.118.235.92]:37128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tj4xc-0004Qm-LP for qemu-devel@nongnu.org; Thu, 13 Dec 2012 04:20:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tj4xa-000493-Cg for qemu-devel@nongnu.org; Thu, 13 Dec 2012 04:20:08 -0500 Received: from mail-ia0-f173.google.com ([209.85.210.173]:38994) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tj4xa-00046n-6O for qemu-devel@nongnu.org; Thu, 13 Dec 2012 04:20:06 -0500 Received: by mail-ia0-f173.google.com with SMTP id w21so1788920iac.4 for ; Thu, 13 Dec 2012 01:20:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=glo3gk1vvav19/xt2QiPSPsvJ9nQd5vDFSwa4ATJ+hY=; b=ntW40MZrw5MZ5X6/xFVqLG8+bMAULtv9e+HF5k4oXGNvwrTQBXypHedHYYc61vSi8n XXVl/xBFYHaUkcKCa43G8sTPLcZpbiLZ3dyrEtwPrYNRkhRGSVtr1aRt4lbFBAwed/2U GIUuFwUSbqxdouQvzhCh7WhVuk4sWmkjHwZwsXR8xkmQlhzrWMd71jT3YXrJBnFU8Y7O ivrRoxG7jAKpcr9dBANxgJnpwdofkbFWbbfwBsUb2xT8AQiZht1ia/Q2NgfxL3TIXoKk s6B1CPTbUzBuB87rnxkGNTci9EUaklEJf14QqwOUS88UrKFZ+0sIJG2fZDT/T4yiRXhy kx9w== Received: by 10.50.194.196 with SMTP id hy4mr969782igc.52.1355390405427; Thu, 13 Dec 2012 01:20:05 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-219-150.ip51.fastwebnet.it. [93.34.219.150]) by mx.google.com with ESMTPS id px5sm3925141igc.0.2012.12.13.01.19.58 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Dec 2012 01:19:59 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 13 Dec 2012 10:19:38 +0100 Message-Id: <1355390378-16692-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.0.2 In-Reply-To: <1355390378-16692-1-git-send-email-pbonzini@redhat.com> References: <1355390378-16692-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.210.173 Cc: mst@redhat.com Subject: [Qemu-devel] [PATCH v2 5/5] pci: use constants for devices under the 1B36 device ID, document them X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Paolo Bonzini --- docs/specs/pci-ids.txt | 15 +++++++++++++++ hw/pci.h | 7 +++++++ hw/pci_bridge_dev.c | 8 ++------ hw/serial-pci.c | 12 ++++++------ 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/docs/specs/pci-ids.txt b/docs/specs/pci-ids.txt index e76b196..3c65e1a 100644 --- a/docs/specs/pci-ids.txt +++ b/docs/specs/pci-ids.txt @@ -33,3 +33,18 @@ maintained as part of the virtio specification. 1af4:1110 ivshmem device (shared memory, docs/specs/ivshmem_device_spec.txt) All other device IDs are reserved. + +1b36 vendor ID +-------------- + +The 0000 -> 00ff device ID range is used as follows for QEMU-specific +PCI devices (other than virtio): + +1b36:0001 PCI-PCI bridge +1b36:0002 PCI serial port (16550A) adapter (docs/specs/pci-serial.txt) +1b36:0003 PCI Dual-port 16550A adapter (docs/specs/pci-serial.txt) +1b36:0004 PCI Quad-port 16550A adapter (docs/specs/pci-serial.txt) + +All these devices are documented in docs/specs. + +The 0100 device ID is used for the QXL video card device. diff --git a/hw/pci.h b/hw/pci.h index 0719521..4b2a09b 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -79,6 +79,13 @@ #define PCI_DEVICE_ID_VIRTIO_RNG 0x1005 #define PCI_DEVICE_ID_VIRTIO_9P 0x1009 +#define PCI_VENDOR_ID_REDHAT 0x1b36 +#define PCI_DEVICE_ID_REDHAT_BRIDGE 0x0001 +#define PCI_DEVICE_ID_REDHAT_SERIAL 0x0002 +#define PCI_DEVICE_ID_REDHAT_SERIAL2 0x0003 +#define PCI_DEVICE_ID_REDHAT_SERIAL4 0x0004 +#define PCI_DEVICE_ID_REDHAT_QXL 0x0100 + #define FMT_PCIBUS PRIx64 typedef void PCIConfigWriteFunc(PCIDevice *pci_dev, diff --git a/hw/pci_bridge_dev.c b/hw/pci_bridge_dev.c index f706396..d72bd3d 100644 --- a/hw/pci_bridge_dev.c +++ b/hw/pci_bridge_dev.c @@ -27,10 +27,6 @@ #include "memory.h" #include "pci_internals.h" -#define REDHAT_PCI_VENDOR_ID 0x1b36 -#define PCI_BRIDGE_DEV_VENDOR_ID REDHAT_PCI_VENDOR_ID -#define PCI_BRIDGE_DEV_DEVICE_ID 0x1 - struct PCIBridgeDev { PCIBridge bridge; MemoryRegion bar; @@ -146,8 +142,8 @@ static void pci_bridge_dev_class_init(ObjectClass *klass, void *data) k->init = pci_bridge_dev_initfn; k->exit = pci_bridge_dev_exitfn; k->config_write = pci_bridge_dev_write_config; - k->vendor_id = PCI_BRIDGE_DEV_VENDOR_ID; - k->device_id = PCI_BRIDGE_DEV_DEVICE_ID; + k->vendor_id = PCI_VENDOR_ID_REDHAT; + k->device_id = PCI_DEVICE_ID_REDHAT_BRIDGE; k->class_id = PCI_CLASS_BRIDGE_PCI; k->is_bridge = 1, dc->desc = "Standard PCI Bridge"; diff --git a/hw/serial-pci.c b/hw/serial-pci.c index 95dc5c8..f7be5fd 100644 --- a/hw/serial-pci.c +++ b/hw/serial-pci.c @@ -185,8 +185,8 @@ static void serial_pci_class_initfn(ObjectClass *klass, void *data) PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass); pc->init = serial_pci_init; pc->exit = serial_pci_exit; - pc->vendor_id = 0x1b36; /* Red Hat */ - pc->device_id = 0x0002; + pc->vendor_id = PCI_VENDOR_ID_REDHAT; + pc->device_id = PCI_DEVICE_ID_REDHAT_SERIAL; pc->revision = 1; pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL; dc->vmsd = &vmstate_pci_serial; @@ -199,8 +199,8 @@ static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *data) PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass); pc->init = multi_serial_pci_init; pc->exit = multi_serial_pci_exit; - pc->vendor_id = 0x1b36; /* Red Hat */ - pc->device_id = 0x0003; + pc->vendor_id = PCI_VENDOR_ID_REDHAT; + pc->device_id = PCI_DEVICE_ID_REDHAT_SERIAL2; pc->revision = 1; pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL; dc->vmsd = &vmstate_pci_multi_serial; @@ -213,8 +213,8 @@ static void multi_4x_serial_pci_class_initfn(ObjectClass *klass, void *data) PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass); pc->init = multi_serial_pci_init; pc->exit = multi_serial_pci_exit; - pc->vendor_id = 0x1b36; /* Red Hat */ - pc->device_id = 0x0004; + pc->vendor_id = PCI_VENDOR_ID_REDHAT; + pc->device_id = PCI_DEVICE_ID_REDHAT_SERIAL4; pc->revision = 1; pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL; dc->vmsd = &vmstate_pci_multi_serial;