aboutsummaryrefslogtreecommitdiff
path: root/include/scsi_emul.h
diff options
context:
space:
mode:
authorSimon Glass2022-09-21 16:21:36 +0200
committerSimon Glass2022-09-25 08:30:05 -0600
commit1377d448a26aa67907ae86a84d33c02c7c9b9dcd (patch)
treec89f40de7229917d54f51138d4bacc62b637fadc /include/scsi_emul.h
parent0e0b9e94595a706d86d8a9daca572da9a7de35a0 (diff)
scsi: Move core emulation state into a new struct
In preparation for sharing the emulation code between two drivers, move some of the fields into a new struct. Use a separate header file so it can be used by various drivers. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/scsi_emul.h')
-rw-r--r--include/scsi_emul.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/scsi_emul.h b/include/scsi_emul.h
new file mode 100644
index 00000000000..dec78d239c7
--- /dev/null
+++ b/include/scsi_emul.h
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Emulation of enough SCSI commands to find and read from a unit
+ *
+ * Copyright 2022 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ *
+ * implementations of SCSI functions required so that CONFIG_SCSI can be enabled
+ * for sandbox
+ */
+
+#ifndef __scsi_emul_h
+#define __scsi_emul_h
+
+/**
+ * struct scsi_emul_info - information for emulating a SCSI device
+ *
+ * @phase: Current SCSI phase
+ * @buff_used: Number of bytes ready to transfer back to host
+ * @read_len: Number of bytes of data left in the current read command
+ * @alloc_len: Allocation length from the last incoming command
+ * @transfer_len: Transfer length from CBW header
+ */
+struct scsi_emul_info {
+ enum scsi_cmd_phase phase;
+ int buff_used;
+ int read_len;
+ int alloc_len;
+ uint transfer_len;
+};
+
+#endif