aboutsummaryrefslogtreecommitdiffstats
path: root/src/hw
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2015-07-07 12:35:34 -0400
committerKevin O'Connor <kevin@koconnor.net>2015-07-14 14:40:08 -0400
commit2dd08325fd65558527b44b94d52d8a19133cb875 (patch)
tree4515d70b779c9bd751dcf72089ebd9f84ae8379b /src/hw
parent113f5d272adad312c900ffe4c0ab7b70f76e2b96 (diff)
downloadseabios-2dd08325fd65558527b44b94d52d8a19133cb875.tar.gz
pvscsi: Handle pvscsi drives directly via 'struct disk_op_s' requests
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/hw')
-rw-r--r--src/hw/blockcmd.c4
-rw-r--r--src/hw/pvscsi.c31
-rw-r--r--src/hw/pvscsi.h2
3 files changed, 13 insertions, 24 deletions
diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c
index 684f4206..4b4798b4 100644
--- a/src/hw/blockcmd.c
+++ b/src/hw/blockcmd.c
@@ -9,7 +9,6 @@
#include "block.h" // struct disk_op_s
#include "blockcmd.h" // struct cdb_request_sense
#include "byteorder.h" // be32_to_cpu
-#include "pvscsi.h" // pvscsi_cmd_data
#include "output.h" // dprintf
#include "std/disk.h" // DISK_RET_EPARAM
#include "string.h" // memset
@@ -21,9 +20,6 @@ cdb_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize)
{
u8 type = GET_GLOBALFLAT(op->drive_gf->type);
switch (type) {
- case DTYPE_PVSCSI:
- if (!MODESEGMENT)
- return pvscsi_cmd_data(op, cdbcmd, blocksize);
default:
return DISK_RET_EPARAM;
}
diff --git a/src/hw/pvscsi.c b/src/hw/pvscsi.c
index 67d1d94f..4e98b5d5 100644
--- a/src/hw/pvscsi.c
+++ b/src/hw/pvscsi.c
@@ -206,10 +206,13 @@ pvscsi_get_rsp(struct PVSCSIRingsState *s,
return status;
}
-static int
-pvscsi_cmd(struct pvscsi_lun_s *plun, struct disk_op_s *op,
- void *cdbcmd, u16 target, u16 lun, u16 blocksize)
+int
+pvscsi_process_op(struct disk_op_s *op)
{
+ if (!CONFIG_PVSCSI)
+ return DISK_RET_EBADTRACK;
+ struct pvscsi_lun_s *plun =
+ container_of(op->drive_gf, struct pvscsi_lun_s, drive);
struct pvscsi_ring_dsc_s *ring_dsc = plun->ring_dsc;
struct PVSCSIRingsState *s = ring_dsc->ring_state;
u32 req_entries = s->reqNumEntriesLog2;
@@ -225,17 +228,19 @@ pvscsi_cmd(struct pvscsi_lun_s *plun, struct disk_op_s *op,
}
req = ring_dsc->ring_reqs + (s->reqProdIdx & MASK(req_entries));
+ int blocksize = scsi_fill_cmd(op, req->cdb, 16);
+ if (blocksize < 0)
+ return default_process_op(op);
req->bus = 0;
- req->target = target;
+ req->target = plun->target;
memset(req->lun, 0, sizeof(req->lun));
- req->lun[1] = lun;
+ req->lun[1] = plun->lun;
req->senseLen = 0;
req->senseAddr = 0;
req->cdbLen = 16;
req->vcpuHint = 0;
- memcpy(req->cdb, cdbcmd, 16);
req->tag = SIMPLE_QUEUE_TAG;
- req->flags = cdb_is_read(cdbcmd, blocksize) ?
+ req->flags = cdb_is_read(req->cdb, blocksize) ?
PVSCSI_FLAG_CMD_DIR_TOHOST : PVSCSI_FLAG_CMD_DIR_TODEVICE;
req->dataLen = op->count * blocksize;
req->dataAddr = (u32)op->buf_fl;
@@ -250,18 +255,6 @@ pvscsi_cmd(struct pvscsi_lun_s *plun, struct disk_op_s *op,
return status == 0 ? DISK_RET_SUCCESS : DISK_RET_EBADTRACK;
}
-int
-pvscsi_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize)
-{
- if (!CONFIG_PVSCSI)
- return DISK_RET_EBADTRACK;
-
- struct pvscsi_lun_s *plun =
- container_of(op->drive_gf, struct pvscsi_lun_s, drive);
-
- return pvscsi_cmd(plun, op, cdbcmd, plun->target, plun->lun, blocksize);
-}
-
static int
pvscsi_add_lun(struct pci_device *pci, void *iobase,
struct pvscsi_ring_dsc_s *ring_dsc, u8 target, u8 lun)
diff --git a/src/hw/pvscsi.h b/src/hw/pvscsi.h
index fde9f0b9..5af7dcb0 100644
--- a/src/hw/pvscsi.h
+++ b/src/hw/pvscsi.h
@@ -2,7 +2,7 @@
#define _PVSCSI_H_
struct disk_op_s;
-int pvscsi_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize);
+int pvscsi_process_op(struct disk_op_s *op);
void pvscsi_setup(void);
#endif /* _PVSCSI_H_ */