[SLOF] [PATCH] virtio-scsi: Allow LUNs bigger than 255

Thomas Huth thuth at redhat.com
Tue Jul 18 22:11:04 AEST 2017

The virtio-scsi device expects LUNs according to a "Single level LUN
structure" as defined in the "SCSI Architecture Model" specification.
SLOF currently only uses the "Single level LUN structure using
peripheral device addressing method" which provides the possibility
to specify up to 256 different LUNs.
To be able to use LUNs greater than 255, the "Single level LUN structure
using flat space addressing method" has to be used instead. This can
be done by setting the top-most bits to "01" instead of "00" in the first
byte of the two LUN bytes.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1431584
Signed-off-by: Thomas Huth <thuth at redhat.com>
 board-qemu/slof/virtio-scsi.fs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board-qemu/slof/virtio-scsi.fs b/board-qemu/slof/virtio-scsi.fs
index d52741e..d7ce3cc 100644
--- a/board-qemu/slof/virtio-scsi.fs
+++ b/board-qemu/slof/virtio-scsi.fs
@@ -144,6 +144,7 @@ scsi-open
 : dev-generate-srplun ( target lun-id -- srplun )
+    dup ff > IF 4000 or THEN    \ Use the LUN "flat space addressing method"
     swap 0100 or 10 << or 20 <<

More information about the SLOF mailing list