petalogix-ml605: added SPI controller with n25q128
[qemu-kvm.git] / hw / alpha_pci.c
blob8079a46ae0b3e06c518c75026aa9fad41a044907
1 /*
2 * QEMU Alpha PCI support functions.
4 * Some of this isn't very Alpha specific at all.
6 * ??? Sparse memory access not implemented.
7 */
9 #include "config.h"
10 #include "alpha_sys.h"
11 #include "qemu-log.h"
12 #include "sysemu.h"
15 /* PCI IO reads/writes, to byte-word addressable memory. */
16 /* ??? Doesn't handle multiple PCI busses. */
18 static uint64_t bw_io_read(void *opaque, target_phys_addr_t addr, unsigned size)
20 switch (size) {
21 case 1:
22 return cpu_inb(addr);
23 case 2:
24 return cpu_inw(addr);
25 case 4:
26 return cpu_inl(addr);
28 abort();
31 static void bw_io_write(void *opaque, target_phys_addr_t addr,
32 uint64_t val, unsigned size)
34 switch (size) {
35 case 1:
36 cpu_outb(addr, val);
37 break;
38 case 2:
39 cpu_outw(addr, val);
40 break;
41 case 4:
42 cpu_outl(addr, val);
43 break;
44 default:
45 abort();
49 const MemoryRegionOps alpha_pci_bw_io_ops = {
50 .read = bw_io_read,
51 .write = bw_io_write,
52 .endianness = DEVICE_LITTLE_ENDIAN,
53 .impl = {
54 .min_access_size = 1,
55 .max_access_size = 4,
59 /* PCI config space reads/writes, to byte-word addressable memory. */
60 static uint64_t bw_conf1_read(void *opaque, target_phys_addr_t addr,
61 unsigned size)
63 PCIBus *b = opaque;
64 return pci_data_read(b, addr, size);
67 static void bw_conf1_write(void *opaque, target_phys_addr_t addr,
68 uint64_t val, unsigned size)
70 PCIBus *b = opaque;
71 pci_data_write(b, addr, val, size);
74 const MemoryRegionOps alpha_pci_conf1_ops = {
75 .read = bw_conf1_read,
76 .write = bw_conf1_write,
77 .endianness = DEVICE_LITTLE_ENDIAN,
78 .impl = {
79 .min_access_size = 1,
80 .max_access_size = 4,
84 /* PCI/EISA Interrupt Acknowledge Cycle. */
86 static uint64_t iack_read(void *opaque, target_phys_addr_t addr, unsigned size)
88 return pic_read_irq(isa_pic);
91 static void special_write(void *opaque, target_phys_addr_t addr,
92 uint64_t val, unsigned size)
94 qemu_log("pci: special write cycle");
97 const MemoryRegionOps alpha_pci_iack_ops = {
98 .read = iack_read,
99 .write = special_write,
100 .endianness = DEVICE_LITTLE_ENDIAN,
101 .valid = {
102 .min_access_size = 4,
103 .max_access_size = 4,
105 .impl = {
106 .min_access_size = 4,
107 .max_access_size = 4,