[SeaBIOS] [PATCH 11/17] megasas: Handle Megasas drives directly via 'struct disk_op_s' requests
Kevin O'Connor
kevin at koconnor.net
Tue Jul 7 21:26:15 CEST 2015
Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
src/block.c | 3 ++-
src/hw/blockcmd.c | 3 ---
src/hw/megasas.c | 12 +++++++-----
src/hw/megasas.h | 2 +-
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/block.c b/src/block.c
index b76c6e2..d4bf029 100644
--- a/src/block.c
+++ b/src/block.c
@@ -12,6 +12,7 @@
#include "hw/blockcmd.h" // cdb_*
#include "hw/esp-scsi.h" // esp_scsi_process_op
#include "hw/lsi-scsi.h" // lsi_scsi_process_op
+#include "hw/megasas.h" // megasas_process_op
#include "hw/pci.h" // pci_bdf_to_bus
#include "hw/rtc.h" // rtc_read
#include "hw/usb-msc.h" // usb_process_op
@@ -504,7 +505,7 @@ process_op_both(struct disk_op_s *op)
case DTYPE_ESP_SCSI:
return esp_scsi_process_op(op);
case DTYPE_MEGASAS:
- return scsi_process_op(op);
+ return megasas_process_op(op);
default:
if (!MODESEGMENT)
return DISK_RET_EPARAM;
diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c
index 8b6c122..b0a512b 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 "megasas.h" // megasas_cmd_data
#include "pvscsi.h" // pvscsi_cmd_data
#include "output.h" // dprintf
#include "std/disk.h" // DISK_RET_EPARAM
@@ -23,8 +22,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_MEGASAS:
- return megasas_cmd_data(op, cdbcmd, blocksize);
case DTYPE_VIRTIO_SCSI:
if (!MODESEGMENT)
return virtio_scsi_cmd_data(op, cdbcmd, blocksize);
diff --git a/src/hw/megasas.c b/src/hw/megasas.c
index 6677977..5a07ab3 100644
--- a/src/hw/megasas.c
+++ b/src/hw/megasas.c
@@ -157,18 +157,20 @@ static int megasas_fire_cmd(u16 pci_id, u32 ioaddr,
}
int
-megasas_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize)
+megasas_process_op(struct disk_op_s *op)
{
+ if (!CONFIG_MEGASAS)
+ return DISK_RET_EBADTRACK;
+ u8 cdb[16];
+ int blocksize = scsi_fill_cmd(op, cdb, sizeof(cdb));
+ if (blocksize < 0)
+ return default_process_op(op);
struct megasas_lun_s *mlun_gf =
container_of(op->drive_gf, struct megasas_lun_s, drive);
- u8 *cdb = cdbcmd;
struct megasas_cmd_frame *frame = GET_GLOBALFLAT(mlun_gf->frame);
u16 pci_id = GET_GLOBALFLAT(mlun_gf->pci_id);
int i;
- if (!CONFIG_MEGASAS)
- return DISK_RET_EBADTRACK;
-
memset_fl(frame, 0, sizeof(*frame));
SET_LOWFLAT(frame->cmd, MFI_CMD_LD_SCSI_IO);
SET_LOWFLAT(frame->cmd_status, 0xFF);
diff --git a/src/hw/megasas.h b/src/hw/megasas.h
index 124042e..ed0e4f0 100644
--- a/src/hw/megasas.h
+++ b/src/hw/megasas.h
@@ -2,7 +2,7 @@
#define __MEGASAS_H
struct disk_op_s;
-int megasas_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize);
+int megasas_process_op(struct disk_op_s *op);
void megasas_setup(void);
#endif /* __MEGASAS_H */
--
1.9.3
More information about the SeaBIOS
mailing list