[SeaBIOS] [PATCH 1/2] edd: Pass the segment/offset from int 1348 calls using a 'struct segoff_s'

Kevin O'Connor kevin at koconnor.net
Thu Aug 13 15:49:09 CET 2015


Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/block.c | 16 +++++++++-------
 src/block.h |  2 +-
 src/disk.c  |  2 +-
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/block.c b/src/block.c
index a1054ac..cd732c1 100644
--- a/src/block.c
+++ b/src/block.c
@@ -288,10 +288,12 @@ map_floppy_drive(struct drive_s *drive)
  ****************************************************************/
 
 static int
-fill_generic_edd(u16 seg, struct int13dpt_s *param_far, struct drive_s *drive_gf
+fill_generic_edd(struct segoff_s edd, struct drive_s *drive_gf
                  , u32 dpte_so, char *iface_type
                  , int bdf, u8 channel, u16 iobase, u64 device_path)
 {
+    u16 seg = edd.seg;
+    struct int13dpt_s *param_far = (void*)(edd.offset+0);
     u16 size = GET_FARVAR(seg, param_far->size);
     u16 t13 = size == 74;
 
@@ -394,7 +396,7 @@ fill_generic_edd(u16 seg, struct int13dpt_s *param_far, struct drive_s *drive_gf
 struct dpte_s DefaultDPTE VARLOW;
 
 static int
-fill_ata_edd(u16 seg, struct int13dpt_s *param_far, struct drive_s *drive_gf)
+fill_ata_edd(struct segoff_s edd, struct drive_s *drive_gf)
 {
     if (!CONFIG_ATA)
         return DISK_RET_EPARAM;
@@ -446,24 +448,24 @@ fill_ata_edd(u16 seg, struct int13dpt_s *param_far, struct drive_s *drive_gf)
     SET_LOW(DefaultDPTE.checksum, -sum);
 
     return fill_generic_edd(
-        seg, param_far, drive_gf, SEGOFF(SEG_LOW, (u32)&DefaultDPTE).segoff
+        edd, drive_gf, SEGOFF(SEG_LOW, (u32)&DefaultDPTE).segoff
         , "ATA     ", bdf, channel, iobase1, slave);
 }
 
 int noinline
-fill_edd(u16 seg, struct int13dpt_s *param_far, struct drive_s *drive_gf)
+fill_edd(struct segoff_s edd, struct drive_s *drive_gf)
 {
     switch (GET_GLOBALFLAT(drive_gf->type)) {
     case DTYPE_ATA:
     case DTYPE_ATA_ATAPI:
-        return fill_ata_edd(seg, param_far, drive_gf);
+        return fill_ata_edd(edd, drive_gf);
     case DTYPE_VIRTIO_BLK:
     case DTYPE_VIRTIO_SCSI:
         return fill_generic_edd(
-            seg, param_far, drive_gf, 0xffffffff
+            edd, drive_gf, 0xffffffff
             , "SCSI    ", GET_GLOBALFLAT(drive_gf->cntl_id), 0, 0, 0);
     default:
-        return fill_generic_edd(seg, param_far, drive_gf, 0, NULL, 0, 0, 0, 0);
+        return fill_generic_edd(edd, drive_gf, 0, NULL, 0, 0, 0, 0);
     }
 }
 
diff --git a/src/block.h b/src/block.h
index 702f357..2ff359f 100644
--- a/src/block.h
+++ b/src/block.h
@@ -110,7 +110,7 @@ void map_floppy_drive(struct drive_s *drive);
 void map_hd_drive(struct drive_s *drive);
 void map_cd_drive(struct drive_s *drive);
 struct int13dpt_s;
-int fill_edd(u16 seg, struct int13dpt_s *param_far, struct drive_s *drive_gf);
+int fill_edd(struct segoff_s edd, struct drive_s *drive_gf);
 int default_process_op(struct disk_op_s *op);
 int process_op(struct disk_op_s *op);
 int send_disk_op(struct disk_op_s *op);
diff --git a/src/disk.c b/src/disk.c
index 91d939a..3854d00 100644
--- a/src/disk.c
+++ b/src/disk.c
@@ -522,7 +522,7 @@ disk_1347(struct bregs *regs, struct drive_s *drive_gf)
 static void
 disk_1348(struct bregs *regs, struct drive_s *drive_gf)
 {
-    int ret = fill_edd(regs->ds, (void*)(regs->si+0), drive_gf);
+    int ret = fill_edd(SEGOFF(regs->ds, regs->si), drive_gf);
     disk_ret(regs, ret);
 }
 
-- 
1.9.3




More information about the SeaBIOS mailing list