From: Isaku Yamahata <yamahata@valinux.co.jp>
To: qemu-devel@nongnu.org
Cc: yamahata@valinux.co.jp
Subject: [Qemu-devel] [PATCH 16/17] pc.c: split out pci device init from pc_init1() into pc_pci_device_init()
Date: Thu, 9 Jul 2009 17:13:19 +0900 [thread overview]
Message-ID: <1247127200-22176-17-git-send-email-yamahata@valinux.co.jp> (raw)
In-Reply-To: <1247127200-22176-1-git-send-email-yamahata@valinux.co.jp>
Split out pci device initialization from pc_init1() into pc_pci_device_init().
and removed unnecessary braces.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pc.c | 71 +++++++++++++++++++++++++++++++--------------------------------
1 files changed, 35 insertions(+), 36 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index c2d5b73..499509a 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1329,6 +1329,40 @@ static void pc_basic_device_init(qemu_irq *i8259,
*floppy_controller = fdctrl_init(i8259[6], 2, 0, 0x3f0, fd);
}
+static void pc_pci_device_init(PCIBus *pci_bus)
+{
+ PCIDevice *pci_dev;
+ int i;
+ int max_bus;
+ int unit_id;
+
+ max_bus = drive_get_max_bus(IF_SCSI);
+ for (i = 0; i <= max_bus; i++) {
+ pci_create_simple(pci_bus, -1, "lsi53c895a");
+ }
+
+ /* Add virtio block devices */
+ unit_id = 0;
+ while ((i = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) {
+ pci_dev = pci_create("virtio-blk-pci", drives_table[i].devaddr);
+ qdev_init(&pci_dev->qdev);
+ unit_id++;
+ }
+
+ /* Add virtio balloon device */
+ if (!virtio_balloon) {
+ pci_dev = pci_create("virtio-balloon-pci", virtio_balloon_devaddr);
+ qdev_init(&pci_dev->qdev);
+ }
+
+ /* Add virtio console devices */
+ for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
+ if (virtcon_hds[i]) {
+ pci_create_simple(pci_bus, -1, "virtio-console-pci");
+ }
+ }
+}
+
/* PC hardware initialisation */
static void pc_init1(ram_addr_t ram_size,
const char *boot_device,
@@ -1339,7 +1373,6 @@ static void pc_init1(ram_addr_t ram_size,
int i;
ram_addr_t below_4g_mem_size, above_4g_mem_size;
PCIBus *pci_bus;
- PCIDevice *pci_dev;
PCIDevice *i440fx_state;
int piix3_devfn = -1;
qemu_irq *cpu_irq;
@@ -1444,41 +1477,7 @@ static void pc_init1(ram_addr_t ram_size,
}
if (pci_enabled) {
- int max_bus;
- int bus;
-
- max_bus = drive_get_max_bus(IF_SCSI);
- for (bus = 0; bus <= max_bus; bus++) {
- pci_create_simple(pci_bus, -1, "lsi53c895a");
- }
- }
-
- /* Add virtio block devices */
- if (pci_enabled) {
- int index;
- int unit_id = 0;
-
- while ((index = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) {
- pci_dev = pci_create("virtio-blk-pci",
- drives_table[index].devaddr);
- qdev_init(&pci_dev->qdev);
- unit_id++;
- }
- }
-
- /* Add virtio balloon device */
- if (pci_enabled && virtio_balloon) {
- pci_dev = pci_create("virtio-balloon-pci", virtio_balloon_devaddr);
- qdev_init(&pci_dev->qdev);
- }
-
- /* Add virtio console devices */
- if (pci_enabled) {
- for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
- if (virtcon_hds[i]) {
- pci_create_simple(pci_bus, -1, "virtio-console-pci");
- }
- }
+ pc_pci_device_init(pci_bus);
}
}
--
1.6.0.2
next prev parent reply other threads:[~2009-07-09 8:15 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-09 8:13 [Qemu-devel] [PATCH 00/17] split out piix specific part from pc emulator. v3 Isaku Yamahata
2009-07-09 8:13 ` [Qemu-devel] [PATCH 01/17] acpi.c: split out pc smbus routines from acpi.c into pc_smbus.c Isaku Yamahata
2009-07-09 8:13 ` [Qemu-devel] [PATCH 02/17] acpi.c: split out apm register emulation Isaku Yamahata
2009-07-09 8:13 ` [Qemu-devel] [PATCH 03/17] acpi.c: make qemu_system_powerdown() piix independent Isaku Yamahata
2009-07-09 8:13 ` [Qemu-devel] [PATCH 04/17] acpi: add acpi constants from linux header files and use them Isaku Yamahata
2009-07-09 8:13 ` [Qemu-devel] [PATCH 05/17] acpi.c: split acpi.c into the common part and the piix4 part Isaku Yamahata
2009-07-09 8:13 ` [Qemu-devel] [PATCH 06/17] pc.c: Make smm enable/disable function i440fx independent Isaku Yamahata
2009-07-09 8:13 ` [Qemu-devel] [PATCH 07/17] pc.c: remove unnecessary global variables, pit and ioapic Isaku Yamahata
2009-07-09 8:13 ` [Qemu-devel] [PATCH 08/17] pc.c: remove a global variable, floppy_controller Isaku Yamahata
2009-07-09 8:13 ` [Qemu-devel] [PATCH 09/17] pc.c: remove a global variable, RTCState *rtc_state Isaku Yamahata
2009-07-09 8:13 ` [Qemu-devel] [PATCH 10/17] pc.c: introduce a function to allocate cpu irq Isaku Yamahata
2009-07-09 8:13 ` [Qemu-devel] [PATCH 11/17] pc.c: make pc_init1() not refer ferr_irq directly Isaku Yamahata
2009-07-09 8:13 ` [Qemu-devel] [PATCH 12/17] pc.c: split out cpu initialization from pc_init1() into pc_cpus_init() Isaku Yamahata
2009-07-09 8:13 ` [Qemu-devel] [PATCH 13/17] pc.c: split out memory allocation from pc_init1() into pc_memory_init() Isaku Yamahata
2009-07-09 8:13 ` [Qemu-devel] [PATCH 14/17] pc.c: split out vga initialization from pc_init1() into pc_vga_init() Isaku Yamahata
2009-07-09 8:13 ` [Qemu-devel] [PATCH 15/17] pc.c: split out basic device init from pc_init1() into pc_basic_device_init() Isaku Yamahata
2009-07-09 8:13 ` Isaku Yamahata [this message]
2009-07-09 8:13 ` [Qemu-devel] [PATCH 17/17] pc.c: split out piix specific part from pc.c into pc_piix.c Isaku Yamahata
-- strict thread matches above, loose matches on Subject: below --
2009-07-17 7:22 [Qemu-devel] [PATCH 00/17] split out piix specific part from pc emulator. V6 Isaku Yamahata
2009-07-17 7:23 ` [Qemu-devel] [PATCH 16/17] pc.c: split out pci device init from pc_init1() into pc_pci_device_init() Isaku Yamahata
2009-07-15 7:19 [Qemu-devel] [PATCH 00/17] split out piix specific part from pc emulator. v5 Isaku Yamahata
2009-07-15 7:19 ` [Qemu-devel] [PATCH 16/17] pc.c: split out pci device init from pc_init1() into pc_pci_device_init() Isaku Yamahata
2009-07-07 6:35 [Qemu-devel] [PATCH 00/17] split out piix specific part from pc emulator. v3 Isaku Yamahata
2009-07-07 6:35 ` [Qemu-devel] [PATCH 16/17] pc.c: split out pci device init from pc_init1() into pc_pci_device_init() Isaku Yamahata
2009-07-03 7:11 [Qemu-devel] [PATCH 00/17] split out piix specific part from pc emulator. v2 Isaku Yamahata
2009-07-03 7:11 ` [Qemu-devel] [PATCH 16/17] pc.c: split out pci device init from pc_init1() into pc_pci_device_init() Isaku Yamahata
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1247127200-22176-17-git-send-email-yamahata@valinux.co.jp \
--to=yamahata@valinux.co.jp \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).