On PA-RISC it's possible to boot from various SCSI targets and LUNs.
Add fields to the drive_s struct to be able to store those.

Signed-off-by: Helge Deller <del...@gmx.de>
---
 src/block.h          | 2 ++
 src/hw/blockcmd.c    | 4 +++-
 src/hw/blockcmd.h    | 2 +-
 src/hw/esp-scsi.c    | 2 +-
 src/hw/lsi-scsi.c    | 2 +-
 src/hw/megasas.c     | 2 +-
 src/hw/mpt-scsi.c    | 2 +-
 src/hw/pvscsi.c      | 2 +-
 src/hw/usb-msc.c     | 2 +-
 src/hw/usb-uas.c     | 2 +-
 src/hw/virtio-scsi.c | 2 +-
 11 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/block.h b/src/block.h
index c1b8d73..5cd2e5d 100644
--- a/src/block.h
+++ b/src/block.h
@@ -57,6 +57,8 @@ struct drive_s {
     u8 translation;     // type of translation
     u16 blksize;        // block size
     struct chs_s pchs;  // Physical CHS
+
+    u8 target, lun;     // SCSI target and LUN
 };

 #define DISK_SECTOR_SIZE  512
diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c
index 1b447ac..89f16a8 100644
--- a/src/hw/blockcmd.c
+++ b/src/hw/blockcmd.c
@@ -286,9 +286,11 @@ int scsi_sequential_scan(struct drive_s *tmp_drive, u32 
maxluns,

 // Validate drive, find block size / sector count, and register drive.
 int
-scsi_drive_setup(struct drive_s *drive, const char *s, int prio)
+scsi_drive_setup(struct drive_s *drive, const char *s, int prio, u8 target, u8 
lun)
 {
     ASSERT32FLAT();
+    drive->target = target;
+    drive->lun = lun;
     struct disk_op_s dop;
     memset(&dop, 0, sizeof(dop));
     dop.drive_fl = drive;
diff --git a/src/hw/blockcmd.h b/src/hw/blockcmd.h
index f18543e..42e1873 100644
--- a/src/hw/blockcmd.h
+++ b/src/hw/blockcmd.h
@@ -105,7 +105,7 @@ int scsi_fill_cmd(struct disk_op_s *op, void *cdbcmd, int 
maxcdb);
 int scsi_is_read(struct disk_op_s *op);
 int scsi_is_ready(struct disk_op_s *op);
 struct drive_s;
-int scsi_drive_setup(struct drive_s *drive, const char *s, int prio);
+int scsi_drive_setup(struct drive_s *drive, const char *s, int prio, u8 
target, u8 lun);
 typedef int (*scsi_add_lun)(u32 lun, struct drive_s *tmpl_drv);
 int scsi_rep_luns_scan(struct drive_s *tmp_drive, scsi_add_lun add_lun);
 int scsi_sequential_scan(struct drive_s *tmp_drive, u32 maxluns,
diff --git a/src/hw/esp-scsi.c b/src/hw/esp-scsi.c
index cc25f22..3282437 100644
--- a/src/hw/esp-scsi.c
+++ b/src/hw/esp-scsi.c
@@ -184,7 +184,7 @@ esp_scsi_add_lun(u32 lun, struct drive_s *tmpl_drv)
     boot_lchs_find_scsi_device(llun->pci, llun->target, llun->lun,
                                &(llun->drive.lchs));
     int prio = bootprio_find_scsi_device(llun->pci, llun->target, llun->lun);
-    int ret = scsi_drive_setup(&llun->drive, name, prio);
+    int ret = scsi_drive_setup(&llun->drive, name, prio, llun->target, 
llun->lun);
     free(name);
     if (ret)
         goto fail;
diff --git a/src/hw/lsi-scsi.c b/src/hw/lsi-scsi.c
index cbaa2ac..101544e 100644
--- a/src/hw/lsi-scsi.c
+++ b/src/hw/lsi-scsi.c
@@ -163,7 +163,7 @@ lsi_scsi_add_lun(u32 lun, struct drive_s *tmpl_drv)
     char *name = znprintf(MAXDESCSIZE, "lsi %pP %d:%d",
                           llun->pci, llun->target, llun->lun);
     int prio = bootprio_find_scsi_device(llun->pci, llun->target, llun->lun);
-    int ret = scsi_drive_setup(&llun->drive, name, prio);
+    int ret = scsi_drive_setup(&llun->drive, name, prio, llun->target, 
llun->lun);
     free(name);
     if (ret)
         goto fail;
diff --git a/src/hw/megasas.c b/src/hw/megasas.c
index 87b8bee..94331d6 100644
--- a/src/hw/megasas.c
+++ b/src/hw/megasas.c
@@ -229,7 +229,7 @@ megasas_add_lun(struct pci_device *pci, u32 iobase, u8 
target, u8 lun)
     name = znprintf(MAXDESCSIZE, "MegaRAID SAS (PCI %pP) LD %d:%d"
                     , pci, target, lun);
     prio = bootprio_find_scsi_device(pci, target, lun);
-    ret = scsi_drive_setup(&mlun->drive, name, prio);
+    ret = scsi_drive_setup(&mlun->drive, name, prio, target, lun);
     free(name);
     if (ret) {
         free(mlun->frame);
diff --git a/src/hw/mpt-scsi.c b/src/hw/mpt-scsi.c
index 570b212..7dd4946 100644
--- a/src/hw/mpt-scsi.c
+++ b/src/hw/mpt-scsi.c
@@ -226,7 +226,7 @@ mpt_scsi_add_lun(u32 lun, struct drive_s *tmpl_drv)
     char *name = znprintf(MAXDESCSIZE, "mpt %pP %d:%d",
                           llun->pci, llun->target, llun->lun);
     int prio = bootprio_find_scsi_device(llun->pci, llun->target, llun->lun);
-    int ret = scsi_drive_setup(&llun->drive, name, prio);
+    int ret = scsi_drive_setup(&llun->drive, name, prio, llun->target, 
llun->lun);
     free(name);
     if (ret) {
         goto fail;
diff --git a/src/hw/pvscsi.c b/src/hw/pvscsi.c
index 3e5171a..f2e6fa9 100644
--- a/src/hw/pvscsi.c
+++ b/src/hw/pvscsi.c
@@ -276,7 +276,7 @@ pvscsi_add_lun(struct pci_device *pci, void *iobase,
     boot_lchs_find_scsi_device(pci, target, lun, &(plun->drive.lchs));
     char *name = znprintf(MAXDESCSIZE, "pvscsi %pP %d:%d", pci, target, lun);
     int prio = bootprio_find_scsi_device(pci, target, lun);
-    int ret = scsi_drive_setup(&plun->drive, name, prio);
+    int ret = scsi_drive_setup(&plun->drive, name, prio, target, lun);
     free(name);
     if (ret)
         goto fail;
diff --git a/src/hw/usb-msc.c b/src/hw/usb-msc.c
index 2b18828..444f436 100644
--- a/src/hw/usb-msc.c
+++ b/src/hw/usb-msc.c
@@ -158,7 +158,7 @@ usb_msc_lun_setup(struct usb_pipe *inpipe, struct usb_pipe 
*outpipe,
     drive->lun = lun;

     int prio = bootprio_find_usb(usbdev, lun);
-    int ret = scsi_drive_setup(&drive->drive, "USB MSC", prio);
+    int ret = scsi_drive_setup(&drive->drive, "USB MSC", prio, 0, lun);
     if (ret) {
         dprintf(1, "Unable to configure USB MSC drive.\n");
         free(drive);
diff --git a/src/hw/usb-uas.c b/src/hw/usb-uas.c
index 6a8decc..4a789b3 100644
--- a/src/hw/usb-uas.c
+++ b/src/hw/usb-uas.c
@@ -204,7 +204,7 @@ uas_add_lun(u32 lun, struct drive_s *tmpl_drv)
                  lun);

     int prio = bootprio_find_usb(drive->usbdev, drive->lun);
-    int ret = scsi_drive_setup(&drive->drive, "USB UAS", prio);
+    int ret = scsi_drive_setup(&drive->drive, "USB UAS", prio, 0, lun);
     if (ret) {
         free(drive);
         return -1;
diff --git a/src/hw/virtio-scsi.c b/src/hw/virtio-scsi.c
index 369c981..81bce22 100644
--- a/src/hw/virtio-scsi.c
+++ b/src/hw/virtio-scsi.c
@@ -148,7 +148,7 @@ virtio_scsi_add_lun(u32 lun, struct drive_s *tmpl_drv)
     if (vlun->pci)
         boot_lchs_find_scsi_device(vlun->pci, vlun->target, vlun->lun,
                                    &(vlun->drive.lchs));
-    int ret = scsi_drive_setup(&vlun->drive, "virtio-scsi", prio);
+    int ret = scsi_drive_setup(&vlun->drive, "virtio-scsi", prio, 
vlun->target, vlun->lun);
     if (ret)
         goto fail;
     return 0;
--
2.29.2
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org

Reply via email to