qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 02/16] scsi: Increase the number of possible devices
@ 2010-11-18 14:46 Hannes Reinecke
  2010-11-19 18:28 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Hannes Reinecke @ 2010-11-18 14:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, nab, kraxel


The SCSI parallel interface has a limite of 8 devices, but
not the SCSI stack in general. So we should be removing the
hard-coded limit and use MAX_SCSI_DEVS instead.
And we only need to scan those devices which are allocated
by the bus.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 blockdev.h    |    2 +-
 hw/scsi-bus.c |    2 +-
 hw/scsi.h     |    3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/blockdev.h b/blockdev.h
index 653affc..451dc06 100644
--- a/blockdev.h
+++ b/blockdev.h
@@ -32,7 +32,7 @@ struct DriveInfo {
 };
 
 #define MAX_IDE_DEVS	2
-#define MAX_SCSI_DEVS	7
+#define MAX_SCSI_DEVS	255
 
 DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit);
 int drive_get_max_bus(BlockInterfaceType type);
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 5a3fd4b..74a08b7 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -108,7 +108,7 @@ int scsi_bus_legacy_handle_cmdline(SCSIBus *bus)
     int res = 0, unit;
 
     loc_push_none(&loc);
-    for (unit = 0; unit < MAX_SCSI_DEVS; unit++) {
+    for (unit = 0; unit < bus->ndev; unit++) {
         dinfo = drive_get(IF_SCSI, bus->busnr, unit);
         if (dinfo == NULL) {
             continue;
diff --git a/hw/scsi.h b/hw/scsi.h
index cb06d6d..9c798ae 100644
--- a/hw/scsi.h
+++ b/hw/scsi.h
@@ -3,6 +3,7 @@
 
 #include "qdev.h"
 #include "block.h"
+#include "blockdev.h"
 #include "block_int.h"
 
 #define SCSI_CMD_BUF_SIZE     16
@@ -86,7 +87,7 @@ struct SCSIBus {
     int tcq, ndev;
     scsi_completionfn complete;
 
-    SCSIDevice *devs[8];
+    SCSIDevice *devs[MAX_SCSI_DEVS];
 };
 
 void scsi_bus_new(SCSIBus *bus, DeviceState *host, int tcq, int ndev,
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH 02/16] scsi: Increase the number of possible devices
  2010-11-18 14:46 [Qemu-devel] [PATCH 02/16] scsi: Increase the number of possible devices Hannes Reinecke
@ 2010-11-19 18:28 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2010-11-19 18:28 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: stefanha, qemu-devel, nab, kraxel

On Thu, Nov 18, 2010 at 03:46:25PM +0100, Hannes Reinecke wrote:
> 
> The SCSI parallel interface has a limite of 8 devices, but
> not the SCSI stack in general. So we should be removing the
> hard-coded limit and use MAX_SCSI_DEVS instead.
> And we only need to scan those devices which are allocated
> by the bus.

Looks good.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-19 18:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-18 14:46 [Qemu-devel] [PATCH 02/16] scsi: Increase the number of possible devices Hannes Reinecke
2010-11-19 18:28 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).