Richard Henderson | 80bb2ff | 2011-08-25 11:38:59 -1000 | [diff] [blame] | 1 | /* |
| 2 | * QEMU Alpha PCI support functions. |
| 3 | * |
| 4 | * Some of this isn't very Alpha specific at all. |
| 5 | * |
| 6 | * ??? Sparse memory access not implemented. |
| 7 | */ |
| 8 | |
Peter Maydell | e2e5e11 | 2016-01-26 18:17:04 +0000 | [diff] [blame] | 9 | #include "qemu/osdep.h" |
Paolo Bonzini | 4771d75 | 2016-01-19 21:51:44 +0100 | [diff] [blame] | 10 | #include "qemu-common.h" |
Paolo Bonzini | 47b43a1 | 2013-03-18 17:36:02 +0100 | [diff] [blame] | 11 | #include "alpha_sys.h" |
Paolo Bonzini | 1de7afc | 2012-12-17 18:20:00 +0100 | [diff] [blame] | 12 | #include "qemu/log.h" |
Paolo Bonzini | 9c17d61 | 2012-12-17 18:20:04 +0100 | [diff] [blame] | 13 | #include "sysemu/sysemu.h" |
Paolo Bonzini | c6ce9f1 | 2015-11-13 13:23:45 +0100 | [diff] [blame] | 14 | #include "trace.h" |
Richard Henderson | 80bb2ff | 2011-08-25 11:38:59 -1000 | [diff] [blame] | 15 | |
| 16 | |
Richard Henderson | 3661049 | 2013-07-08 15:46:37 -0700 | [diff] [blame] | 17 | /* Fallback for unassigned PCI I/O operations. Avoids MCHK. */ |
| 18 | |
| 19 | static uint64_t ignore_read(void *opaque, hwaddr addr, unsigned size) |
| 20 | { |
| 21 | return 0; |
| 22 | } |
| 23 | |
| 24 | static void ignore_write(void *opaque, hwaddr addr, uint64_t v, unsigned size) |
| 25 | { |
| 26 | } |
| 27 | |
| 28 | const MemoryRegionOps alpha_pci_ignore_ops = { |
| 29 | .read = ignore_read, |
| 30 | .write = ignore_write, |
| 31 | .endianness = DEVICE_LITTLE_ENDIAN, |
| 32 | .valid = { |
| 33 | .min_access_size = 1, |
| 34 | .max_access_size = 8, |
| 35 | }, |
| 36 | .impl = { |
| 37 | .min_access_size = 1, |
| 38 | .max_access_size = 8, |
| 39 | }, |
| 40 | }; |
| 41 | |
| 42 | |
Richard Henderson | 80bb2ff | 2011-08-25 11:38:59 -1000 | [diff] [blame] | 43 | /* PCI config space reads/writes, to byte-word addressable memory. */ |
Avi Kivity | a8170e5 | 2012-10-23 12:30:10 +0200 | [diff] [blame] | 44 | static uint64_t bw_conf1_read(void *opaque, hwaddr addr, |
Richard Henderson | 80bb2ff | 2011-08-25 11:38:59 -1000 | [diff] [blame] | 45 | unsigned size) |
| 46 | { |
| 47 | PCIBus *b = opaque; |
| 48 | return pci_data_read(b, addr, size); |
| 49 | } |
| 50 | |
Avi Kivity | a8170e5 | 2012-10-23 12:30:10 +0200 | [diff] [blame] | 51 | static void bw_conf1_write(void *opaque, hwaddr addr, |
Richard Henderson | 80bb2ff | 2011-08-25 11:38:59 -1000 | [diff] [blame] | 52 | uint64_t val, unsigned size) |
| 53 | { |
| 54 | PCIBus *b = opaque; |
| 55 | pci_data_write(b, addr, val, size); |
| 56 | } |
| 57 | |
| 58 | const MemoryRegionOps alpha_pci_conf1_ops = { |
| 59 | .read = bw_conf1_read, |
| 60 | .write = bw_conf1_write, |
| 61 | .endianness = DEVICE_LITTLE_ENDIAN, |
| 62 | .impl = { |
| 63 | .min_access_size = 1, |
| 64 | .max_access_size = 4, |
| 65 | }, |
| 66 | }; |
| 67 | |
| 68 | /* PCI/EISA Interrupt Acknowledge Cycle. */ |
| 69 | |
Avi Kivity | a8170e5 | 2012-10-23 12:30:10 +0200 | [diff] [blame] | 70 | static uint64_t iack_read(void *opaque, hwaddr addr, unsigned size) |
Richard Henderson | 80bb2ff | 2011-08-25 11:38:59 -1000 | [diff] [blame] | 71 | { |
| 72 | return pic_read_irq(isa_pic); |
| 73 | } |
| 74 | |
Avi Kivity | a8170e5 | 2012-10-23 12:30:10 +0200 | [diff] [blame] | 75 | static void special_write(void *opaque, hwaddr addr, |
Richard Henderson | 80bb2ff | 2011-08-25 11:38:59 -1000 | [diff] [blame] | 76 | uint64_t val, unsigned size) |
| 77 | { |
Paolo Bonzini | c6ce9f1 | 2015-11-13 13:23:45 +0100 | [diff] [blame] | 78 | trace_alpha_pci_iack_write(); |
Richard Henderson | 80bb2ff | 2011-08-25 11:38:59 -1000 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | const MemoryRegionOps alpha_pci_iack_ops = { |
| 82 | .read = iack_read, |
| 83 | .write = special_write, |
| 84 | .endianness = DEVICE_LITTLE_ENDIAN, |
| 85 | .valid = { |
| 86 | .min_access_size = 4, |
| 87 | .max_access_size = 4, |
| 88 | }, |
| 89 | .impl = { |
| 90 | .min_access_size = 4, |
| 91 | .max_access_size = 4, |
| 92 | }, |
| 93 | }; |