]> xenbits.xensource.com Git - seabios.git/commitdiff
megasas: Handle Megasas drives directly via 'struct disk_op_s' requests
authorKevin O'Connor <kevin@koconnor.net>
Tue, 7 Jul 2015 16:06:01 +0000 (12:06 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Tue, 14 Jul 2015 18:40:08 +0000 (14:40 -0400)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/block.c
src/hw/blockcmd.c
src/hw/megasas.c
src/hw/megasas.h

index b76c6e297025df05c1e5736e0efe4d9e9ef52c41..d4bf02931c0f17dc7f2dbc4a42e4dbc543a683d2 100644 (file)
@@ -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;
index 8b6c1228e4d16fae019497f6ce2d5637b5286636..b0a512b301ade7e6ceb363921ee8cdaf2407b696 100644 (file)
@@ -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);
index 66779778819eb797553484b0801e5ffc69297341..5a07ab37aae3f5ca688126e7b943f176d3e491ca 100644 (file)
@@ -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);
index 124042e1c6884c4f4da35ad783d4ef8c8f32ea27..ed0e4f0969f0df0b71fa1e716067cc8156682c02 100644 (file)
@@ -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 */