mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 18:05:37 +00:00
switch scsi bus to inplace allocation.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
cd739fb6e9
commit
ca9c39faed
10
hw/esp.c
10
hw/esp.c
|
@ -63,7 +63,7 @@ struct ESPState {
|
|||
uint8_t ti_buf[TI_BUFSZ];
|
||||
uint32_t sense;
|
||||
uint32_t dma;
|
||||
SCSIBus *bus;
|
||||
SCSIBus bus;
|
||||
SCSIDevice *current_dev;
|
||||
uint8_t cmdbuf[TI_BUFSZ];
|
||||
uint32_t cmdlen;
|
||||
|
@ -191,7 +191,7 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf)
|
|||
s->async_len = 0;
|
||||
}
|
||||
|
||||
if (target >= ESP_MAX_DEVS || !s->bus->devs[target]) {
|
||||
if (target >= ESP_MAX_DEVS || !s->bus.devs[target]) {
|
||||
// No such drive
|
||||
s->rregs[ESP_RSTAT] = 0;
|
||||
s->rregs[ESP_RINTR] = INTR_DC;
|
||||
|
@ -199,7 +199,7 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf)
|
|||
esp_raise_irq(s);
|
||||
return 0;
|
||||
}
|
||||
s->current_dev = s->bus->devs[target];
|
||||
s->current_dev = s->bus.devs[target];
|
||||
return dmalen;
|
||||
}
|
||||
|
||||
|
@ -672,8 +672,8 @@ static int esp_init1(SysBusDevice *dev)
|
|||
|
||||
qdev_init_gpio_in(&dev->qdev, parent_esp_reset, 1);
|
||||
|
||||
s->bus = scsi_bus_new(&dev->qdev, 0, ESP_MAX_DEVS, esp_command_complete);
|
||||
scsi_bus_legacy_handle_cmdline(s->bus);
|
||||
scsi_bus_new(&s->bus, &dev->qdev, 0, ESP_MAX_DEVS, esp_command_complete);
|
||||
scsi_bus_legacy_handle_cmdline(&s->bus);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ typedef struct {
|
|||
* 2 if processing DMA from lsi_execute_script.
|
||||
* 3 if a DMA operation is in progress. */
|
||||
int waiting;
|
||||
SCSIBus *bus;
|
||||
SCSIBus bus;
|
||||
SCSIDevice *current_dev;
|
||||
int current_lun;
|
||||
/* The tag is a combination of the device ID and the SCSI tag. */
|
||||
|
@ -585,7 +585,7 @@ static void lsi_reselect(LSIState *s, uint32_t tag)
|
|||
id = (tag >> 8) & 0xf;
|
||||
s->ssid = id | 0x80;
|
||||
DPRINTF("Reselected target %d\n", id);
|
||||
s->current_dev = s->bus->devs[id];
|
||||
s->current_dev = s->bus.devs[id];
|
||||
s->current_tag = tag;
|
||||
s->scntl1 |= LSI_SCNTL1_CON;
|
||||
lsi_set_phase(s, PHASE_MI);
|
||||
|
@ -1041,7 +1041,7 @@ again:
|
|||
}
|
||||
s->sstat0 |= LSI_SSTAT0_WOA;
|
||||
s->scntl1 &= ~LSI_SCNTL1_IARB;
|
||||
if (id >= LSI_MAX_DEVS || !s->bus->devs[id]) {
|
||||
if (id >= LSI_MAX_DEVS || !s->bus.devs[id]) {
|
||||
DPRINTF("Selected absent target %d\n", id);
|
||||
lsi_script_scsi_interrupt(s, 0, LSI_SIST1_STO);
|
||||
lsi_disconnect(s);
|
||||
|
@ -1052,7 +1052,7 @@ again:
|
|||
/* ??? Linux drivers compain when this is set. Maybe
|
||||
it only applies in low-level mode (unimplemented).
|
||||
lsi_script_scsi_interrupt(s, LSI_SIST0_CMP, 0); */
|
||||
s->current_dev = s->bus->devs[id];
|
||||
s->current_dev = s->bus.devs[id];
|
||||
s->current_tag = id << 8;
|
||||
s->scntl1 |= LSI_SCNTL1_CON;
|
||||
if (insn & (1 << 3)) {
|
||||
|
@ -2178,8 +2178,8 @@ static int lsi_scsi_init(PCIDevice *dev)
|
|||
|
||||
lsi_soft_reset(s);
|
||||
|
||||
s->bus = scsi_bus_new(&dev->qdev, 1, LSI_MAX_DEVS, lsi_command_complete);
|
||||
scsi_bus_legacy_handle_cmdline(s->bus);
|
||||
scsi_bus_new(&s->bus, &dev->qdev, 1, LSI_MAX_DEVS, lsi_command_complete);
|
||||
scsi_bus_legacy_handle_cmdline(&s->bus);
|
||||
register_savevm("lsiscsi", -1, 0, lsi_scsi_save, lsi_scsi_load, s);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -15,17 +15,14 @@ static struct BusInfo scsi_bus_info = {
|
|||
static int next_scsi_bus;
|
||||
|
||||
/* Create a scsi bus, and attach devices to it. */
|
||||
SCSIBus *scsi_bus_new(DeviceState *host, int tcq, int ndev,
|
||||
scsi_completionfn complete)
|
||||
void scsi_bus_new(SCSIBus *bus, DeviceState *host, int tcq, int ndev,
|
||||
scsi_completionfn complete)
|
||||
{
|
||||
SCSIBus *bus;
|
||||
|
||||
bus = FROM_QBUS(SCSIBus, qbus_create(&scsi_bus_info, host, NULL));
|
||||
qbus_create_inplace(&bus->qbus, &scsi_bus_info, host, NULL);
|
||||
bus->busnr = next_scsi_bus++;
|
||||
bus->tcq = tcq;
|
||||
bus->ndev = ndev;
|
||||
bus->complete = complete;
|
||||
return bus;
|
||||
}
|
||||
|
||||
static int scsi_qdev_init(DeviceState *qdev, DeviceInfo *base)
|
||||
|
|
|
@ -52,8 +52,8 @@ struct SCSIBus {
|
|||
SCSIDevice *devs[8];
|
||||
};
|
||||
|
||||
SCSIBus *scsi_bus_new(DeviceState *host, int tcq, int ndev,
|
||||
scsi_completionfn complete);
|
||||
void scsi_bus_new(SCSIBus *bus, DeviceState *host, int tcq, int ndev,
|
||||
scsi_completionfn complete);
|
||||
void scsi_qdev_register(SCSIDeviceInfo *info);
|
||||
|
||||
static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d)
|
||||
|
|
|
@ -45,7 +45,7 @@ typedef struct {
|
|||
uint32_t data_len;
|
||||
uint32_t residue;
|
||||
uint32_t tag;
|
||||
SCSIBus *bus;
|
||||
SCSIBus bus;
|
||||
DriveInfo *dinfo;
|
||||
SCSIDevice *scsi_dev;
|
||||
int result;
|
||||
|
@ -527,8 +527,8 @@ static int usb_msd_initfn(USBDevice *dev)
|
|||
}
|
||||
|
||||
s->dev.speed = USB_SPEED_FULL;
|
||||
s->bus = scsi_bus_new(&s->dev.qdev, 0, 1, usb_msd_command_complete);
|
||||
s->scsi_dev = scsi_bus_legacy_add_drive(s->bus, s->dinfo, 0);
|
||||
scsi_bus_new(&s->bus, &s->dev.qdev, 0, 1, usb_msd_command_complete);
|
||||
s->scsi_dev = scsi_bus_legacy_add_drive(&s->bus, s->dinfo, 0);
|
||||
usb_msd_handle_reset(dev);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue