[virtio] scsi: Fix encoding of LUNs

virtio-scsi requires Target/LUN pairs be encoded into an 8-byte buffer
in a particular format --

1. First byte set to 1
2. Second byte set to target
3. Third and fourth byte representing a 'single level LUN structure'

Per the SCSI Architecture Manual, the single-level format we should
be using is the flat addressing method (table 6, SAM-3 T10/02-119r0) or
(tabel 9, Flat space addressing, SAM-3 T10/02-119r0).

Bits 7-6 of the low byte should be '01'. Then we should pack the 6 MSBs
of the LUN into the low byte and the 8 LSBs into the high byte.

The prior version of this code did not set the address method (implicit
Peripheral device address method) and incorrectly mashed the LUN for
that mode.

ZX-2314

Tested: With the correct loop condition CR, booted on GCE and QEMU.
Tested that expected LUNs were found and bound to virtio.so

Change-Id: I6b4a53ea16dec0962233d143660744edd012dfc8
diff --git a/system/dev/bus/virtio/scsi.cpp b/system/dev/bus/virtio/scsi.cpp
index afe1b4c..c11679a 100644
--- a/system/dev/bus/virtio/scsi.cpp
+++ b/system/dev/bus/virtio/scsi.cpp
@@ -30,7 +30,8 @@
 static void FillLUNStructure(struct virtio_scsi_req_cmd* req, uint8_t target, uint16_t lun) {
     req->lun[0] = 1;
     req->lun[1] = target;
-    memcpy(&req->lun[2], &lun, sizeof(lun));
+    req->lun[2] = 0x40 | static_cast<uint8_t>(lun >> 8);
+    req->lun[3] = static_cast<uint8_t>(lun) & 0xff;
 }
 
 zx_status_t ScsiDevice::ExecuteCommandSync(uint8_t target, uint16_t lun, uint8_t* cdb,