qemu-sparc queue
-----BEGIN PGP SIGNATURE----- iQFSBAABCgA8FiEEzGIauY6CIA2RXMnEW8LFb64PMh8FAmBEwfEeHG1hcmsuY2F2 ZS1heWxhbmRAaWxhbmRlLmNvLnVrAAoJEFvCxW+uDzIfYZYH/AwOuqycV9XI1s3K valsExtSmcj6oTrFTSyak0U7QL9G5pm40qEHwQkwFwYecaQXfFNMN1Mt4gYpsLai JNhV29tzWrQtNFepCjvvuJihDY5IC/3NWyrWqYXRNZ5IGMvde3HUcg210bFOC3mf iOtZ40ZjBspTwG4eJCOLBBDeXVAMkVUjdfqtsq66zGteHsJjNEpso0HLdMvlFkud QLF4g06h8iFMxwahZYEwY+fKUHphqfZn8INr01ODQIy3nBGVgenKz9DKPw/pg/UD nfxhuYwftDof65JpYEhClOWas3AztFJ1YyyP/cibwosLBQVphj3R05/kF6VuyuyP gZjux0w= =RPt3 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-20210307' into staging qemu-sparc queue # gpg: Signature made Sun 07 Mar 2021 12:07:13 GMT # gpg: using RSA key CC621AB98E82200D915CC9C45BC2C56FAE0F321F # gpg: issuer "mark.cave-ayland@ilande.co.uk" # gpg: Good signature from "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>" [full] # Primary key fingerprint: CC62 1AB9 8E82 200D 915C C9C4 5BC2 C56F AE0F 321F * remotes/mcayland/tags/qemu-sparc-20210307: (42 commits) esp: add support for unaligned accesses esp: implement non-DMA transfers in PDMA mode esp: add trivial implementation of the ESP_RFLAGS register esp: convert cmdbuf from array to Fifo8 esp: convert ti_buf from array to Fifo8 esp: transition to message out phase after SATN and stop command esp: add maxlen parameter to get_cmd() esp: raise interrupt after every non-DMA byte transferred to the FIFO esp: remove old deferred command completion mechanism esp: defer command completion interrupt on incoming data transfers esp: latch individual bits in ESP_RINTR register esp: implement FIFO flush command esp: add 4 byte PDMA read and write transfers esp: remove pdma_origin from ESPState esp: use FIFO for PDMA transfers between initiator and device esp: fix PDMA target selection esp: rename get_cmd_cb() to esp_select() esp: remove CMD pdma_origin esp: use in-built TC to determine PDMA transfer length esp: use ti_wptr/ti_rptr to manage the current FIFO position for PDMA ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
b2ae1009d7
@ -295,13 +295,13 @@ static void sparc32_espdma_device_init(Object *obj)
|
||||
memory_region_init_io(&s->iomem, OBJECT(s), &dma_mem_ops, s,
|
||||
"espdma-mmio", DMA_SIZE);
|
||||
|
||||
object_initialize_child(obj, "esp", &es->esp, TYPE_ESP);
|
||||
object_initialize_child(obj, "esp", &es->esp, TYPE_SYSBUS_ESP);
|
||||
}
|
||||
|
||||
static void sparc32_espdma_device_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
ESPDMADeviceState *es = SPARC32_ESPDMA_DEVICE(dev);
|
||||
SysBusESPState *sysbus = ESP(&es->esp);
|
||||
SysBusESPState *sysbus = SYSBUS_ESP(&es->esp);
|
||||
ESPState *esp = &sysbus->esp;
|
||||
|
||||
esp->dma_memory_read = espdma_memory_read;
|
||||
|
@ -350,8 +350,8 @@ static void q800_init(MachineState *machine)
|
||||
|
||||
/* SCSI */
|
||||
|
||||
dev = qdev_new(TYPE_ESP);
|
||||
sysbus_esp = ESP(dev);
|
||||
dev = qdev_new(TYPE_SYSBUS_ESP);
|
||||
sysbus_esp = SYSBUS_ESP(dev);
|
||||
esp = &sysbus_esp->esp;
|
||||
esp->dma_memory_read = NULL;
|
||||
esp->dma_memory_write = NULL;
|
||||
|
@ -328,8 +328,8 @@ static void mips_jazz_init(MachineState *machine,
|
||||
}
|
||||
|
||||
/* SCSI adapter */
|
||||
dev = qdev_new(TYPE_ESP);
|
||||
sysbus_esp = ESP(dev);
|
||||
dev = qdev_new(TYPE_SYSBUS_ESP);
|
||||
sysbus_esp = SYSBUS_ESP(dev);
|
||||
esp = &sysbus_esp->esp;
|
||||
esp->dma_memory_read = rc4030_dma_read;
|
||||
esp->dma_memory_write = rc4030_dma_write;
|
||||
|
@ -79,8 +79,10 @@ struct PCIESPState {
|
||||
|
||||
static void esp_pci_handle_idle(PCIESPState *pci, uint32_t val)
|
||||
{
|
||||
ESPState *s = ESP(&pci->esp);
|
||||
|
||||
trace_esp_pci_dma_idle(val);
|
||||
esp_dma_enable(&pci->esp, 0, 0);
|
||||
esp_dma_enable(s, 0, 0);
|
||||
}
|
||||
|
||||
static void esp_pci_handle_blast(PCIESPState *pci, uint32_t val)
|
||||
@ -91,14 +93,18 @@ static void esp_pci_handle_blast(PCIESPState *pci, uint32_t val)
|
||||
|
||||
static void esp_pci_handle_abort(PCIESPState *pci, uint32_t val)
|
||||
{
|
||||
ESPState *s = ESP(&pci->esp);
|
||||
|
||||
trace_esp_pci_dma_abort(val);
|
||||
if (pci->esp.current_req) {
|
||||
scsi_req_cancel(pci->esp.current_req);
|
||||
if (s->current_req) {
|
||||
scsi_req_cancel(s->current_req);
|
||||
}
|
||||
}
|
||||
|
||||
static void esp_pci_handle_start(PCIESPState *pci, uint32_t val)
|
||||
{
|
||||
ESPState *s = ESP(&pci->esp);
|
||||
|
||||
trace_esp_pci_dma_start(val);
|
||||
|
||||
pci->dma_regs[DMA_WBC] = pci->dma_regs[DMA_STC];
|
||||
@ -109,7 +115,7 @@ static void esp_pci_handle_start(PCIESPState *pci, uint32_t val)
|
||||
| DMA_STAT_DONE | DMA_STAT_ABORT
|
||||
| DMA_STAT_ERROR | DMA_STAT_PWDN);
|
||||
|
||||
esp_dma_enable(&pci->esp, 0, 1);
|
||||
esp_dma_enable(s, 0, 1);
|
||||
}
|
||||
|
||||
static void esp_pci_dma_write(PCIESPState *pci, uint32_t saddr, uint32_t val)
|
||||
@ -155,11 +161,12 @@ static void esp_pci_dma_write(PCIESPState *pci, uint32_t saddr, uint32_t val)
|
||||
|
||||
static uint32_t esp_pci_dma_read(PCIESPState *pci, uint32_t saddr)
|
||||
{
|
||||
ESPState *s = ESP(&pci->esp);
|
||||
uint32_t val;
|
||||
|
||||
val = pci->dma_regs[saddr];
|
||||
if (saddr == DMA_STAT) {
|
||||
if (pci->esp.rregs[ESP_RSTAT] & STAT_INT) {
|
||||
if (s->rregs[ESP_RSTAT] & STAT_INT) {
|
||||
val |= DMA_STAT_SCSIINT;
|
||||
}
|
||||
if (!(pci->sbac & SBAC_STATUS)) {
|
||||
@ -176,6 +183,7 @@ static void esp_pci_io_write(void *opaque, hwaddr addr,
|
||||
uint64_t val, unsigned int size)
|
||||
{
|
||||
PCIESPState *pci = opaque;
|
||||
ESPState *s = ESP(&pci->esp);
|
||||
|
||||
if (size < 4 || addr & 3) {
|
||||
/* need to upgrade request: we only support 4-bytes accesses */
|
||||
@ -183,7 +191,7 @@ static void esp_pci_io_write(void *opaque, hwaddr addr,
|
||||
int shift;
|
||||
|
||||
if (addr < 0x40) {
|
||||
current = pci->esp.wregs[addr >> 2];
|
||||
current = s->wregs[addr >> 2];
|
||||
} else if (addr < 0x60) {
|
||||
current = pci->dma_regs[(addr - 0x40) >> 2];
|
||||
} else if (addr < 0x74) {
|
||||
@ -203,7 +211,7 @@ static void esp_pci_io_write(void *opaque, hwaddr addr,
|
||||
|
||||
if (addr < 0x40) {
|
||||
/* SCSI core reg */
|
||||
esp_reg_write(&pci->esp, addr >> 2, val);
|
||||
esp_reg_write(s, addr >> 2, val);
|
||||
} else if (addr < 0x60) {
|
||||
/* PCI DMA CCB */
|
||||
esp_pci_dma_write(pci, (addr - 0x40) >> 2, val);
|
||||
@ -220,11 +228,12 @@ static uint64_t esp_pci_io_read(void *opaque, hwaddr addr,
|
||||
unsigned int size)
|
||||
{
|
||||
PCIESPState *pci = opaque;
|
||||
ESPState *s = ESP(&pci->esp);
|
||||
uint32_t ret;
|
||||
|
||||
if (addr < 0x40) {
|
||||
/* SCSI core reg */
|
||||
ret = esp_reg_read(&pci->esp, addr >> 2);
|
||||
ret = esp_reg_read(s, addr >> 2);
|
||||
} else if (addr < 0x60) {
|
||||
/* PCI DMA CCB */
|
||||
ret = esp_pci_dma_read(pci, (addr - 0x40) >> 2);
|
||||
@ -306,7 +315,9 @@ static const MemoryRegionOps esp_pci_io_ops = {
|
||||
static void esp_pci_hard_reset(DeviceState *dev)
|
||||
{
|
||||
PCIESPState *pci = PCI_ESP(dev);
|
||||
esp_hard_reset(&pci->esp);
|
||||
ESPState *s = ESP(&pci->esp);
|
||||
|
||||
esp_hard_reset(s);
|
||||
pci->dma_regs[DMA_CMD] &= ~(DMA_CMD_DIR | DMA_CMD_INTE_D | DMA_CMD_INTE_P
|
||||
| DMA_CMD_MDL | DMA_CMD_DIAG | DMA_CMD_MASK);
|
||||
pci->dma_regs[DMA_WBC] &= ~0xffff;
|
||||
@ -319,11 +330,12 @@ static void esp_pci_hard_reset(DeviceState *dev)
|
||||
|
||||
static const VMStateDescription vmstate_esp_pci_scsi = {
|
||||
.name = "pciespscsi",
|
||||
.version_id = 1,
|
||||
.version_id = 2,
|
||||
.minimum_version_id = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_PCI_DEVICE(parent_obj, PCIESPState),
|
||||
VMSTATE_BUFFER_UNSAFE(dma_regs, PCIESPState, 0, 8 * sizeof(uint32_t)),
|
||||
VMSTATE_UINT8_V(esp.mig_version_id, PCIESPState, 2),
|
||||
VMSTATE_STRUCT(esp, PCIESPState, 0, vmstate_esp, ESPState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
@ -353,9 +365,13 @@ static void esp_pci_scsi_realize(PCIDevice *dev, Error **errp)
|
||||
{
|
||||
PCIESPState *pci = PCI_ESP(dev);
|
||||
DeviceState *d = DEVICE(dev);
|
||||
ESPState *s = &pci->esp;
|
||||
ESPState *s = ESP(&pci->esp);
|
||||
uint8_t *pci_conf;
|
||||
|
||||
if (!qdev_realize(DEVICE(s), NULL, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
pci_conf = dev->config;
|
||||
|
||||
/* Interrupt pin A */
|
||||
@ -374,11 +390,19 @@ static void esp_pci_scsi_realize(PCIDevice *dev, Error **errp)
|
||||
scsi_bus_new(&s->bus, sizeof(s->bus), d, &esp_pci_scsi_info, NULL);
|
||||
}
|
||||
|
||||
static void esp_pci_scsi_uninit(PCIDevice *d)
|
||||
static void esp_pci_scsi_exit(PCIDevice *d)
|
||||
{
|
||||
PCIESPState *pci = PCI_ESP(d);
|
||||
ESPState *s = ESP(&pci->esp);
|
||||
|
||||
qemu_free_irq(pci->esp.irq);
|
||||
qemu_free_irq(s->irq);
|
||||
}
|
||||
|
||||
static void esp_pci_init(Object *obj)
|
||||
{
|
||||
PCIESPState *pci = PCI_ESP(obj);
|
||||
|
||||
object_initialize_child(obj, "esp", &pci->esp, TYPE_ESP);
|
||||
}
|
||||
|
||||
static void esp_pci_class_init(ObjectClass *klass, void *data)
|
||||
@ -387,7 +411,7 @@ static void esp_pci_class_init(ObjectClass *klass, void *data)
|
||||
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
||||
|
||||
k->realize = esp_pci_scsi_realize;
|
||||
k->exit = esp_pci_scsi_uninit;
|
||||
k->exit = esp_pci_scsi_exit;
|
||||
k->vendor_id = PCI_VENDOR_ID_AMD;
|
||||
k->device_id = PCI_DEVICE_ID_AMD_SCSI;
|
||||
k->revision = 0x10;
|
||||
@ -401,6 +425,7 @@ static void esp_pci_class_init(ObjectClass *klass, void *data)
|
||||
static const TypeInfo esp_pci_info = {
|
||||
.name = TYPE_AM53C974_DEVICE,
|
||||
.parent = TYPE_PCI_DEVICE,
|
||||
.instance_init = esp_pci_init,
|
||||
.instance_size = sizeof(PCIESPState),
|
||||
.class_init = esp_pci_class_init,
|
||||
.interfaces = (InterfaceInfo[]) {
|
||||
|
1021
hw/scsi/esp.c
1021
hw/scsi/esp.c
File diff suppressed because it is too large
Load Diff
@ -159,8 +159,12 @@ esp_error_unhandled_command(uint32_t val) "unhandled command (0x%2.2x)"
|
||||
esp_error_invalid_write(uint32_t val, uint32_t addr) "invalid write of 0x%02x at [0x%x]"
|
||||
esp_raise_irq(void) "Raise IRQ"
|
||||
esp_lower_irq(void) "Lower IRQ"
|
||||
esp_raise_drq(void) "Raise DREQ"
|
||||
esp_lower_drq(void) "Lower DREQ"
|
||||
esp_dma_enable(void) "Raise enable"
|
||||
esp_dma_disable(void) "Lower enable"
|
||||
esp_pdma_read(int size) "pDMA read %u bytes"
|
||||
esp_pdma_write(int size) "pDMA write %u bytes"
|
||||
esp_get_cmd(uint32_t dmalen, int target) "len %d target %d"
|
||||
esp_do_busid_cmd(uint8_t busid) "busid 0x%x"
|
||||
esp_handle_satn_stop(uint32_t cmdlen) "cmdlen %d"
|
||||
@ -189,6 +193,7 @@ esp_mem_writeb_cmd_selatn(uint32_t val) "Select with ATN (0x%2.2x)"
|
||||
esp_mem_writeb_cmd_selatns(uint32_t val) "Select with ATN & stop (0x%2.2x)"
|
||||
esp_mem_writeb_cmd_ensel(uint32_t val) "Enable selection (0x%2.2x)"
|
||||
esp_mem_writeb_cmd_dissel(uint32_t val) "Disable selection (0x%2.2x)"
|
||||
esp_mem_writeb_cmd_ti(uint32_t val) "Transfer Information (0x%2.2x)"
|
||||
|
||||
# esp-pci.c
|
||||
esp_pci_error_invalid_dma_direction(void) "invalid DMA transfer direction"
|
||||
|
@ -334,7 +334,7 @@ static void *sparc32_dma_init(hwaddr dma_base,
|
||||
OBJECT(dma), "espdma"));
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(espdma), 0, espdma_irq);
|
||||
|
||||
esp = ESP(object_resolve_path_component(OBJECT(espdma), "esp"));
|
||||
esp = SYSBUS_ESP(object_resolve_path_component(OBJECT(espdma), "esp"));
|
||||
|
||||
ledma = SPARC32_LEDMA_DEVICE(object_resolve_path_component(
|
||||
OBJECT(dma), "ledma"));
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "hw/scsi/scsi.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "qemu/fifo8.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
/* esp.c */
|
||||
@ -10,19 +11,17 @@
|
||||
typedef void (*ESPDMAMemoryReadWriteFunc)(void *opaque, uint8_t *buf, int len);
|
||||
|
||||
#define ESP_REGS 16
|
||||
#define TI_BUFSZ 16
|
||||
#define ESP_CMDBUF_SZ 32
|
||||
#define ESP_FIFO_SZ 16
|
||||
#define ESP_CMDFIFO_SZ 32
|
||||
|
||||
typedef struct ESPState ESPState;
|
||||
|
||||
enum pdma_origin_id {
|
||||
PDMA,
|
||||
TI,
|
||||
CMD,
|
||||
ASYNC,
|
||||
};
|
||||
#define TYPE_ESP "esp"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(ESPState, ESP)
|
||||
|
||||
struct ESPState {
|
||||
DeviceState parent_obj;
|
||||
|
||||
uint8_t rregs[ESP_REGS];
|
||||
uint8_t wregs[ESP_REGS];
|
||||
qemu_irq irq;
|
||||
@ -30,24 +29,18 @@ struct ESPState {
|
||||
uint8_t chip_id;
|
||||
bool tchi_written;
|
||||
int32_t ti_size;
|
||||
uint32_t ti_rptr, ti_wptr;
|
||||
uint32_t status;
|
||||
uint32_t deferred_status;
|
||||
bool deferred_complete;
|
||||
uint32_t dma;
|
||||
uint8_t ti_buf[TI_BUFSZ];
|
||||
Fifo8 fifo;
|
||||
SCSIBus bus;
|
||||
SCSIDevice *current_dev;
|
||||
SCSIRequest *current_req;
|
||||
uint8_t cmdbuf[ESP_CMDBUF_SZ];
|
||||
uint32_t cmdlen;
|
||||
Fifo8 cmdfifo;
|
||||
uint8_t cmdfifo_cdb_offset;
|
||||
uint32_t do_cmd;
|
||||
|
||||
/* The amount of data left in the current DMA transfer. */
|
||||
uint32_t dma_left;
|
||||
/* The size of the current DMA transfer. Zero if no transfer is in
|
||||
progress. */
|
||||
uint32_t dma_counter;
|
||||
bool data_in_ready;
|
||||
uint8_t ti_cmd;
|
||||
int dma_enabled;
|
||||
|
||||
uint32_t async_len;
|
||||
@ -57,16 +50,22 @@ struct ESPState {
|
||||
ESPDMAMemoryReadWriteFunc dma_memory_write;
|
||||
void *dma_opaque;
|
||||
void (*dma_cb)(ESPState *s);
|
||||
uint8_t pdma_buf[32];
|
||||
int pdma_origin;
|
||||
uint32_t pdma_len;
|
||||
uint32_t pdma_start;
|
||||
uint32_t pdma_cur;
|
||||
void (*pdma_cb)(ESPState *s);
|
||||
|
||||
uint8_t mig_version_id;
|
||||
|
||||
/* Legacy fields for vmstate_esp version < 5 */
|
||||
uint32_t mig_dma_left;
|
||||
uint32_t mig_deferred_status;
|
||||
bool mig_deferred_complete;
|
||||
uint32_t mig_ti_rptr, mig_ti_wptr;
|
||||
uint8_t mig_ti_buf[ESP_FIFO_SZ];
|
||||
uint8_t mig_cmdbuf[ESP_CMDFIFO_SZ];
|
||||
uint32_t mig_cmdlen;
|
||||
};
|
||||
|
||||
#define TYPE_ESP "esp"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(SysBusESPState, ESP)
|
||||
#define TYPE_SYSBUS_ESP "sysbus-esp"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(SysBusESPState, SYSBUS_ESP)
|
||||
|
||||
struct SysBusESPState {
|
||||
/*< private >*/
|
||||
@ -142,6 +141,7 @@ struct SysBusESPState {
|
||||
#define INTR_RST 0x80
|
||||
|
||||
#define SEQ_0 0x0
|
||||
#define SEQ_MO 0x1
|
||||
#define SEQ_CD 0x4
|
||||
|
||||
#define CFG1_RESREPT 0x40
|
||||
|
Loading…
Reference in New Issue
Block a user