mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-18 05:28:36 -07:00
scsi: remove devs array from SCSIBus
Change the devs array into a linked list, and add a scsi_device_find function to navigate the children list instead. This lets the SCSI bus use more complex addressing, and HBAs can talk to the correct device when there are multiple LUNs per target. scsi_device_find may return another LUN on the same target if none is found that matches exactly. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
d8bb00d6d7
commit
f48a7a6e35
6 changed files with 51 additions and 53 deletions
|
|
@ -531,7 +531,7 @@ static void lsi_bad_selection(LSIState *s, uint32_t id)
|
|||
/* Initiate a SCSI layer data transfer. */
|
||||
static void lsi_do_dma(LSIState *s, int out)
|
||||
{
|
||||
uint32_t count, id;
|
||||
uint32_t count;
|
||||
target_phys_addr_t addr;
|
||||
SCSIDevice *dev;
|
||||
|
||||
|
|
@ -542,12 +542,8 @@ static void lsi_do_dma(LSIState *s, int out)
|
|||
return;
|
||||
}
|
||||
|
||||
id = (s->current->tag >> 8) & 0xf;
|
||||
dev = s->bus.devs[id];
|
||||
if (!dev) {
|
||||
lsi_bad_selection(s, id);
|
||||
return;
|
||||
}
|
||||
dev = s->current->req->dev;
|
||||
assert(dev);
|
||||
|
||||
count = s->dbc;
|
||||
if (count > s->current->dma_len)
|
||||
|
|
@ -771,7 +767,7 @@ static void lsi_do_command(LSIState *s)
|
|||
s->command_complete = 0;
|
||||
|
||||
id = (s->select_tag >> 8) & 0xf;
|
||||
dev = s->bus.devs[id];
|
||||
dev = scsi_device_find(&s->bus, id, s->current_lun);
|
||||
if (!dev) {
|
||||
lsi_bad_selection(s, id);
|
||||
return;
|
||||
|
|
@ -1202,7 +1198,7 @@ again:
|
|||
}
|
||||
s->sstat0 |= LSI_SSTAT0_WOA;
|
||||
s->scntl1 &= ~LSI_SCNTL1_IARB;
|
||||
if (id >= LSI_MAX_DEVS || !s->bus.devs[id]) {
|
||||
if (!scsi_device_find(&s->bus, id, 0)) {
|
||||
lsi_bad_selection(s, id);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1684,13 +1680,9 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
|
|||
if (val & LSI_SCNTL1_RST) {
|
||||
if (!(s->sstat0 & LSI_SSTAT0_RST)) {
|
||||
DeviceState *dev;
|
||||
int id;
|
||||
|
||||
for (id = 0; id < LSI_MAX_DEVS; id++) {
|
||||
if (s->bus.devs[id]) {
|
||||
dev = &s->bus.devs[id]->qdev;
|
||||
dev->info->reset(dev);
|
||||
}
|
||||
QTAILQ_FOREACH(dev, &s->bus.qbus.children, sibling) {
|
||||
dev->info->reset(dev);
|
||||
}
|
||||
s->sstat0 |= LSI_SSTAT0_RST;
|
||||
lsi_script_scsi_interrupt(s, LSI_SIST0_RST, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue