mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06: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
8
hw/esp.c
8
hw/esp.c
|
@ -217,7 +217,8 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf)
|
|||
s->async_len = 0;
|
||||
}
|
||||
|
||||
if (target >= ESP_MAX_DEVS || !s->bus.devs[target]) {
|
||||
s->current_dev = scsi_device_find(&s->bus, target, 0);
|
||||
if (!s->current_dev) {
|
||||
// No such drive
|
||||
s->rregs[ESP_RSTAT] = 0;
|
||||
s->rregs[ESP_RINTR] = INTR_DC;
|
||||
|
@ -225,7 +226,6 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf)
|
|||
esp_raise_irq(s);
|
||||
return 0;
|
||||
}
|
||||
s->current_dev = s->bus.devs[target];
|
||||
return dmalen;
|
||||
}
|
||||
|
||||
|
@ -233,10 +233,12 @@ static void do_busid_cmd(ESPState *s, uint8_t *buf, uint8_t busid)
|
|||
{
|
||||
int32_t datalen;
|
||||
int lun;
|
||||
SCSIDevice *current_lun;
|
||||
|
||||
trace_esp_do_busid_cmd(busid);
|
||||
lun = busid & 7;
|
||||
s->current_req = scsi_req_new(s->current_dev, 0, lun, buf, NULL);
|
||||
current_lun = scsi_device_find(&s->bus, s->current_dev->id, lun);
|
||||
s->current_req = scsi_req_new(current_lun, 0, lun, buf, NULL);
|
||||
datalen = scsi_req_enqueue(s->current_req);
|
||||
s->ti_size = datalen;
|
||||
if (datalen != 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue