2011-08-25 21:38:59 +00:00
|
|
|
/*
|
|
|
|
* QEMU Alpha PCI support functions.
|
|
|
|
*
|
|
|
|
* Some of this isn't very Alpha specific at all.
|
|
|
|
*
|
|
|
|
* ??? Sparse memory access not implemented.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
2013-03-18 16:36:02 +00:00
|
|
|
#include "alpha_sys.h"
|
2012-12-17 17:20:00 +00:00
|
|
|
#include "qemu/log.h"
|
2012-12-17 17:20:04 +00:00
|
|
|
#include "sysemu/sysemu.h"
|
2011-08-25 21:38:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* PCI IO reads/writes, to byte-word addressable memory. */
|
|
|
|
/* ??? Doesn't handle multiple PCI busses. */
|
|
|
|
|
2012-10-23 10:30:10 +00:00
|
|
|
static uint64_t bw_io_read(void *opaque, hwaddr addr, unsigned size)
|
2011-08-25 21:38:59 +00:00
|
|
|
{
|
|
|
|
switch (size) {
|
|
|
|
case 1:
|
|
|
|
return cpu_inb(addr);
|
|
|
|
case 2:
|
|
|
|
return cpu_inw(addr);
|
|
|
|
case 4:
|
|
|
|
return cpu_inl(addr);
|
|
|
|
}
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
2012-10-23 10:30:10 +00:00
|
|
|
static void bw_io_write(void *opaque, hwaddr addr,
|
2011-08-25 21:38:59 +00:00
|
|
|
uint64_t val, unsigned size)
|
|
|
|
{
|
|
|
|
switch (size) {
|
|
|
|
case 1:
|
|
|
|
cpu_outb(addr, val);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
cpu_outw(addr, val);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
cpu_outl(addr, val);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const MemoryRegionOps alpha_pci_bw_io_ops = {
|
|
|
|
.read = bw_io_read,
|
|
|
|
.write = bw_io_write,
|
|
|
|
.endianness = DEVICE_LITTLE_ENDIAN,
|
|
|
|
.impl = {
|
|
|
|
.min_access_size = 1,
|
|
|
|
.max_access_size = 4,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* PCI config space reads/writes, to byte-word addressable memory. */
|
2012-10-23 10:30:10 +00:00
|
|
|
static uint64_t bw_conf1_read(void *opaque, hwaddr addr,
|
2011-08-25 21:38:59 +00:00
|
|
|
unsigned size)
|
|
|
|
{
|
|
|
|
PCIBus *b = opaque;
|
|
|
|
return pci_data_read(b, addr, size);
|
|
|
|
}
|
|
|
|
|
2012-10-23 10:30:10 +00:00
|
|
|
static void bw_conf1_write(void *opaque, hwaddr addr,
|
2011-08-25 21:38:59 +00:00
|
|
|
uint64_t val, unsigned size)
|
|
|
|
{
|
|
|
|
PCIBus *b = opaque;
|
|
|
|
pci_data_write(b, addr, val, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
const MemoryRegionOps alpha_pci_conf1_ops = {
|
|
|
|
.read = bw_conf1_read,
|
|
|
|
.write = bw_conf1_write,
|
|
|
|
.endianness = DEVICE_LITTLE_ENDIAN,
|
|
|
|
.impl = {
|
|
|
|
.min_access_size = 1,
|
|
|
|
.max_access_size = 4,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* PCI/EISA Interrupt Acknowledge Cycle. */
|
|
|
|
|
2012-10-23 10:30:10 +00:00
|
|
|
static uint64_t iack_read(void *opaque, hwaddr addr, unsigned size)
|
2011-08-25 21:38:59 +00:00
|
|
|
{
|
|
|
|
return pic_read_irq(isa_pic);
|
|
|
|
}
|
|
|
|
|
2012-10-23 10:30:10 +00:00
|
|
|
static void special_write(void *opaque, hwaddr addr,
|
2011-08-25 21:38:59 +00:00
|
|
|
uint64_t val, unsigned size)
|
|
|
|
{
|
|
|
|
qemu_log("pci: special write cycle");
|
|
|
|
}
|
|
|
|
|
|
|
|
const MemoryRegionOps alpha_pci_iack_ops = {
|
|
|
|
.read = iack_read,
|
|
|
|
.write = special_write,
|
|
|
|
.endianness = DEVICE_LITTLE_ENDIAN,
|
|
|
|
.valid = {
|
|
|
|
.min_access_size = 4,
|
|
|
|
.max_access_size = 4,
|
|
|
|
},
|
|
|
|
.impl = {
|
|
|
|
.min_access_size = 4,
|
|
|
|
.max_access_size = 4,
|
|
|
|
},
|
|
|
|
};
|