Commit 094b287f authored by zhlcindy@gmail.com's avatar zhlcindy@gmail.com Committed by Alexander Graf
Browse files

Add USB option in machine options



When -usb option is used, global varible usb_enabled is set.
And all the plaform will create one USB controller according
to this variable. In fact, global varibles make code hard
to read.

So this patch is to remove global variable usb_enabled and
add USB option in machine options. All the plaforms will get
USB option value from machine options.

USB option of machine options will be set either by:
  * -usb
  * -machine type=pseries,usb=on

Both these ways can work now. They both set USB option in
machine options. In the future, the first way will be removed.

Signed-off-by: default avatarLi Zhang <zhlcindy@linux.vnet.ibm.com>
Acked-by: default avatarAlexander Graf <agraf@suse.de>
Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
parent 59de4f98
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1334,8 +1334,9 @@ static void n8x0_init(ram_addr_t ram_size, const char *boot_device,
    n8x0_dss_setup(s);
    n8x0_cbus_setup(s);
    n8x0_uart_setup(s);
    if (usb_enabled)
    if (usb_enabled(false)) {
        n8x0_usb_setup(s);
    }

    if (kernel_filename) {
        /* Or at the linux loader.  */
+1 −1
Original line number Diff line number Diff line
@@ -267,7 +267,7 @@ static void pc_init1(MemoryRegion *system_memory,
    pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
                 floppy, idebus[0], idebus[1], rtc_state);

    if (pci_enabled && usb_enabled) {
    if (pci_enabled && usb_enabled(false)) {
        pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
    }

+7 −12
Original line number Diff line number Diff line
@@ -348,10 +348,6 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
    ide_mem[1] = pmac_ide_init(hd, pic[0x0d], dbdma, 0x16, pic[0x02]);
    ide_mem[2] = pmac_ide_init(&hd[MAX_IDE_DEVS], pic[0x0e], dbdma, 0x1a, pic[0x02]);

    /* cuda also initialize ADB */
    if (machine_arch == ARCH_MAC99_U3) {
        usb_enabled = 1;
    }
    cuda_init(&cuda_mem, pic[0x19]);

    adb_kbd_init(&adb_bus);
@@ -360,16 +356,15 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
    macio_init(pci_bus, PCI_DEVICE_ID_APPLE_UNI_N_KEYL, 0, pic_mem,
               dbdma_mem, cuda_mem, NULL, 3, ide_mem, escc_bar);

    if (usb_enabled) {
    if (usb_enabled(machine_arch == ARCH_MAC99_U3)) {
        pci_create_simple(pci_bus, -1, "pci-ohci");
    }

        /* U3 needs to use USB for input because Linux doesn't support via-cuda
        on PPC64 */
        if (machine_arch == ARCH_MAC99_U3) {
            usbdevice_create("keyboard");
            usbdevice_create("mouse");
        }
    }

    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8)
        graphic_depth = 15;
+1 −1
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ static void ppc_heathrow_init(QEMUMachineInitArgs *args)
    macio_init(pci_bus, PCI_DEVICE_ID_APPLE_343S1201, 1, pic_mem,
               dbdma_mem, cuda_mem, nvr, 2, ide_mem, escc_bar);

    if (usb_enabled) {
    if (usb_enabled(false)) {
        pci_create_simple(pci_bus, -1, "pci-ohci");
    }

+1 −1
Original line number Diff line number Diff line
@@ -661,7 +661,7 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
    memory_region_add_subregion(sysmem, 0xFEFF0000, xcsr);
#endif

    if (usb_enabled) {
    if (usb_enabled(false)) {
        pci_create_simple(pci_bus, -1, "pci-ohci");
    }

Loading