Skip to contentSkip to conversation

usb: reorganize source files.

RFC PATCH In review Gerd Hoffmann 6 participants 14 messages Mar 8, 2012 – Mar 9, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

cover usb: reorganize source files.

Hi,

Plan is basically to move all usb stuff to hw/usb/

Comments?

cheers,
Gerd

Gerd Hoffmann (2):
usb: the big rename
usb: zap hw/ush-{ohic,uhci}.h + init wrappers

 Makefile.objs                          |   22 ++++++++++++----------
 Makefile.target                        |    2 +-
 configure                              |    4 +++-
 hw/alpha_sys.h                         |    1 -
 hw/pc_piix.c                           |    4 +---
 hw/ppc_newworld.c                      |    3 +--
 hw/ppc_oldworld.c                      |    3 +--
 hw/ppc_prep.c                          |    3 +--
 hw/realview.c                          |    3 +--
 hw/usb-ohci.h                          |    9 ---------
 hw/usb-uhci.h                          |   10 ----------
 hw/{usb-bus.c => usb/bus.c}            |    6 +++---
 hw/{usb.c => usb/core.c}               |    2 +-
 hw/{usb-desc.c => usb/desc.c}          |    4 ++--
 hw/{usb-desc.h => usb/desc.h}          |    0
 hw/{usb-audio.c => usb/dev-audio.c}    |    8 ++++----
 hw/{usb-bt.c => usb/dev-bluetooth.c}   |    6 +++---
 hw/{usb-hid.c => usb/dev-hid.c}        |    8 ++++----
 hw/{usb-hub.c => usb/dev-hub.c}        |    4 ++--
 hw/{usb-net.c => usb/dev-network.c}    |    4 ++--
 hw/{usb-serial.c => usb/dev-serial.c}  |    4 ++--
 hw/{usb-ccid.c => usb/dev-smartcard.c} |    0
 hw/{usb-msd.c => usb/dev-storage.c}    |    6 +++---
 hw/{usb-wacom.c => usb/dev-wacom.c}    |    6 +++---
 hw/{usb-ehci.c => usb/hcd-ehci.c}      |    6 +++---
 hw/{usb-musb.c => usb/hcd-musb.c}      |    6 +++---
 hw/{usb-ohci.c => usb/hcd-ohci.c}      |   16 +++++-----------
 hw/{usb-uhci.c => usb/hcd-uhci.c}      |   22 +++-------------------
 hw/{usb-xhci.c => usb/hcd-xhci.c}      |   10 +++++-----
 usb-bsd.c => hw/usb/host-bsd.c         |    0
 usb-linux.c => hw/usb/host-linux.c     |    0
 usb-stub.c => hw/usb/host-stub.c       |    0
 hw/{usb-libhw.c => usb/libhw.c}        |    2 +-
 usb-redir.c => hw/usb/redirect.c       |    0
 hw/versatilepb.c                       |    3 +--
 35 files changed, 71 insertions(+), 116 deletions(-)
 delete mode 100644 hw/usb-ohci.h
 delete mode 100644 hw/usb-uhci.h
 rename hw/{usb-bus.c => usb/bus.c} (99%)
 rename hw/{usb.c => usb/core.c} (99%)
 rename hw/{usb-desc.c => usb/desc.c} (99%)
 rename hw/{usb-desc.h => usb/desc.h} (100%)
 rename hw/{usb-audio.c => usb/dev-audio.c} (99%)
 rename hw/{usb-bt.c => usb/dev-bluetooth.c} (99%)
 rename hw/{usb-hid.c => usb/dev-hid.c} (99%)
 rename hw/{usb-hub.c => usb/dev-hub.c} (99%)
 rename hw/{usb-net.c => usb/dev-network.c} (99%)
 rename hw/{usb-serial.c => usb/dev-serial.c} (99%)
 rename hw/{usb-ccid.c => usb/dev-smartcard.c} (100%)
 rename hw/{usb-msd.c => usb/dev-storage.c} (99%)
 rename hw/{usb-wacom.c => usb/dev-wacom.c} (99%)
 rename hw/{usb-ehci.c => usb/hcd-ehci.c} (99%)
 rename hw/{usb-musb.c => usb/hcd-musb.c} (99%)
 rename hw/{usb-ohci.c => usb/hcd-ohci.c} (99%)
 rename hw/{usb-uhci.c => usb/hcd-uhci.c} (98%)
 rename hw/{usb-xhci.c => usb/hcd-xhci.c} (99%)
 rename usb-bsd.c => hw/usb/host-bsd.c (100%)
 rename usb-linux.c => hw/usb/host-linux.c (100%)
 rename usb-stub.c => hw/usb/host-stub.c (100%)
 rename hw/{usb-libhw.c => usb/libhw.c} (99%)
 rename usb-redir.c => hw/usb/redirect.c (100%)
#1 lore raw

RFC PATCH 1/2 usb: the big rename

Reorganize usb source files. Create a new hw/usb/ directory and move all usb source code to that place. Also make filenames a bit more descriptive. Host adapters are prefixed with "hch-" now, usb device emulations are prefixed with "dev-". Fixup paths Makefile and include paths to make it compile. No code changes.

---
 Makefile.objs                          |   22 ++++++++++++----------
 Makefile.target                        |    2 +-
 configure                              |    4 +++-
 hw/{usb-bus.c => usb/bus.c}            |    6 +++---
 hw/{usb.c => usb/core.c}               |    2 +-
 hw/{usb-desc.c => usb/desc.c}          |    4 ++--
 hw/{usb-desc.h => usb/desc.h}          |    0
 hw/{usb-audio.c => usb/dev-audio.c}    |    8 ++++----
 hw/{usb-bt.c => usb/dev-bluetooth.c}   |    6 +++---
 hw/{usb-hid.c => usb/dev-hid.c}        |    8 ++++----
 hw/{usb-hub.c => usb/dev-hub.c}        |    4 ++--
 hw/{usb-net.c => usb/dev-network.c}    |    4 ++--
 hw/{usb-serial.c => usb/dev-serial.c}  |    4 ++--
 hw/{usb-ccid.c => usb/dev-smartcard.c} |    0
 hw/{usb-msd.c => usb/dev-storage.c}    |    6 +++---
 hw/{usb-wacom.c => usb/dev-wacom.c}    |    6 +++---
 hw/{usb-ehci.c => usb/hcd-ehci.c}      |    6 +++---
 hw/{usb-musb.c => usb/hcd-musb.c}      |    6 +++---
 hw/{usb-ohci.c => usb/hcd-ohci.c}      |   12 ++++++------
 hw/{usb-uhci.c => usb/hcd-uhci.c}      |    8 ++++----
 hw/{usb-xhci.c => usb/hcd-xhci.c}      |   10 +++++-----
 usb-bsd.c => hw/usb/host-bsd.c         |    0
 usb-linux.c => hw/usb/host-linux.c     |    0
 usb-stub.c => hw/usb/host-stub.c       |    0
 hw/{usb-libhw.c => usb/libhw.c}        |    2 +-
 usb-redir.c => hw/usb/redirect.c       |    0
 26 files changed, 67 insertions(+), 63 deletions(-)
 rename hw/{usb-bus.c => usb/bus.c} (99%)
 rename hw/{usb.c => usb/core.c} (99%)
 rename hw/{usb-desc.c => usb/desc.c} (99%)
 rename hw/{usb-desc.h => usb/desc.h} (100%)
 rename hw/{usb-audio.c => usb/dev-audio.c} (99%)
 rename hw/{usb-bt.c => usb/dev-bluetooth.c} (99%)
 rename hw/{usb-hid.c => usb/dev-hid.c} (99%)
 rename hw/{usb-hub.c => usb/dev-hub.c} (99%)
 rename hw/{usb-net.c => usb/dev-network.c} (99%)
 rename hw/{usb-serial.c => usb/dev-serial.c} (99%)
 rename hw/{usb-ccid.c => usb/dev-smartcard.c} (100%)
 rename hw/{usb-msd.c => usb/dev-storage.c} (99%)
 rename hw/{usb-wacom.c => usb/dev-wacom.c} (99%)
 rename hw/{usb-ehci.c => usb/hcd-ehci.c} (99%)
 rename hw/{usb-musb.c => usb/hcd-musb.c} (99%)
 rename hw/{usb-ohci.c => usb/hcd-ohci.c} (99%)
 rename hw/{usb-uhci.c => usb/hcd-uhci.c} (99%)
 rename hw/{usb-xhci.c => usb/hcd-xhci.c} (99%)
 rename usb-bsd.c => hw/usb/host-bsd.c (100%)
 rename usb-linux.c => hw/usb/host-linux.c (100%)
 rename usb-stub.c => hw/usb/host-stub.c (100%)
 rename hw/{usb-libhw.c => usb/libhw.c} (99%)
 rename usb-redir.c => hw/usb/redirect.c (100%)
Makefile.objs +12 -10
index 808de6a..a97338b 100644
@@ -103,13 +103,15 @@ common-obj-y += eeprom93xx.o
 common-obj-y += scsi-disk.o cdrom.o
 common-obj-y += scsi-generic.o scsi-bus.o
 common-obj-y += hid.o
-common-obj-y += usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
-common-obj-y += usb-serial.o usb-net.o usb-bus.o usb-desc.o usb-audio.o
+common-obj-y += usb/core.o usb/bus.o usb/desc.o usb/dev-hub.o
+common-obj-y += usb/host-$(HOST_USB).o
+common-obj-y += usb/dev-hid.o usb/dev-storage.o usb/dev-wacom.o
+common-obj-y += usb/dev-serial.o usb/dev-network.o usb/dev-audio.o
 common-obj-$(CONFIG_SSI) += ssi.o
 common-obj-$(CONFIG_SSI_SD) += ssi-sd.o
 common-obj-$(CONFIG_SD) += sd.o
-common-obj-y += bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
-common-obj-y += bt-hci-csr.o
+common-obj-y += bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o
+common-obj-y += bt-hci-csr.o usb/dev-bluetooth.o
 common-obj-y += buffered_file.o migration.o migration-tcp.o
 common-obj-y += qemu-char.o #aio.o
 common-obj-y += msmouse.o ps2.o
@@ -190,7 +192,7 @@ user-obj-y += $(trace-obj-y)
 hw-obj-y =
 hw-obj-y += vl.o loader.o
 hw-obj-$(CONFIG_VIRTIO) += virtio-console.o
-hw-obj-y += usb-libhw.o
+hw-obj-y += usb/libhw.o
 hw-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
 hw-obj-y += fw_cfg.o
 hw-obj-$(CONFIG_PCI) += pci.o pci_bridge.o
@@ -213,10 +215,10 @@ hw-obj-$(CONFIG_PARALLEL) += parallel.o
 hw-obj-$(CONFIG_I8254) += i8254.o
 hw-obj-$(CONFIG_PCSPK) += pcspk.o
 hw-obj-$(CONFIG_PCKBD) += pckbd.o
-hw-obj-$(CONFIG_USB_UHCI) += usb-uhci.o
-hw-obj-$(CONFIG_USB_OHCI) += usb-ohci.o
-hw-obj-$(CONFIG_USB_EHCI) += usb-ehci.o
-hw-obj-$(CONFIG_USB_XHCI) += usb-xhci.o
+hw-obj-$(CONFIG_USB_UHCI) += usb/hcd-uhci.o
+hw-obj-$(CONFIG_USB_OHCI) += usb/hcd-ohci.o
+hw-obj-$(CONFIG_USB_EHCI) += usb/hcd-ehci.o
+hw-obj-$(CONFIG_USB_XHCI) += usb/hcd-xhci.o
 hw-obj-$(CONFIG_FDC) += fdc.o
 hw-obj-$(CONFIG_ACPI) += acpi.o acpi_piix4.o
 hw-obj-$(CONFIG_APM) += pm_smbus.o apm.o
@@ -226,7 +228,7 @@ hw-obj-$(CONFIG_HPET) += hpet.o
 hw-obj-$(CONFIG_APPLESMC) += applesmc.o
 hw-obj-$(CONFIG_SMARTCARD) += usb-ccid.o ccid-card-passthru.o
 hw-obj-$(CONFIG_SMARTCARD_NSS) += ccid-card-emulated.o
-hw-obj-$(CONFIG_USB_REDIR) += usb-redir.o
+hw-obj-$(CONFIG_USB_REDIR) += usb/redirect.o
 hw-obj-$(CONFIG_I8259) += i8259_common.o i8259.o
 
 # PPC devices
Makefile.target +1 -1
index 343eb78..16e6e4b 100644
@@ -365,7 +365,7 @@ obj-arm-y += omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o \
 obj-arm-y += omap2.o omap_dss.o soc_dma.o omap_gptimer.o omap_synctimer.o \
 		omap_gpmc.o omap_sdrc.o omap_spi.o omap_tap.o omap_l4.o
 obj-arm-y += omap_sx1.o palm.o tsc210x.o
-obj-arm-y += nseries.o blizzard.o onenand.o cbus.o tusb6010.o usb-musb.o
+obj-arm-y += nseries.o blizzard.o onenand.o cbus.o tusb6010.o usb/hcd-musb.o
 obj-arm-y += mst_fpga.o mainstone.o
 obj-arm-y += z2.o
 obj-arm-y += musicpal.o bitbang_i2c.o marvell_88w8618_audio.o
configure +3 -1
index a5eb832..14fa213 100755
@@ -3428,6 +3428,7 @@ mkdir -p $target_dir
 mkdir -p $target_dir/fpu
 mkdir -p $target_dir/tcg
 mkdir -p $target_dir/ide
+mkdir -p $target_dir/usb
 mkdir -p $target_dir/9pfs
 mkdir -p $target_dir/kvm
 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
@@ -3844,7 +3845,7 @@ done # for target in $targets
 DIRS="tests tests/tcg tests/tcg/cris slirp audio block net pc-bios/optionrom"
 DIRS="$DIRS pc-bios/spapr-rtas"
 DIRS="$DIRS roms/seabios roms/vgabios"
-DIRS="$DIRS fsdev ui"
+DIRS="$DIRS fsdev ui usb"
 DIRS="$DIRS qapi qapi-generated"
 DIRS="$DIRS qga trace qom"
 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
@@ -3885,6 +3886,7 @@ for hwlib in 32 64; do
   d=libhw$hwlib
   mkdir -p $d
   mkdir -p $d/ide
+  mkdir -p $d/usb
   symlink $source_path/Makefile.hw $d/Makefile
   mkdir -p $d/9pfs
   echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
hw/usb/bus.c renamed from hw/usb-bus.c +3 -3
similarity index 99%
rename from hw/usb-bus.c
rename to hw/usb/bus.c
index 70b7ebc..d3f8358 100644
@@ -1,6 +1,6 @@
-#include "hw.h"
-#include "usb.h"
-#include "qdev.h"
+#include "hw/hw.h"
+#include "hw/usb.h"
+#include "hw/qdev.h"
 #include "sysemu.h"
 #include "monitor.h"
 #include "trace.h"
hw/usb/core.c renamed from hw/usb.c +1 -1
similarity index 99%
rename from hw/usb.c
rename to hw/usb/core.c
index 1ec2e90..494989a 100644
@@ -24,7 +24,7 @@
  * THE SOFTWARE.
  */
 #include "qemu-common.h"
-#include "usb.h"
+#include "hw/usb.h"
 #include "iov.h"
 #include "trace.h"
 
hw/usb/desc.c renamed from hw/usb-desc.c +2 -2
similarity index 99%
rename from hw/usb-desc.c
rename to hw/usb/desc.c
index ccf85ad..9847a75 100644
@@ -1,5 +1,5 @@
-#include "usb.h"
-#include "usb-desc.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
 #include "trace.h"
 
 /* ------------------------------------------------------------------ */
hw/usb/desc.h renamed from hw/usb-desc.h +0 -0
similarity index 100%
rename from hw/usb-desc.h
rename to hw/usb/desc.h
hw/usb/dev-audio.c renamed from hw/usb-audio.c +4 -4
similarity index 99%
rename from hw/usb-audio.c
rename to hw/usb/dev-audio.c
index fed1361..426b95c 100644
@@ -30,10 +30,10 @@
  */
 
 #include "qemu-common.h"
-#include "usb.h"
-#include "usb-desc.h"
-#include "hw.h"
-#include "audiodev.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
+#include "hw/hw.h"
+#include "hw/audiodev.h"
 #include "audio/audio.h"
 
 #define USBAUDIO_VENDOR_NUM     0x46f4 /* CRC16() of "QEMU" */
hw/usb/dev-bluetooth.c renamed from hw/usb-bt.c +3 -3
similarity index 99%
rename from hw/usb-bt.c
rename to hw/usb/dev-bluetooth.c
index 23c39ec..195370c 100644
@@ -19,10 +19,10 @@
  */
 
 #include "qemu-common.h"
-#include "usb.h"
-#include "usb-desc.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
 #include "net.h"
-#include "bt.h"
+#include "hw/bt.h"
 
 struct USBBtState {
     USBDevice dev;
hw/usb/dev-hid.c renamed from hw/usb-hid.c +4 -4
similarity index 99%
rename from hw/usb-hid.c
rename to hw/usb/dev-hid.c
index 37bca78..f29544d 100644
@@ -22,12 +22,12 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include "hw.h"
+#include "hw/hw.h"
 #include "console.h"
-#include "usb.h"
-#include "usb-desc.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
 #include "qemu-timer.h"
-#include "hid.h"
+#include "hw/hid.h"
 
 /* HID interface requests */
 #define GET_REPORT   0xa101
hw/usb/dev-hub.c renamed from hw/usb-hub.c +2 -2
similarity index 99%
rename from hw/usb-hub.c
rename to hw/usb/dev-hub.c
index a12856e..eb4e711 100644
@@ -22,8 +22,8 @@
  * THE SOFTWARE.
  */
 #include "qemu-common.h"
-#include "usb.h"
-#include "usb-desc.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
 
 //#define DEBUG
 
hw/usb/dev-network.c renamed from hw/usb-net.c +2 -2
similarity index 99%
rename from hw/usb-net.c
rename to hw/usb/dev-network.c
index 22b8201..cff55f2 100644
@@ -24,8 +24,8 @@
  */
 
 #include "qemu-common.h"
-#include "usb.h"
-#include "usb-desc.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
 #include "net.h"
 #include "qemu-queue.h"
 #include "sysemu.h"
hw/usb/dev-serial.c renamed from hw/usb-serial.c +2 -2
similarity index 99%
rename from hw/usb-serial.c
rename to hw/usb/dev-serial.c
index 0aae379..8dcac8b 100644
@@ -10,8 +10,8 @@
 
 #include "qemu-common.h"
 #include "qemu-error.h"
-#include "usb.h"
-#include "usb-desc.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
 #include "qemu-char.h"
 
 //#define DEBUG_Serial
hw/usb/dev-smartcard.c renamed from hw/usb-ccid.c +0 -0
similarity index 100%
rename from hw/usb-ccid.c
rename to hw/usb/dev-smartcard.c
hw/usb/dev-storage.c renamed from hw/usb-msd.c +3 -3
similarity index 99%
rename from hw/usb-msd.c
rename to hw/usb/dev-storage.c
index c6f08a0..6ffaf70 100644
@@ -10,9 +10,9 @@
 #include "qemu-common.h"
 #include "qemu-option.h"
 #include "qemu-config.h"
-#include "usb.h"
-#include "usb-desc.h"
-#include "scsi.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
+#include "hw/scsi.h"
 #include "console.h"
 #include "monitor.h"
 #include "sysemu.h"
hw/usb/dev-wacom.c renamed from hw/usb-wacom.c +3 -3
similarity index 99%
rename from hw/usb-wacom.c
rename to hw/usb/dev-wacom.c
index 197e2dc..c1cfd74 100644
@@ -25,10 +25,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include "hw.h"
+#include "hw/hw.h"
 #include "console.h"
-#include "usb.h"
-#include "usb-desc.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
 
 /* Interface requests */
 #define WACOM_GET_REPORT	0x2101
hw/usb/hcd-ehci.c renamed from hw/usb-ehci.c +3 -3
similarity index 99%
rename from hw/usb-ehci.c
rename to hw/usb/hcd-ehci.c
index df742f7..58811d3 100644
@@ -22,10 +22,10 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "hw.h"
+#include "hw/hw.h"
 #include "qemu-timer.h"
-#include "usb.h"
-#include "pci.h"
+#include "hw/usb.h"
+#include "hw/pci.h"
 #include "monitor.h"
 #include "trace.h"
 #include "dma.h"
hw/usb/hcd-musb.c renamed from hw/usb-musb.c +3 -3
similarity index 99%
rename from hw/usb-musb.c
rename to hw/usb/hcd-musb.c
index 820907a..fa9385e 100644
@@ -22,9 +22,9 @@
  */
 #include "qemu-common.h"
 #include "qemu-timer.h"
-#include "usb.h"
-#include "irq.h"
-#include "hw.h"
+#include "hw/usb.h"
+#include "hw/irq.h"
+#include "hw/hw.h"
 
 /* Common USB registers */
 #define MUSB_HDRC_FADDR		0x00	/* 8-bit */
hw/usb/hcd-ohci.c renamed from hw/usb-ohci.c +6 -6
similarity index 99%
rename from hw/usb-ohci.c
rename to hw/usb/hcd-ohci.c
index 20aaa74..dd79cef 100644
@@ -26,13 +26,13 @@
  *  o BIOS work to boot from USB storage
 */
 
-#include "hw.h"
+#include "hw/hw.h"
 #include "qemu-timer.h"
-#include "usb.h"
-#include "pci.h"
-#include "usb-ohci.h"
-#include "sysbus.h"
-#include "qdev-addr.h"
+#include "hw/usb.h"
+#include "hw/pci.h"
+#include "hw/usb-ohci.h"
+#include "hw/sysbus.h"
+#include "hw/qdev-addr.h"
 
 //#define DEBUG_OHCI
 /* Dump packet contents.  */
hw/usb/hcd-uhci.c renamed from hw/usb-uhci.c +4 -4
similarity index 99%
rename from hw/usb-uhci.c
rename to hw/usb/hcd-uhci.c
index 304b84b..7c2e9b3 100644
@@ -25,11 +25,11 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include "hw.h"
-#include "usb.h"
-#include "pci.h"
+#include "hw/hw.h"
+#include "hw/usb.h"
+#include "hw/pci.h"
 #include "qemu-timer.h"
-#include "usb-uhci.h"
+#include "hw/usb-uhci.h"
 #include "iov.h"
 #include "dma.h"
 
hw/usb/hcd-xhci.c renamed from hw/usb-xhci.c +5 -5
similarity index 99%
rename from hw/usb-xhci.c
rename to hw/usb/hcd-xhci.c
index e8f1b6e..73b0c7f 100644
@@ -18,12 +18,12 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#include "hw.h"
+#include "hw/hw.h"
 #include "qemu-timer.h"
-#include "usb.h"
-#include "pci.h"
-#include "qdev-addr.h"
-#include "msi.h"
+#include "hw/usb.h"
+#include "hw/pci.h"
+#include "hw/qdev-addr.h"
+#include "hw/msi.h"
 
 //#define DEBUG_XHCI
 //#define DEBUG_DATA
hw/usb/host-bsd.c renamed from usb-bsd.c +0 -0
similarity index 100%
rename from usb-bsd.c
rename to hw/usb/host-bsd.c
hw/usb/host-linux.c renamed from usb-linux.c +0 -0
similarity index 100%
rename from usb-linux.c
rename to hw/usb/host-linux.c
hw/usb/host-stub.c renamed from usb-stub.c +0 -0
similarity index 100%
rename from usb-stub.c
rename to hw/usb/host-stub.c
hw/usb/libhw.c renamed from hw/usb-libhw.c +1 -1
similarity index 99%
rename from hw/usb-libhw.c
rename to hw/usb/libhw.c
index 162b42b..2462351 100644
@@ -21,7 +21,7 @@
  */
 #include "qemu-common.h"
 #include "cpu-common.h"
-#include "usb.h"
+#include "hw/usb.h"
 #include "dma.h"
 
 int usb_packet_map(USBPacket *p, QEMUSGList *sgl)
hw/usb/redirect.c renamed from usb-redir.c +0 -0
similarity index 100%
rename from usb-redir.c
rename to hw/usb/redirect.c
Signature · 1 line
1.7.1
#2 lore raw

Re: [Qemu-devel] [RfC PATCH 1/2] usb: the big rename

Quoted 7 lines · Gerd Hoffmann

Reorganize usb source files. Create a new hw/usb/ directory and move all usb source code to that place. Also make filenames a bit more descriptive. Host adapters are prefixed with "hch-" now, usb device emulations are prefixed with "dev-". Fixup paths Makefile and include paths to make it compile. No code changes.

Quoted 15 lines
---
 Makefile.objs                          |   22 ++++++++++++----------
 Makefile.target                        |    2 +-
 configure                              |    4 +++-
 hw/{usb-bus.c => usb/bus.c}            |    6 +++---
 hw/{usb.c => usb/core.c}               |    2 +-
 hw/{usb-desc.c => usb/desc.c}          |    4 ++--
 hw/{usb-desc.h => usb/desc.h}          |    0
 hw/{usb-audio.c => usb/dev-audio.c}    |    8 ++++----
 hw/{usb-bt.c => usb/dev-bluetooth.c}   |    6 +++---
 hw/{usb-hid.c => usb/dev-hid.c}        |    8 ++++----
 hw/{usb-hub.c => usb/dev-hub.c}        |    4 ++--
 hw/{usb-net.c => usb/dev-network.c}    |    4 ++--
 hw/{usb-serial.c => usb/dev-serial.c}  |    4 ++--
 hw/{usb-ccid.c => usb/dev-smartcard.c} |    0

CCID is the name of the specification. Smartcard might be more descriptive, but if you want to be both descriptive and accurate you could do dev-smartcard-reader.c .

Quoted 506 lines
 hw/{usb-msd.c => usb/dev-storage.c}    |    6 +++---
 hw/{usb-wacom.c => usb/dev-wacom.c}    |    6 +++---
 hw/{usb-ehci.c => usb/hcd-ehci.c}      |    6 +++---
 hw/{usb-musb.c => usb/hcd-musb.c}      |    6 +++---
 hw/{usb-ohci.c => usb/hcd-ohci.c}      |   12 ++++++------
 hw/{usb-uhci.c => usb/hcd-uhci.c}      |    8 ++++----
 hw/{usb-xhci.c => usb/hcd-xhci.c}      |   10 +++++-----
 usb-bsd.c => hw/usb/host-bsd.c         |    0
 usb-linux.c => hw/usb/host-linux.c     |    0
 usb-stub.c => hw/usb/host-stub.c       |    0
 hw/{usb-libhw.c => usb/libhw.c}        |    2 +-
 usb-redir.c => hw/usb/redirect.c       |    0
 26 files changed, 67 insertions(+), 63 deletions(-)
 rename hw/{usb-bus.c => usb/bus.c} (99%)
 rename hw/{usb.c => usb/core.c} (99%)
 rename hw/{usb-desc.c => usb/desc.c} (99%)
 rename hw/{usb-desc.h => usb/desc.h} (100%)
 rename hw/{usb-audio.c => usb/dev-audio.c} (99%)
 rename hw/{usb-bt.c => usb/dev-bluetooth.c} (99%)
 rename hw/{usb-hid.c => usb/dev-hid.c} (99%)
 rename hw/{usb-hub.c => usb/dev-hub.c} (99%)
 rename hw/{usb-net.c => usb/dev-network.c} (99%)
 rename hw/{usb-serial.c => usb/dev-serial.c} (99%)
 rename hw/{usb-ccid.c => usb/dev-smartcard.c} (100%)
 rename hw/{usb-msd.c => usb/dev-storage.c} (99%)
 rename hw/{usb-wacom.c => usb/dev-wacom.c} (99%)
 rename hw/{usb-ehci.c => usb/hcd-ehci.c} (99%)
 rename hw/{usb-musb.c => usb/hcd-musb.c} (99%)
 rename hw/{usb-ohci.c => usb/hcd-ohci.c} (99%)
 rename hw/{usb-uhci.c => usb/hcd-uhci.c} (99%)
 rename hw/{usb-xhci.c => usb/hcd-xhci.c} (99%)
 rename usb-bsd.c => hw/usb/host-bsd.c (100%)
 rename usb-linux.c => hw/usb/host-linux.c (100%)
 rename usb-stub.c => hw/usb/host-stub.c (100%)
 rename hw/{usb-libhw.c => usb/libhw.c} (99%)
 rename usb-redir.c => hw/usb/redirect.c (100%)
Makefile.objs +12 -10
index 808de6a..a97338b 100644
@@ -103,13 +103,15 @@ common-obj-y += eeprom93xx.o
 common-obj-y += scsi-disk.o cdrom.o
 common-obj-y += scsi-generic.o scsi-bus.o
 common-obj-y += hid.o
-common-obj-y += usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
-common-obj-y += usb-serial.o usb-net.o usb-bus.o usb-desc.o usb-audio.o
+common-obj-y += usb/core.o usb/bus.o usb/desc.o usb/dev-hub.o
+common-obj-y += usb/host-$(HOST_USB).o
+common-obj-y += usb/dev-hid.o usb/dev-storage.o usb/dev-wacom.o
+common-obj-y += usb/dev-serial.o usb/dev-network.o usb/dev-audio.o
 common-obj-$(CONFIG_SSI) += ssi.o
 common-obj-$(CONFIG_SSI_SD) += ssi-sd.o
 common-obj-$(CONFIG_SD) += sd.o
-common-obj-y += bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
-common-obj-y += bt-hci-csr.o
+common-obj-y += bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o
+common-obj-y += bt-hci-csr.o usb/dev-bluetooth.o
 common-obj-y += buffered_file.o migration.o migration-tcp.o
 common-obj-y += qemu-char.o #aio.o
 common-obj-y += msmouse.o ps2.o
@@ -190,7 +192,7 @@ user-obj-y += $(trace-obj-y)
 hw-obj-y =
 hw-obj-y += vl.o loader.o
 hw-obj-$(CONFIG_VIRTIO) += virtio-console.o
-hw-obj-y += usb-libhw.o
+hw-obj-y += usb/libhw.o
 hw-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
 hw-obj-y += fw_cfg.o
 hw-obj-$(CONFIG_PCI) += pci.o pci_bridge.o
@@ -213,10 +215,10 @@ hw-obj-$(CONFIG_PARALLEL) += parallel.o
 hw-obj-$(CONFIG_I8254) += i8254.o
 hw-obj-$(CONFIG_PCSPK) += pcspk.o
 hw-obj-$(CONFIG_PCKBD) += pckbd.o
-hw-obj-$(CONFIG_USB_UHCI) += usb-uhci.o
-hw-obj-$(CONFIG_USB_OHCI) += usb-ohci.o
-hw-obj-$(CONFIG_USB_EHCI) += usb-ehci.o
-hw-obj-$(CONFIG_USB_XHCI) += usb-xhci.o
+hw-obj-$(CONFIG_USB_UHCI) += usb/hcd-uhci.o
+hw-obj-$(CONFIG_USB_OHCI) += usb/hcd-ohci.o
+hw-obj-$(CONFIG_USB_EHCI) += usb/hcd-ehci.o
+hw-obj-$(CONFIG_USB_XHCI) += usb/hcd-xhci.o
 hw-obj-$(CONFIG_FDC) += fdc.o
 hw-obj-$(CONFIG_ACPI) += acpi.o acpi_piix4.o
 hw-obj-$(CONFIG_APM) += pm_smbus.o apm.o
@@ -226,7 +228,7 @@ hw-obj-$(CONFIG_HPET) += hpet.o
 hw-obj-$(CONFIG_APPLESMC) += applesmc.o
 hw-obj-$(CONFIG_SMARTCARD) += usb-ccid.o ccid-card-passthru.o
 hw-obj-$(CONFIG_SMARTCARD_NSS) += ccid-card-emulated.o
-hw-obj-$(CONFIG_USB_REDIR) += usb-redir.o
+hw-obj-$(CONFIG_USB_REDIR) += usb/redirect.o
 hw-obj-$(CONFIG_I8259) += i8259_common.o i8259.o
 
 # PPC devices
Makefile.target +1 -1
index 343eb78..16e6e4b 100644
@@ -365,7 +365,7 @@ obj-arm-y += omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o \
 obj-arm-y += omap2.o omap_dss.o soc_dma.o omap_gptimer.o omap_synctimer.o \
 		omap_gpmc.o omap_sdrc.o omap_spi.o omap_tap.o omap_l4.o
 obj-arm-y += omap_sx1.o palm.o tsc210x.o
-obj-arm-y += nseries.o blizzard.o onenand.o cbus.o tusb6010.o usb-musb.o
+obj-arm-y += nseries.o blizzard.o onenand.o cbus.o tusb6010.o usb/hcd-musb.o
 obj-arm-y += mst_fpga.o mainstone.o
 obj-arm-y += z2.o
 obj-arm-y += musicpal.o bitbang_i2c.o marvell_88w8618_audio.o
configure +3 -1
index a5eb832..14fa213 100755
@@ -3428,6 +3428,7 @@ mkdir -p $target_dir
 mkdir -p $target_dir/fpu
 mkdir -p $target_dir/tcg
 mkdir -p $target_dir/ide
+mkdir -p $target_dir/usb
 mkdir -p $target_dir/9pfs
 mkdir -p $target_dir/kvm
 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
@@ -3844,7 +3845,7 @@ done # for target in $targets
 DIRS="tests tests/tcg tests/tcg/cris slirp audio block net pc-bios/optionrom"
 DIRS="$DIRS pc-bios/spapr-rtas"
 DIRS="$DIRS roms/seabios roms/vgabios"
-DIRS="$DIRS fsdev ui"
+DIRS="$DIRS fsdev ui usb"
 DIRS="$DIRS qapi qapi-generated"
 DIRS="$DIRS qga trace qom"
 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
@@ -3885,6 +3886,7 @@ for hwlib in 32 64; do
   d=libhw$hwlib
   mkdir -p $d
   mkdir -p $d/ide
+  mkdir -p $d/usb
   symlink $source_path/Makefile.hw $d/Makefile
   mkdir -p $d/9pfs
   echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
hw/usb/bus.c renamed from hw/usb-bus.c +3 -3
similarity index 99%
rename from hw/usb-bus.c
rename to hw/usb/bus.c
index 70b7ebc..d3f8358 100644
@@ -1,6 +1,6 @@
-#include "hw.h"
-#include "usb.h"
-#include "qdev.h"
+#include "hw/hw.h"
+#include "hw/usb.h"
+#include "hw/qdev.h"
 #include "sysemu.h"
 #include "monitor.h"
 #include "trace.h"
hw/usb/core.c renamed from hw/usb.c +1 -1
similarity index 99%
rename from hw/usb.c
rename to hw/usb/core.c
index 1ec2e90..494989a 100644
@@ -24,7 +24,7 @@
  * THE SOFTWARE.
  */
 #include "qemu-common.h"
-#include "usb.h"
+#include "hw/usb.h"
 #include "iov.h"
 #include "trace.h"
 
hw/usb/desc.c renamed from hw/usb-desc.c +2 -2
similarity index 99%
rename from hw/usb-desc.c
rename to hw/usb/desc.c
index ccf85ad..9847a75 100644
@@ -1,5 +1,5 @@
-#include "usb.h"
-#include "usb-desc.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
 #include "trace.h"
 
 /* ------------------------------------------------------------------ */
hw/usb/desc.h renamed from hw/usb-desc.h +0 -0
similarity index 100%
rename from hw/usb-desc.h
rename to hw/usb/desc.h
hw/usb/dev-audio.c renamed from hw/usb-audio.c +4 -4
similarity index 99%
rename from hw/usb-audio.c
rename to hw/usb/dev-audio.c
index fed1361..426b95c 100644
@@ -30,10 +30,10 @@
  */
 
 #include "qemu-common.h"
-#include "usb.h"
-#include "usb-desc.h"
-#include "hw.h"
-#include "audiodev.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
+#include "hw/hw.h"
+#include "hw/audiodev.h"
 #include "audio/audio.h"
 
 #define USBAUDIO_VENDOR_NUM     0x46f4 /* CRC16() of "QEMU" */
hw/usb/dev-bluetooth.c renamed from hw/usb-bt.c +3 -3
similarity index 99%
rename from hw/usb-bt.c
rename to hw/usb/dev-bluetooth.c
index 23c39ec..195370c 100644
@@ -19,10 +19,10 @@
  */
 
 #include "qemu-common.h"
-#include "usb.h"
-#include "usb-desc.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
 #include "net.h"
-#include "bt.h"
+#include "hw/bt.h"
 
 struct USBBtState {
     USBDevice dev;
hw/usb/dev-hid.c renamed from hw/usb-hid.c +4 -4
similarity index 99%
rename from hw/usb-hid.c
rename to hw/usb/dev-hid.c
index 37bca78..f29544d 100644
@@ -22,12 +22,12 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include "hw.h"
+#include "hw/hw.h"
 #include "console.h"
-#include "usb.h"
-#include "usb-desc.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
 #include "qemu-timer.h"
-#include "hid.h"
+#include "hw/hid.h"
 
 /* HID interface requests */
 #define GET_REPORT   0xa101
hw/usb/dev-hub.c renamed from hw/usb-hub.c +2 -2
similarity index 99%
rename from hw/usb-hub.c
rename to hw/usb/dev-hub.c
index a12856e..eb4e711 100644
@@ -22,8 +22,8 @@
  * THE SOFTWARE.
  */
 #include "qemu-common.h"
-#include "usb.h"
-#include "usb-desc.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
 
 //#define DEBUG
 
hw/usb/dev-network.c renamed from hw/usb-net.c +2 -2
similarity index 99%
rename from hw/usb-net.c
rename to hw/usb/dev-network.c
index 22b8201..cff55f2 100644
@@ -24,8 +24,8 @@
  */
 
 #include "qemu-common.h"
-#include "usb.h"
-#include "usb-desc.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
 #include "net.h"
 #include "qemu-queue.h"
 #include "sysemu.h"
hw/usb/dev-serial.c renamed from hw/usb-serial.c +2 -2
similarity index 99%
rename from hw/usb-serial.c
rename to hw/usb/dev-serial.c
index 0aae379..8dcac8b 100644
@@ -10,8 +10,8 @@
 
 #include "qemu-common.h"
 #include "qemu-error.h"
-#include "usb.h"
-#include "usb-desc.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
 #include "qemu-char.h"
 
 //#define DEBUG_Serial
hw/usb/dev-smartcard.c renamed from hw/usb-ccid.c +0 -0
similarity index 100%
rename from hw/usb-ccid.c
rename to hw/usb/dev-smartcard.c
hw/usb/dev-storage.c renamed from hw/usb-msd.c +3 -3
similarity index 99%
rename from hw/usb-msd.c
rename to hw/usb/dev-storage.c
index c6f08a0..6ffaf70 100644
@@ -10,9 +10,9 @@
 #include "qemu-common.h"
 #include "qemu-option.h"
 #include "qemu-config.h"
-#include "usb.h"
-#include "usb-desc.h"
-#include "scsi.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
+#include "hw/scsi.h"
 #include "console.h"
 #include "monitor.h"
 #include "sysemu.h"
hw/usb/dev-wacom.c renamed from hw/usb-wacom.c +3 -3
similarity index 99%
rename from hw/usb-wacom.c
rename to hw/usb/dev-wacom.c
index 197e2dc..c1cfd74 100644
@@ -25,10 +25,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include "hw.h"
+#include "hw/hw.h"
 #include "console.h"
-#include "usb.h"
-#include "usb-desc.h"
+#include "hw/usb.h"
+#include "hw/usb/desc.h"
 
 /* Interface requests */
 #define WACOM_GET_REPORT	0x2101
hw/usb/hcd-ehci.c renamed from hw/usb-ehci.c +3 -3
similarity index 99%
rename from hw/usb-ehci.c
rename to hw/usb/hcd-ehci.c
index df742f7..58811d3 100644
@@ -22,10 +22,10 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "hw.h"
+#include "hw/hw.h"
 #include "qemu-timer.h"
-#include "usb.h"
-#include "pci.h"
+#include "hw/usb.h"
+#include "hw/pci.h"
 #include "monitor.h"
 #include "trace.h"
 #include "dma.h"
hw/usb/hcd-musb.c renamed from hw/usb-musb.c +3 -3
similarity index 99%
rename from hw/usb-musb.c
rename to hw/usb/hcd-musb.c
index 820907a..fa9385e 100644
@@ -22,9 +22,9 @@
  */
 #include "qemu-common.h"
 #include "qemu-timer.h"
-#include "usb.h"
-#include "irq.h"
-#include "hw.h"
+#include "hw/usb.h"
+#include "hw/irq.h"
+#include "hw/hw.h"
 
 /* Common USB registers */
 #define MUSB_HDRC_FADDR		0x00	/* 8-bit */
hw/usb/hcd-ohci.c renamed from hw/usb-ohci.c +6 -6
similarity index 99%
rename from hw/usb-ohci.c
rename to hw/usb/hcd-ohci.c
index 20aaa74..dd79cef 100644
@@ -26,13 +26,13 @@
  *  o BIOS work to boot from USB storage
 */
 
-#include "hw.h"
+#include "hw/hw.h"
 #include "qemu-timer.h"
-#include "usb.h"
-#include "pci.h"
-#include "usb-ohci.h"
-#include "sysbus.h"
-#include "qdev-addr.h"
+#include "hw/usb.h"
+#include "hw/pci.h"
+#include "hw/usb-ohci.h"
+#include "hw/sysbus.h"
+#include "hw/qdev-addr.h"
 
 //#define DEBUG_OHCI
 /* Dump packet contents.  */
hw/usb/hcd-uhci.c renamed from hw/usb-uhci.c +4 -4
similarity index 99%
rename from hw/usb-uhci.c
rename to hw/usb/hcd-uhci.c
index 304b84b..7c2e9b3 100644
@@ -25,11 +25,11 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include "hw.h"
-#include "usb.h"
-#include "pci.h"
+#include "hw/hw.h"
+#include "hw/usb.h"
+#include "hw/pci.h"
 #include "qemu-timer.h"
-#include "usb-uhci.h"
+#include "hw/usb-uhci.h"
 #include "iov.h"
 #include "dma.h"
 
hw/usb/hcd-xhci.c renamed from hw/usb-xhci.c +5 -5
similarity index 99%
rename from hw/usb-xhci.c
rename to hw/usb/hcd-xhci.c
index e8f1b6e..73b0c7f 100644
@@ -18,12 +18,12 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#include "hw.h"
+#include "hw/hw.h"
 #include "qemu-timer.h"
-#include "usb.h"
-#include "pci.h"
-#include "qdev-addr.h"
-#include "msi.h"
+#include "hw/usb.h"
+#include "hw/pci.h"
+#include "hw/qdev-addr.h"
+#include "hw/msi.h"
 
 //#define DEBUG_XHCI
 //#define DEBUG_DATA
hw/usb/host-bsd.c renamed from usb-bsd.c +0 -0
similarity index 100%
rename from usb-bsd.c
rename to hw/usb/host-bsd.c
hw/usb/host-linux.c renamed from usb-linux.c +0 -0
similarity index 100%
rename from usb-linux.c
rename to hw/usb/host-linux.c
hw/usb/host-stub.c renamed from usb-stub.c +0 -0
similarity index 100%
rename from usb-stub.c
rename to hw/usb/host-stub.c
hw/usb/libhw.c renamed from hw/usb-libhw.c +1 -1
similarity index 99%
rename from hw/usb-libhw.c
rename to hw/usb/libhw.c
index 162b42b..2462351 100644
@@ -21,7 +21,7 @@
  */
 #include "qemu-common.h"
 #include "cpu-common.h"
-#include "usb.h"
+#include "hw/usb.h"
 #include "dma.h"
 
 int usb_packet_map(USBPacket *p, QEMUSGList *sgl)
hw/usb/redirect.c renamed from usb-redir.c +0 -0
similarity index 100%
rename from usb-redir.c
rename to hw/usb/redirect.c
Signature · 1 line
1.7.1
#3 lore raw

Re: [Qemu-devel] [RfC PATCH 1/2] usb: the big rename

In reply to Gerd Hoffmann

Il 08/03/2012 10:16, Gerd Hoffmann ha scritto:

Quoted 3 lines

Reorganize usb source files. Create a new hw/usb/ directory and move all usb source code to that place. Also make filenames a bit more descriptive. Host adapters are prefixed with "hch-" now

Nice tribute to Christoph, but I think I prefer hcd- as is in the patch. :)

, usb device

Quoted 2 lines

emulations are prefixed with "dev-". Fixup paths Makefile and include paths to make it compile. No code changes.

Let's start using include/usb instead?

Paolo

#4 lore raw

Re: [Qemu-devel] [RfC PATCH 1/2] usb: the big rename

Hi,

Quoted 4 lines
Quoted 2 lines

emulations are prefixed with "dev-". Fixup paths Makefile and include paths to make it compile. No code changes.

Let's start using include/usb instead?

I think that needs a few more cleanups beforehand, there is a single usb.h now, guess I better should split that into usb-private and external-interfaces first.

Also IIRC include/ is (also?) meant for the data structures code generators (qapi, visitors) want look at.

cheers,
Gerd

#5 lore raw

Re: [Qemu-devel] [RfC PATCH 1/2] usb: the big rename

Il 09/03/2012 09:42, Gerd Hoffmann ha scritto:

Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

emulations are prefixed with "dev-". Fixup paths Makefile and include

Quoted 1 line
Quoted 1 line

paths to make it compile. No code changes.

Let's start using include/usb instead?

I think that needs a few more cleanups beforehand, there is a single usb.h now, guess I better should split that into usb-private and external-interfaces first.

Also IIRC include/ is (also?) meant for the data structures code generators (qapi, visitors) want look at.

As I understood it, the idea is to make it simply Linux-like, with public headers in include/ and private headers elsewhere.

So even interfaces that are private to the USB layer, but shared among multiple directories would be in include/.

I suppose the external interfaces are just to support legacy command-line and the like?

Paolo

#6 lore raw

Re: [Qemu-devel] [RfC PATCH 1/2] usb: the big rename

Hi,

Quoted 8 lines

As I understood it, the idea is to make it simply Linux-like, with public headers in include/ and private headers elsewhere.

So even interfaces that are private to the USB layer, but shared among multiple directories would be in include/.

I suppose the external interfaces are just to support legacy command-line and the like?

Yes, I think legacy cmd line is there. Not much else.

cheers,
Gerd

#7 lore raw

RFC PATCH 2/2 usb: zap hw/ush-{ohic, uhci}.h + init wrappers

In reply to Gerd Hoffmann

Remove the uhci and ohci init wrappers, which all wrapped a pci_create_simple() one-liner. Switch callsites to call pci_create_simple directly. Remove the header files where the wrappers where declared.

---
 hw/alpha_sys.h    |    1 -
 hw/pc_piix.c      |    4 +---
 hw/ppc_newworld.c |    3 +--
 hw/ppc_oldworld.c |    3 +--
 hw/ppc_prep.c     |    3 +--
 hw/realview.c     |    3 +--
 hw/usb-ohci.h     |    9 ---------
 hw/usb-uhci.h     |   10 ----------
 hw/usb/hcd-ohci.c |    6 ------
 hw/usb/hcd-uhci.c |   16 ----------------
 hw/versatilepb.c  |    3 +--
 11 files changed, 6 insertions(+), 55 deletions(-)
 delete mode 100644 hw/usb-ohci.h
 delete mode 100644 hw/usb-uhci.h
hw/alpha_sys.h +0 -1
index d54b18f..f9506c6 100644
@@ -8,7 +8,6 @@
 #include "ide.h"
 #include "net.h"
 #include "pc.h"
-#include "usb-ohci.h"
 #include "irq.h"
 
 
hw/pc_piix.c +1 -3
index 6c5c40f..3f99f9a 100644
@@ -28,8 +28,6 @@
 #include "pc.h"
 #include "apic.h"
 #include "pci.h"
-#include "usb-uhci.h"
-#include "usb-ohci.h"
 #include "net.h"
 #include "boards.h"
 #include "ide.h"
@@ -284,7 +282,7 @@ static void pc_init1(MemoryRegion *system_memory,
                  floppy, idebus[0], idebus[1], rtc_state);
 
     if (pci_enabled && usb_enabled) {
-        usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);
+        pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
     }
 
     if (pci_enabled && acpi_enabled) {
hw/ppc_newworld.c +1 -2
index 506187b..2fec5b4 100644
@@ -54,7 +54,6 @@
 #include "nvram.h"
 #include "pc.h"
 #include "pci.h"
-#include "usb-ohci.h"
 #include "net.h"
 #include "sysemu.h"
 #include "boards.h"
@@ -352,7 +351,7 @@ static void ppc_core99_init (ram_addr_t ram_size,
                dbdma_mem, cuda_mem, NULL, 3, ide_mem, escc_bar);
 
     if (usb_enabled) {
-        usb_ohci_init_pci(pci_bus, -1);
+        pci_create_simple(pci_bus, -1, "pci-ohci");
     }
 
     /* U3 needs to use USB for input because Linux doesn't support via-cuda
hw/ppc_oldworld.c +1 -2
index 9295a34..49c2c97 100644
@@ -34,7 +34,6 @@
 #include "net.h"
 #include "isa.h"
 #include "pci.h"
-#include "usb-ohci.h"
 #include "boards.h"
 #include "fw_cfg.h"
 #include "escc.h"
@@ -278,7 +277,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
                dbdma_mem, cuda_mem, nvr, 2, ide_mem, escc_bar);
 
     if (usb_enabled) {
-        usb_ohci_init_pci(pci_bus, -1);
+        pci_create_simple(pci_bus, -1, "pci-ohci");
     }
 
     if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8)
hw/ppc_prep.c +1 -2
index eb43fb5..dc9edd7 100644
@@ -30,7 +30,6 @@
 #include "isa.h"
 #include "pci.h"
 #include "pci_host.h"
-#include "usb-ohci.h"
 #include "ppc.h"
 #include "boards.h"
 #include "qemu-log.h"
@@ -688,7 +687,7 @@ static void ppc_prep_init (ram_addr_t ram_size,
 #endif
 
     if (usb_enabled) {
-        usb_ohci_init_pci(pci_bus, -1);
+        pci_create_simple(pci_bus, -1, "pci-ohci");
     }
 
     m48t59 = m48t59_init_isa(isa_bus, 0x0074, NVRAM_SIZE, 59);
hw/realview.c +1 -2
index ae1bbcd..50ea67c 100644
@@ -12,7 +12,6 @@
 #include "primecell.h"
 #include "devices.h"
 #include "pci.h"
-#include "usb-ohci.h"
 #include "net.h"
 #include "sysemu.h"
 #include "boards.h"
@@ -305,7 +304,7 @@ static void realview_init(ram_addr_t ram_size,
         sysbus_connect_irq(busdev, 3, pic[51]);
         pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci");
         if (usb_enabled) {
-            usb_ohci_init_pci(pci_bus, -1);
+            pci_create_simple(pci_bus, -1, "pci-ohci");
         }
         n = drive_get_max_bus(IF_SCSI);
         while (n >= 0) {
hw/usb-ohci.h deleted +0 -9
deleted file mode 100644
index eefcef3..0000000
@@ -1,9 +0,0 @@
-#ifndef QEMU_USB_OHCI_H
-#define QEMU_USB_OHCI_H
-
-#include "qemu-common.h"
-
-void usb_ohci_init_pci(struct PCIBus *bus, int devfn);
-
-#endif
-
hw/usb-uhci.h deleted +0 -10
deleted file mode 100644
index 3e4d377..0000000
@@ -1,10 +0,0 @@
-#ifndef QEMU_USB_UHCI_H
-#define QEMU_USB_UHCI_H
-
-#include "qemu-common.h"
-
-void usb_uhci_piix3_init(PCIBus *bus, int devfn);
-void usb_uhci_piix4_init(PCIBus *bus, int devfn);
-void usb_uhci_vt82c686b_init(PCIBus *bus, int devfn);
-
-#endif
hw/usb/hcd-ohci.c +0 -6
index dd79cef..51fa111 100644
@@ -30,7 +30,6 @@
 #include "qemu-timer.h"
 #include "hw/usb.h"
 #include "hw/pci.h"
-#include "hw/usb-ohci.h"
 #include "hw/sysbus.h"
 #include "hw/qdev-addr.h"
 
@@ -1815,11 +1814,6 @@ static int usb_ohci_initfn_pci(struct PCIDevice *dev)
     return 0;
 }
 
-void usb_ohci_init_pci(struct PCIBus *bus, int devfn)
-{
-    pci_create_simple(bus, devfn, "pci-ohci");
-}
-
 typedef struct {
     SysBusDevice busdev;
     OHCIState ohci;
hw/usb/hcd-uhci.c +0 -16
index 7c2e9b3..5c708cf 100644
@@ -29,7 +29,6 @@
 #include "hw/usb.h"
 #include "hw/pci.h"
 #include "qemu-timer.h"
-#include "hw/usb-uhci.h"
 #include "iov.h"
 #include "dma.h"
 
@@ -1391,18 +1390,3 @@ static void uhci_register_types(void)
 }
 
 type_init(uhci_register_types)
-
-void usb_uhci_piix3_init(PCIBus *bus, int devfn)
-{
-    pci_create_simple(bus, devfn, "piix3-usb-uhci");
-}
-
-void usb_uhci_piix4_init(PCIBus *bus, int devfn)
-{
-    pci_create_simple(bus, devfn, "piix4-usb-uhci");
-}
-
-void usb_uhci_vt82c686b_init(PCIBus *bus, int devfn)
-{
-    pci_create_simple(bus, devfn, "vt82c686b-usb-uhci");
-}
hw/versatilepb.c +1 -2
index b9102f4..c1687a5 100644
@@ -13,7 +13,6 @@
 #include "net.h"
 #include "sysemu.h"
 #include "pci.h"
-#include "usb-ohci.h"
 #include "boards.h"
 #include "blockdev.h"
 #include "exec-memory.h"
@@ -240,7 +239,7 @@ static void versatile_init(ram_addr_t ram_size,
         }
     }
     if (usb_enabled) {
-        usb_ohci_init_pci(pci_bus, -1);
+        pci_create_simple(pci_bus, -1, "pci-ohci");
     }
     n = drive_get_max_bus(IF_SCSI);
     while (n >= 0) {
Signature · 1 line
1.7.1
#8 lore raw
In reply to Gerd Hoffmann

Am 08.03.2012 10:16, schrieb Gerd Hoffmann:

Quoted 3 lines

Plan is basically to move all usb stuff to hw/usb/

Comments?

hw/usb/ is fine with me (hw/ide/ is precedence), but I strongly dislike the dev-*.c convention you've used:

For one thing, we'd have to rename 90+% of hw/ to be consistent.

For another, dev-foo.c is not natural English for a certain type of device - foo-dev.c would be better but I'd prefer without "dev", i.e., hw/usb/{audio,ccid,...}.c. And then of course only devices should go into hw/.

Also, Anthony was recently talking about building up a new Linux-like directory structure inside qom/ but I don't see that working yet and renames are cheap in git anyway, so I guess that's no reason against hw/usb/ as an interim improvement.

Anthony further said he had a patch to avoid having to create subdirectories in configure for the out-of-tree builds. That would simplify both this and my *-user QOM series. Any update on that?

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#9 lore raw

Hi,

Quoted 4 lines

For another, dev-foo.c is not natural English for a certain type of device - foo-dev.c would be better but I'd prefer without "dev", i.e., hw/usb/{audio,ccid,...}.c. And then of course only devices should go into hw/.

I want a prefix because with prefixing you get the files nicely grouped in directory listings, without creating another directory level, which would IMHO be overkill for the number of files we have here.

'dev-*' is used for emulated usb devices (mouse, stick, ...), 'hcd-*' is used for emulated usb host adapters (uhci, ehci, ...), 'host-*' is used for host device pass-through code.

'dev-' isn't the greated pick as it is somewhat generic indeed. I've also considered 'emu-' (to contrast with host-*), but it has pretty much the same issue. Other suggestions?

cheers,
Gerd

#10 lore raw
Quoted 7 lines · Gerd Hoffmann

Hi,

Quoted 4 lines

For another, dev-foo.c is not natural English for a certain type of device - foo-dev.c would be better but I'd prefer without "dev", i.e., hw/usb/{audio,ccid,...}.c. And then of course only devices should go into hw/.

Quoted 7 lines

I want a prefix because with prefixing you get the files nicely grouped in directory listings, without creating another directory level, which would IMHO be overkill for the number of files we have here.

'dev-*' is used for emulated usb devices (mouse, stick, ...), 'hcd-*' is used for emulated usb host adapters (uhci, ehci, ...), 'host-*' is used for host device pass-through code.

Which are also devices, depending on your point of view :)

Quoted 3 lines

'dev-' isn't the greated pick as it is somewhat generic indeed. I've also considered 'emu-' (to contrast with host-*), but it has pretty much the same issue. Other suggestions?

Looks like all your dev- actually start with dev-usb-. If you drop the dev- prefix and keep the other prefixes, you get the grouping you want.

Regardless, collecting the usb devices in one place is an improvement. Let's do it.

#11 lore raw

Hi,

Quoted 5 lines
Quoted 3 lines

'dev-' isn't the greated pick as it is somewhat generic indeed. I've also considered 'emu-' (to contrast with host-*), but it has pretty much the same issue. Other suggestions?

Looks like all your dev- actually start with dev-usb-.

No, they don't, I've dropped 'usb-' prefix from the filenames with the move into the usb/ directory as it would be redundant.

cheers,
Gerd

#12 lore raw
In reply to Gerd Hoffmann

Il 09/03/2012 07:50, Gerd Hoffmann ha scritto:

Quoted 11 lines

I want a prefix because with prefixing you get the files nicely grouped in directory listings, without creating another directory level, which would IMHO be overkill for the number of files we have here.

'dev-*' is used for emulated usb devices (mouse, stick, ...), 'hcd-*' is used for emulated usb host adapters (uhci, ehci, ...), 'host-*' is used for host device pass-through code.

'dev-' isn't the greated pick as it is somewhat generic indeed. I've also considered 'emu-' (to contrast with host-*), but it has pretty much the same issue. Other suggestions?

Directories? Like hw/usb/devices, hw/usb/host, hw/usb/hcd.

Paolo

#13 lore raw
In reply to Gerd Hoffmann
Quoted 5 lines · Gerd Hoffmann
   Hi,

Plan is basically to move all usb stuff to hw/usb/

Comments?

It's easy to bikeshed something like this but since it's clearly an improvement over what we have right now, I'm all for it.

Regards,

Anthony Liguori

Quoted 71 lines

cheers,
Gerd

Gerd Hoffmann (2):
usb: the big rename
usb: zap hw/ush-{ohic,uhci}.h + init wrappers

  Makefile.objs                          |   22 ++++++++++++----------
  Makefile.target                        |    2 +-
  configure                              |    4 +++-
  hw/alpha_sys.h                         |    1 -
  hw/pc_piix.c                           |    4 +---
  hw/ppc_newworld.c                      |    3 +--
  hw/ppc_oldworld.c                      |    3 +--
  hw/ppc_prep.c                          |    3 +--
  hw/realview.c                          |    3 +--
  hw/usb-ohci.h                          |    9 ---------
  hw/usb-uhci.h                          |   10 ----------
  hw/{usb-bus.c =>  usb/bus.c}            |    6 +++---
  hw/{usb.c =>  usb/core.c}               |    2 +-
  hw/{usb-desc.c =>  usb/desc.c}          |    4 ++--
  hw/{usb-desc.h =>  usb/desc.h}          |    0
  hw/{usb-audio.c =>  usb/dev-audio.c}    |    8 ++++----
  hw/{usb-bt.c =>  usb/dev-bluetooth.c}   |    6 +++---
  hw/{usb-hid.c =>  usb/dev-hid.c}        |    8 ++++----
  hw/{usb-hub.c =>  usb/dev-hub.c}        |    4 ++--
  hw/{usb-net.c =>  usb/dev-network.c}    |    4 ++--
  hw/{usb-serial.c =>  usb/dev-serial.c}  |    4 ++--
  hw/{usb-ccid.c =>  usb/dev-smartcard.c} |    0
  hw/{usb-msd.c =>  usb/dev-storage.c}    |    6 +++---
  hw/{usb-wacom.c =>  usb/dev-wacom.c}    |    6 +++---
  hw/{usb-ehci.c =>  usb/hcd-ehci.c}      |    6 +++---
  hw/{usb-musb.c =>  usb/hcd-musb.c}      |    6 +++---
  hw/{usb-ohci.c =>  usb/hcd-ohci.c}      |   16 +++++-----------
  hw/{usb-uhci.c =>  usb/hcd-uhci.c}      |   22 +++-------------------
  hw/{usb-xhci.c =>  usb/hcd-xhci.c}      |   10 +++++-----
  usb-bsd.c =>  hw/usb/host-bsd.c         |    0
  usb-linux.c =>  hw/usb/host-linux.c     |    0
  usb-stub.c =>  hw/usb/host-stub.c       |    0
  hw/{usb-libhw.c =>  usb/libhw.c}        |    2 +-
  usb-redir.c =>  hw/usb/redirect.c       |    0
  hw/versatilepb.c                       |    3 +--
  35 files changed, 71 insertions(+), 116 deletions(-)
  delete mode 100644 hw/usb-ohci.h
  delete mode 100644 hw/usb-uhci.h
  rename hw/{usb-bus.c =>  usb/bus.c} (99%)
  rename hw/{usb.c =>  usb/core.c} (99%)
  rename hw/{usb-desc.c =>  usb/desc.c} (99%)
  rename hw/{usb-desc.h =>  usb/desc.h} (100%)
  rename hw/{usb-audio.c =>  usb/dev-audio.c} (99%)
  rename hw/{usb-bt.c =>  usb/dev-bluetooth.c} (99%)
  rename hw/{usb-hid.c =>  usb/dev-hid.c} (99%)
  rename hw/{usb-hub.c =>  usb/dev-hub.c} (99%)
  rename hw/{usb-net.c =>  usb/dev-network.c} (99%)
  rename hw/{usb-serial.c =>  usb/dev-serial.c} (99%)
  rename hw/{usb-ccid.c =>  usb/dev-smartcard.c} (100%)
  rename hw/{usb-msd.c =>  usb/dev-storage.c} (99%)
  rename hw/{usb-wacom.c =>  usb/dev-wacom.c} (99%)
  rename hw/{usb-ehci.c =>  usb/hcd-ehci.c} (99%)
  rename hw/{usb-musb.c =>  usb/hcd-musb.c} (99%)
  rename hw/{usb-ohci.c =>  usb/hcd-ohci.c} (99%)
  rename hw/{usb-uhci.c =>  usb/hcd-uhci.c} (98%)
  rename hw/{usb-xhci.c =>  usb/hcd-xhci.c} (99%)

rename usb-bsd.c => hw/usb/host-bsd.c (100%) rename usb-linux.c => hw/usb/host-linux.c (100%) rename usb-stub.c => hw/usb/host-stub.c (100%) rename hw/{usb-libhw.c => usb/libhw.c} (99%) rename usb-redir.c => hw/usb/redirect.c (100%)