From 53b8decc81aeafe6673040607225ad3cbc83e4f9 Mon Sep 17 00:00:00 2001 From: Son Hyunjun Date: Thu, 8 Mar 2012 20:56:32 +0900 Subject: [PATCH] modify vga-pci --- hw/vga-pci.c | 99 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 49 insertions(+), 50 deletions(-) diff --git a/hw/vga-pci.c b/hw/vga-pci.c index 8d52662..f5e0f37 100644 --- a/hw/vga-pci.c +++ b/hw/vga-pci.c @@ -28,45 +28,43 @@ #include "pixel_ops.h" #include "qemu-timer.h" #include "loader.h" +#include "vga_int.h" #ifdef CONFIG_MARU #include "../tizen/src/hw/maru_pci_ids.h" #include "../tizen/src/hw/maru_vga_int.h" #endif -#include "vga_int.h" - -#ifdef CONFIG_MARU -typedef struct MaruPCIVGAState { +typedef struct PCIVGAState { PCIDevice dev; - MaruVGACommonState vga; -} MaruPCIVGAState; + VGACommonState vga; +} PCIVGAState; -int pci_maru_vga_init(PCIBus *bus) +int pci_vga_init(PCIBus *bus) { - pci_create_simple(bus, -1, "MARU_VGA"); + pci_create_simple(bus, -1, "VGA"); return 0; } -static const VMStateDescription maru_vmstate_vga_pci = { +static const VMStateDescription vmstate_vga_pci = { .name = "vga", .version_id = 2, .minimum_version_id = 2, .minimum_version_id_old = 2, .fields = (VMStateField []) { - VMSTATE_PCI_DEVICE(dev, MaruPCIVGAState), - VMSTATE_STRUCT(vga, MaruPCIVGAState, 0, maru_vmstate_vga_common, MaruVGACommonState), + VMSTATE_PCI_DEVICE(dev, PCIVGAState), + VMSTATE_STRUCT(vga, PCIVGAState, 0, vmstate_vga_common, VGACommonState), VMSTATE_END_OF_LIST() } }; -static int pci_maru_vga_initfn(PCIDevice *dev) +static int pci_vga_initfn(PCIDevice *dev) { - MaruPCIVGAState *d = DO_UPCAST(MaruPCIVGAState, dev, dev); - MaruVGACommonState *s = &d->vga; + PCIVGAState *d = DO_UPCAST(PCIVGAState, dev, dev); + VGACommonState *s = &d->vga; // vga + console init - maru_vga_common_init(s, VGA_RAM_SIZE); - maru_vga_init(s, pci_address_space(dev), pci_address_space_io(dev), true); + vga_common_init(s, VGA_RAM_SIZE); + vga_init(s, pci_address_space(dev), pci_address_space_io(dev), true); s->ds = graphic_console_init(s->update, s->invalidate, s->screen_dump, s->text_update, s); @@ -76,59 +74,59 @@ static int pci_maru_vga_initfn(PCIDevice *dev) if (!dev->rom_bar) { /* compatibility with pc-0.13 and older */ - maru_vga_init_vbe(s, pci_address_space(dev)); + vga_init_vbe(s, pci_address_space(dev)); } return 0; } -static PCIDeviceInfo maru_vga_info = { - .qdev.name = "MARU_VGA", - .qdev.size = sizeof(MaruPCIVGAState), - .qdev.vmsd = &maru_vmstate_vga_pci, +static PCIDeviceInfo vga_info = { + .qdev.name = "VGA", + .qdev.size = sizeof(PCIVGAState), + .qdev.vmsd = &vmstate_vga_pci, .no_hotplug = 1, - .init = pci_maru_vga_initfn, - .romfile = "vgabios-maruvga.bin", + .init = pci_vga_initfn, + .romfile = "vgabios-stdvga.bin", /* dummy VGA (same as Bochs ID) */ - .vendor_id = PCI_VENDOR_ID_TIZEN, - .device_id = PCI_DEVICE_ID_VIRTUAL_VGA, + .vendor_id = PCI_VENDOR_ID_QEMU, + .device_id = PCI_DEVICE_ID_QEMU_VGA, .class_id = PCI_CLASS_DISPLAY_VGA, }; -#endif // CONFIG_MARU +#ifdef CONFIG_MARU -typedef struct PCIVGAState { +typedef struct MaruPCIVGAState { PCIDevice dev; - VGACommonState vga; -} PCIVGAState; + MaruVGACommonState vga; +} MaruPCIVGAState; -int pci_vga_init(PCIBus *bus) +int pci_maru_vga_init(PCIBus *bus) { - pci_create_simple(bus, -1, "VGA"); + pci_create_simple(bus, -1, "MARU_VGA"); return 0; } -static const VMStateDescription vmstate_vga_pci = { +static const VMStateDescription maru_vmstate_vga_pci = { .name = "vga", .version_id = 2, .minimum_version_id = 2, .minimum_version_id_old = 2, .fields = (VMStateField []) { - VMSTATE_PCI_DEVICE(dev, PCIVGAState), - VMSTATE_STRUCT(vga, PCIVGAState, 0, vmstate_vga_common, VGACommonState), + VMSTATE_PCI_DEVICE(dev, MaruPCIVGAState), + VMSTATE_STRUCT(vga, MaruPCIVGAState, 0, maru_vmstate_vga_common, MaruVGACommonState), VMSTATE_END_OF_LIST() } }; -static int pci_vga_initfn(PCIDevice *dev) +static int pci_maru_vga_initfn(PCIDevice *dev) { - PCIVGAState *d = DO_UPCAST(PCIVGAState, dev, dev); - VGACommonState *s = &d->vga; + MaruPCIVGAState *d = DO_UPCAST(MaruPCIVGAState, dev, dev); + MaruVGACommonState *s = &d->vga; // vga + console init - vga_common_init(s, VGA_RAM_SIZE); - vga_init(s, pci_address_space(dev), pci_address_space_io(dev), true); + maru_vga_common_init(s, VGA_RAM_SIZE); + maru_vga_init(s, pci_address_space(dev), pci_address_space_io(dev), true); s->ds = graphic_console_init(s->update, s->invalidate, s->screen_dump, s->text_update, s); @@ -138,32 +136,33 @@ static int pci_vga_initfn(PCIDevice *dev) if (!dev->rom_bar) { /* compatibility with pc-0.13 and older */ - vga_init_vbe(s, pci_address_space(dev)); + maru_vga_init_vbe(s, pci_address_space(dev)); } return 0; } -static PCIDeviceInfo vga_info = { - .qdev.name = "VGA", - .qdev.size = sizeof(PCIVGAState), - .qdev.vmsd = &vmstate_vga_pci, +static PCIDeviceInfo maru_vga_info = { + .qdev.name = "MARU_VGA", + .qdev.size = sizeof(MaruPCIVGAState), + .qdev.vmsd = &maru_vmstate_vga_pci, .no_hotplug = 1, - .init = pci_vga_initfn, - .romfile = "vgabios-stdvga.bin", + .init = pci_maru_vga_initfn, + .romfile = "vgabios-maruvga.bin", /* dummy VGA (same as Bochs ID) */ - .vendor_id = PCI_VENDOR_ID_QEMU, - .device_id = PCI_DEVICE_ID_QEMU_VGA, + .vendor_id = PCI_VENDOR_ID_TIZEN, + .device_id = PCI_DEVICE_ID_VIRTUAL_VGA, .class_id = PCI_CLASS_DISPLAY_VGA, }; +#endif // CONFIG_MARU + static void vga_register(void) { + pci_qdev_register(&vga_info); #ifdef CONFIG_MARU pci_qdev_register(&maru_vga_info); -#else - pci_qdev_register(&vga_info); #endif } device_init(vga_register); -- 2.7.4