Skip to contentSkip to conversation

megasas: fix megasas_get_sata_addr

PATCH Superseded Paolo Bonzini 1 participant 1 message Sep 30, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 megasas: fix megasas_get_sata_addr

There are two bugs here. First, the 16-bit id loses the high 8 bits when shifted left by 24. Second, the address must be combined with an "or" or we just get zero.

---
 hw/scsi/megasas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/megasas.c +1 -1
index a04369c..aeb4728 100644
@@ -431,7 +431,7 @@ static uint64_t megasas_fw_time(void)
 static uint64_t megasas_get_sata_addr(uint16_t id)
 {
     uint64_t addr = (0x1221ULL << 48);
-    return addr & (id << 24);
+    return addr | (id << 24);
 }
 
 /*
Signature · 1 line
2.5.0