summaryrefslogtreecommitdiff
path: root/hw/scsi
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-09-30 19:21:10 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2015-10-12 18:29:25 +0200
commit8ef2eb8d2cad7400236d6b2c152bdb5506761b4d (patch)
treeddde42dc4248fe8986b0d673488c609fdcc67fe8 /hw/scsi
parent633dccb458c4eaa40107cd7026737d804f90b6c0 (diff)
downloadqemu-8ef2eb8d2cad7400236d6b2c152bdb5506761b4d.tar.gz
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. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi')
-rw-r--r--hw/scsi/megasas.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index a04369c5ad..dcd724e6a5 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -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 | ((uint64_t)id << 24);
}
/*