qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 05/15] Make --disable-usb to really remove usb suppo


From: quintela
Subject: [Qemu-devel] [PATCH 05/15] Make --disable-usb to really remove usb support
Date: Tue, 23 Jun 2009 16:14:03 +0200

From: Juan Quintela <address@hidden>


Signed-off-by: Juan Quintela <address@hidden>
---
 Makefile          |    7 ++++++-
 Makefile.target   |    7 ++++++-
 configure         |   34 ++++++++++++++++++++++------------
 hw/nseries.c      |    2 ++
 hw/pc.c           |    2 ++
 hw/ppc_newworld.c |    2 ++
 hw/ppc_oldworld.c |    3 ++-
 hw/ppc_prep.c     |    2 ++
 hw/pxa2xx.c       |    4 ++++
 hw/realview.c     |    2 ++
 hw/usb.h          |    3 +++
 hw/versatilepb.c  |    2 ++
 monitor.c         |    2 ++
 qemu-monitor.hx   |    4 ++++
 qemu-options.hx   |    2 ++
 sysemu.h          |    4 ++++
 vl.c              |   14 +++++++++++---
 17 files changed, 78 insertions(+), 18 deletions(-)

diff --git a/Makefile b/Makefile
index 588523c..c4b41c4 100644
--- a/Makefile
+++ b/Makefile
@@ -102,11 +102,16 @@ OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o 
twl92230.o
 OBJS+=tmp105.o lm832x.o eeprom93xx.o tsc2005.o
 OBJS+=scsi-disk.o cdrom.o
 OBJS+=scsi-generic.o
+ifdef CONFIG_USB
 OBJS+=usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
 OBJS+=usb-serial.o usb-net.o
+endif
 OBJS+=sd.o ssi-sd.o
 ifdef CONFIG_BLUEZ
-OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
+OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o
+ifdef CONFIG_USB
+OBJS+=usb-bt.o
+endif
 OBJS+=bt-hci-csr.o
 endif
 OBJS+=buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o
diff --git a/Makefile.target b/Makefile.target
index 60326fe..878294d 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -565,8 +565,10 @@ ifeq ($(CONFIG_XEN), yes)
   LIBS += $(XEN_LIBS)
 endif

+ifdef CONFIG_USB
 # USB layer
 OBJS+= usb-ohci.o
+endif

 # PCI network cards
 OBJS += eepro100.o
@@ -583,7 +585,10 @@ ifeq ($(TARGET_BASE_ARCH), i386)
 OBJS+= ide.o pckbd.o vga.o $(SOUND_HW) dma.o
 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
 OBJS+= cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
-OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
+ifdef CONFIG_USB
+OBJS+= usb-uhci.o
+endif
+OBJS+= vmmouse.o vmport.o vmware_vga.o hpet.o
 OBJS += device-hotplug.o pci-hotplug.o smbios.o
 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 endif
diff --git a/configure b/configure
index 73c3550..f859065 100755
--- a/configure
+++ b/configure
@@ -191,6 +191,7 @@ nptl="yes"
 mixemu="no"
 bluez="yes"
 kvm="no"
+usb="yes"
 kerneldir=""
 aix="no"
 blobs="yes"
@@ -436,6 +437,8 @@ for opt do
   ;;
   --disable-bluez) bluez="no"
   ;;
+  --disable-usb) usb="no"
+  ;;
   --disable-kvm) kvm="no"
   ;;
   --enable-profiler) profiler="yes"
@@ -627,6 +630,7 @@ echo "  --disable-vnc-sasl       disable SASL encryption 
for VNC server"
 echo "  --disable-curses         disable curses output"
 echo "  --disable-curl           disable curl connectivity"
 echo "  --disable-bluez          disable bluez stack connectivity"
+echo "  --disable-usb            disable usb stack connectivity"
 echo "  --disable-kvm            disable KVM acceleration support"
 echo "  --disable-nptl           disable usermode NPTL support"
 echo "  --enable-system          enable all system emulation targets"
@@ -1449,6 +1453,7 @@ echo -e "KVM support       $kvm"
 echo "fdt support       $fdt"
 echo "preadv support    $preadv"
 echo "bluetooth support $bluez"
+echo "usb support       $usb"

 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -1802,18 +1807,23 @@ fi

 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h

-# USB host support
-case "$usb_host" in
-linux)
-  echo "HOST_USB=linux" >> $config_mak
-;;
-bsd)
-  echo "HOST_USB=bsd" >> $config_mak
-;;
-*)
-  echo "HOST_USB=stub" >> $config_mak
-;;
-esac
+if test "$usb" = "yes" ; then
+  echo "CONFIG_USB=yes" >> $config_mak
+  echo "#define CONFIG_USB 1" >> $config_h
+
+  # USB host support
+  case "$usb_host" in
+  linux)
+    echo "HOST_USB=linux" >> $config_mak
+  ;;
+  bsd)
+    echo "HOST_USB=bsd" >> $config_mak
+  ;;
+  *)
+    echo "HOST_USB=stub" >> $config_mak
+  ;;
+  esac
+fi

 # Determine what linker flags to use to force archive inclusion
 check_linker_flags()
diff --git a/hw/nseries.c b/hw/nseries.c
index b412aa0..55648e1 100644
--- a/hw/nseries.c
+++ b/hw/nseries.c
@@ -1314,8 +1314,10 @@ 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);
+#ifdef CONFIG_USB
     if (usb_enabled)
         n8x0_usb_setup(s);
+#endif

     /* Setup initial (reset) machine state */

diff --git a/hw/pc.c b/hw/pc.c
index 86e5cfe..7e2ff41 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1119,9 +1119,11 @@ static void pc_init1(ram_addr_t ram_size,

     cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd);

+#ifdef CONFIG_USB
     if (pci_enabled && usb_enabled) {
         usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);
     }
+#endif

     if (pci_enabled && acpi_enabled) {
         uint8_t *eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this 
persistent */
diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c
index a1057b4..ae70842 100644
--- a/hw/ppc_newworld.c
+++ b/hw/ppc_newworld.c
@@ -331,9 +331,11 @@ static void ppc_core99_init (ram_addr_t ram_size,
                dbdma_mem_index, cuda_mem_index, NULL, 0, NULL,
                escc_mem_index);

+#ifdef CONFIG_USB
     if (usb_enabled) {
         usb_ohci_init_pci(pci_bus, 3, -1);
     }
+#endif

     if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8)
         graphic_depth = 15;
diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index 686e81f..6b94111 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -365,10 +365,11 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
                dbdma_mem_index, cuda_mem_index, nvr, 2, ide_mem_index,
                escc_mem_index);

+#ifdef CONFIG_USB
     if (usb_enabled) {
         usb_ohci_init_pci(pci_bus, 3, -1);
     }
-
+#endif
     if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8)
         graphic_depth = 15;

diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
index b6f19a5..cd1cc12 100644
--- a/hw/ppc_prep.c
+++ b/hw/ppc_prep.c
@@ -738,9 +738,11 @@ static void ppc_prep_init (ram_addr_t ram_size,
     cpu_register_physical_memory(0xFEFF0000, 0x1000, PPC_io_memory);
 #endif

+#ifdef CONFIG_USB
     if (usb_enabled) {
         usb_ohci_init_pci(pci_bus, 3, -1);
     }
+#endif

     m48t59 = m48t59_init(i8259[8], 0, 0x0074, NVRAM_SIZE, 59);
     if (m48t59 == NULL)
diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c
index f2e98ff..26da459 100644
--- a/hw/pxa2xx.c
+++ b/hw/pxa2xx.c
@@ -2121,9 +2121,11 @@ PXA2xxState *pxa270_init(unsigned int sdram_size, const 
char *revision)
         s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi");
     }

+#ifdef CONFIG_USB
     if (usb_enabled) {
         usb_ohci_init_pxa(0x4c000000, 3, -1, s->pic[PXA2XX_PIC_USBH1]);
     }
+#endif

     s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000);
     s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000);
@@ -2233,9 +2235,11 @@ PXA2xxState *pxa255_init(unsigned int sdram_size)
         s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi");
     }

+#ifdef CONFIG_USB
     if (usb_enabled) {
         usb_ohci_init_pxa(0x4c000000, 3, -1, s->pic[PXA2XX_PIC_USBH1]);
     }
+#endif

     s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000);
     s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000);
diff --git a/hw/realview.c b/hw/realview.c
index 8e176b9..fd78875 100644
--- a/hw/realview.c
+++ b/hw/realview.c
@@ -110,9 +110,11 @@ static void realview_init(ram_addr_t ram_size,
     dev = sysbus_create_varargs("realview_pci", 0x60000000,
                                 pic[48], pic[49], pic[50], pic[51], NULL);
     pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci");
+#ifdef CONFIG_USB
     if (usb_enabled) {
         usb_ohci_init_pci(pci_bus, 3, -1);
     }
+#endif
     n = drive_get_max_bus(IF_SCSI);
     while (n >= 0) {
         pci_create_simple(pci_bus, -1, "lsi53c895a");
diff --git a/hw/usb.h b/hw/usb.h
index e9d4bc2..9ab3d0e 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -22,6 +22,8 @@
  * THE SOFTWARE.
  */

+
+#ifdef CONFIG_USB
 #include "block.h"

 #define USB_TOKEN_SETUP 0x2d
@@ -297,3 +299,4 @@ MUSBState *musb_init(qemu_irq *irqs);
 uint32_t musb_core_intr_get(MUSBState *s);
 void musb_core_intr_clear(MUSBState *s, uint32_t mask);
 void musb_set_size(MUSBState *s, int epnum, int size, int is_tx);
+#endif
diff --git a/hw/versatilepb.c b/hw/versatilepb.c
index 3371121..ff6b279 100644
--- a/hw/versatilepb.c
+++ b/hw/versatilepb.c
@@ -215,9 +215,11 @@ static void versatile_init(ram_addr_t ram_size,
             pci_nic_init(nd, "rtl8139", NULL);
         }
     }
+#ifdef CONFIG_USB
     if (usb_enabled) {
         usb_ohci_init_pci(pci_bus, 3, -1);
     }
+#endif
     n = drive_get_max_bus(IF_SCSI);
     while (n >= 0) {
         pci_create_simple(pci_bus, -1, "lsi53c895a");
diff --git a/monitor.c b/monitor.c
index 6b45f6c..bf88dd1 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1706,10 +1706,12 @@ static const mon_cmd_t info_cmds[] = {
       "", "show KVM information", },
     { "numa", "", do_info_numa,
       "", "show NUMA information", },
+#ifdef CONFIG_USB
     { "usb", "", usb_info,
       "", "show guest USB devices", },
     { "usbhost", "", usb_host_info,
       "", "show host USB devices", },
+#endif
     { "profile", "", do_info_profile,
       "", "show profiling information", },
     { "capture", "", do_info_capture,
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index fa48527..46dce9b 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -347,8 +347,10 @@ STEXI
 Compute the checksum of a memory region.
 ETEXI

+#ifdef CONFIG_USB
     { "usb_add", "s", do_usb_add,
       "device", "add USB device (e.g. 'host:bus.addr' or 
'host:vendor_id:product_id')" },
+#endif
 STEXI
 @item usb_add @var{devname}

@@ -356,8 +358,10 @@ Add the USB device @var{devname}.  For details of 
available devices see
 @ref{usb_devices}
 ETEXI

+#ifdef CONFIG_USB
     { "usb_del", "s", do_usb_del,
       "device", "remove USB device 'bus.addr'" },
+#endif
 STEXI
 @item usb_del @var{devname}

diff --git a/qemu-options.hx b/qemu-options.hx
index 503da33..c765869 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -312,6 +312,7 @@ STEXI
 @end table
 ETEXI

+#ifdef CONFIG_USB
 DEF("usb", 0, QEMU_OPTION_usb,
     "-usb            enable the USB driver (will be the default soon)\n")
 STEXI
@@ -324,6 +325,7 @@ ETEXI

 DEF("usbdevice", HAS_ARG, QEMU_OPTION_usbdevice,
     "-usbdevice name add the host or guest USB device 'name'\n")
+#endif
 STEXI

 @item -usbdevice @var{devname}
diff --git a/sysemu.h b/sysemu.h
index d77de09..a6ede0c 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -115,7 +115,9 @@ extern const char *keyboard_layout;
 extern int win2k_install_hack;
 extern int rtc_td_hack;
 extern int alt_grab;
+#ifdef CONFIG_USB
 extern int usb_enabled;
+#endif
 extern int no_virtio_balloon;
 extern int smp_cpus;
 extern int cursor_hide;
@@ -267,9 +269,11 @@ struct soundhw {
 extern struct soundhw soundhw[];
 #endif

+#ifdef CONFIG_USB
 void do_usb_add(Monitor *mon, const char *devname);
 void do_usb_del(Monitor *mon, const char *devname);
 void usb_info(Monitor *mon);
+#endif

 int get_param_value(char *buf, int buf_size,
                     const char *tag, const char *str);
diff --git a/vl.c b/vl.c
index 914c907..e1ead85 100644
--- a/vl.c
+++ b/vl.c
@@ -238,7 +238,9 @@ CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
 int win2k_install_hack = 0;
 int rtc_td_hack = 0;
 #endif
+#ifdef CONFIG_USB
 int usb_enabled = 0;
+#endif
 int singlestep = 0;
 int smp_cpus = 1;
 const char *vnc_display;
@@ -2619,6 +2621,7 @@ static void numa_add(const char *optarg)
     return;
 }

+#ifdef CONFIG_USB
 /***********************************************************/
 /* USB devices */

@@ -2828,6 +2831,7 @@ void usb_info(Monitor *mon)
                        0, dev->addr, speed_str, dev->devname);
     }
 }
+#endif

 /***********************************************************/
 /* PCMCIA/Cardbus */
@@ -4989,8 +4993,10 @@ int main(int argc, char **argv, char **envp)
     const char *loadvm = NULL;
     QEMUMachine *machine;
     const char *cpu_model;
+#ifdef CONFIG_USB
     const char *usb_devices[MAX_USB_CMDLINE];
-    int usb_devices_index;
+    int usb_devices_index = 0;
+#endif
 #ifndef _WIN32
     int fds[2];
 #endif
@@ -5070,8 +5076,6 @@ int main(int argc, char **argv, char **envp)
         node_cpumask[i] = 0;
     }

-    usb_devices_index = 0;
-
     nb_net_clients = 0;
     nb_bt_opts = 0;
     nb_drives = 0;
@@ -5561,6 +5565,7 @@ int main(int argc, char **argv, char **envp)
 #endif
                 break;
 #endif
+#ifdef CONFIG_USB
             case QEMU_OPTION_usb:
                 usb_enabled = 1;
                 break;
@@ -5573,6 +5578,7 @@ int main(int argc, char **argv, char **envp)
                 usb_devices[usb_devices_index] = optarg;
                 usb_devices_index++;
                 break;
+#endif
             case QEMU_OPTION_smp:
                 smp_cpus = atoi(optarg);
                 if (smp_cpus < 1) {
@@ -6080,6 +6086,7 @@ int main(int argc, char **argv, char **envp)
         }
     }

+#ifdef CONFIG_USB
     /* init USB devices */
     if (usb_enabled) {
         for(i = 0; i < usb_devices_index; i++) {
@@ -6089,6 +6096,7 @@ int main(int argc, char **argv, char **envp)
             }
         }
     }
+#endif

     if (!display_state)
         dumb_display_init();
-- 
1.6.2.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]