[SeaBIOS] [PATCH] blockcmd: CMD_SCSI op is only used in 32bit mode

Kevin O'Connor kevin at koconnor.net
Thu Aug 4 22:06:55 CEST 2016


Reduce the size of the 16bit code slightly by recognizing that
CMD_SCSI is only used in 32bit mode.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/hw/blockcmd.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c
index 093c5d7..f147100 100644
--- a/src/hw/blockcmd.c
+++ b/src/hw/blockcmd.c
@@ -118,6 +118,8 @@ scsi_fill_cmd(struct disk_op_s *op, void *cdbcmd, int maxcdb)
         cmd->count = cpu_to_be16(op->count);
         return GET_GLOBALFLAT(op->drive_gf->blksize);
     case CMD_SCSI:
+        if (MODESEGMENT)
+            return -1;
         memcpy(cdbcmd, op->cdbcmd, maxcdb);
         return op->blocksize;
     default:
@@ -129,13 +131,15 @@ scsi_fill_cmd(struct disk_op_s *op, void *cdbcmd, int maxcdb)
 int
 scsi_is_read(struct disk_op_s *op)
 {
-    return op->command == CMD_READ || (op->command == CMD_SCSI && op->blocksize);
+    return op->command == CMD_READ || (
+        !MODESEGMENT && op->command == CMD_SCSI && op->blocksize);
 }
 
 // Check if a SCSI device is ready to receive commands
 int
 scsi_is_ready(struct disk_op_s *op)
 {
+    ASSERT32FLAT();
     dprintf(6, "scsi_is_ready (drive=%p)\n", op->drive_gf);
 
     /* Retry TEST UNIT READY for 5 seconds unless MEDIUM NOT PRESENT is
@@ -181,6 +185,7 @@ scsi_is_ready(struct disk_op_s *op)
 int
 scsi_drive_setup(struct drive_s *drive, const char *s, int prio)
 {
+    ASSERT32FLAT();
     struct disk_op_s dop;
     memset(&dop, 0, sizeof(dop));
     dop.drive_gf = drive;
-- 
2.5.5




More information about the SeaBIOS mailing list