summaryrefslogtreecommitdiffstats
path: root/include/hw
diff options
context:
space:
mode:
authorGerd Hoffmann2021-03-12 10:04:22 +0100
committerGerd Hoffmann2021-03-15 17:01:12 +0100
commitbbd8323d3196c9979385cba1b8b38859836e63c3 (patch)
tree1e5f378ad034c1dfdc15def8712358a2749722be /include/hw
parenthw/usb: Extract VT82C686 UHCI PCI function into a new unit (diff)
downloadqemu-bbd8323d3196c9979385cba1b8b38859836e63c3.tar.gz
qemu-bbd8323d3196c9979385cba1b8b38859836e63c3.tar.xz
qemu-bbd8323d3196c9979385cba1b8b38859836e63c3.zip
usb/storage: move declarations to usb/msd.h header
In preparation for splitting the usb-storage.c file move declarations to the new usb/msd.h header file. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20210312090425.772900-2-kraxel@redhat.com>
Diffstat (limited to 'include/hw')
-rw-r--r--include/hw/usb/msd.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/include/hw/usb/msd.h b/include/hw/usb/msd.h
new file mode 100644
index 0000000000..7538c54569
--- /dev/null
+++ b/include/hw/usb/msd.h
@@ -0,0 +1,54 @@
+/*
+ * USB Mass Storage Device emulation
+ *
+ * Copyright (c) 2006 CodeSourcery.
+ * Written by Paul Brook
+ *
+ * This code is licensed under the LGPL.
+ */
+
+#include "hw/usb.h"
+#include "hw/scsi/scsi.h"
+
+enum USBMSDMode {
+ USB_MSDM_CBW, /* Command Block. */
+ USB_MSDM_DATAOUT, /* Transfer data to device. */
+ USB_MSDM_DATAIN, /* Transfer data from device. */
+ USB_MSDM_CSW /* Command Status. */
+};
+
+struct usb_msd_csw {
+ uint32_t sig;
+ uint32_t tag;
+ uint32_t residue;
+ uint8_t status;
+};
+
+struct MSDState {
+ USBDevice dev;
+ enum USBMSDMode mode;
+ uint32_t scsi_off;
+ uint32_t scsi_len;
+ uint32_t data_len;
+ struct usb_msd_csw csw;
+ SCSIRequest *req;
+ SCSIBus bus;
+ /* For async completion. */
+ USBPacket *packet;
+ /* usb-storage only */
+ BlockConf conf;
+ bool removable;
+ bool commandlog;
+ SCSIDevice *scsi_dev;
+};
+
+typedef struct MSDState MSDState;
+#define TYPE_USB_STORAGE "usb-storage-dev"
+DECLARE_INSTANCE_CHECKER(MSDState, USB_STORAGE_DEV,
+ TYPE_USB_STORAGE)
+
+void usb_msd_transfer_data(SCSIRequest *req, uint32_t len);
+void usb_msd_command_complete(SCSIRequest *req, size_t resid);
+void usb_msd_request_cancelled(SCSIRequest *req);
+void *usb_msd_load_request(QEMUFile *f, SCSIRequest *req);
+void usb_msd_handle_reset(USBDevice *dev);