Simon Glass | 4c92a4d | 2022-09-21 16:21:36 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Emulation of enough SCSI commands to find and read from a unit |
| 4 | * |
| 5 | * Copyright 2022 Google LLC |
| 6 | * Written by Simon Glass <sjg@chromium.org> |
| 7 | * |
| 8 | * implementations of SCSI functions required so that CONFIG_SCSI can be enabled |
| 9 | * for sandbox |
| 10 | */ |
| 11 | |
| 12 | #ifndef __scsi_emul_h |
| 13 | #define __scsi_emul_h |
| 14 | |
| 15 | /** |
| 16 | * struct scsi_emul_info - information for emulating a SCSI device |
| 17 | * |
| 18 | * @phase: Current SCSI phase |
| 19 | * @buff_used: Number of bytes ready to transfer back to host |
| 20 | * @read_len: Number of bytes of data left in the current read command |
| 21 | * @alloc_len: Allocation length from the last incoming command |
| 22 | * @transfer_len: Transfer length from CBW header |
Simon Glass | 293c43f | 2022-09-21 16:21:37 +0200 | [diff] [blame^] | 23 | * @buff: Data buffer for outgoing data |
Simon Glass | 4c92a4d | 2022-09-21 16:21:36 +0200 | [diff] [blame] | 24 | */ |
| 25 | struct scsi_emul_info { |
Simon Glass | 293c43f | 2022-09-21 16:21:37 +0200 | [diff] [blame^] | 26 | /* provided by the caller: */ |
| 27 | void *buff; |
| 28 | |
| 29 | /* state maintained by the emulator: */ |
Simon Glass | 4c92a4d | 2022-09-21 16:21:36 +0200 | [diff] [blame] | 30 | enum scsi_cmd_phase phase; |
| 31 | int buff_used; |
| 32 | int read_len; |
| 33 | int alloc_len; |
| 34 | uint transfer_len; |
| 35 | }; |
| 36 | |
| 37 | #endif |