pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 1 | /* |
| 2 | * QEMU Uninorth PCI host (for all Mac99 and newer machines) |
| 3 | * |
| 4 | * Copyright (c) 2006 Fabrice Bellard |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 5 | * |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to deal |
| 8 | * in the Software without restriction, including without limitation the rights |
| 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | * copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in |
| 14 | * all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | * THE SOFTWARE. |
| 23 | */ |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 24 | #include "hw.h" |
| 25 | #include "ppc_mac.h" |
| 26 | #include "pci.h" |
Isaku Yamahata | 4f5e19e | 2009-10-30 21:21:06 +0900 | [diff] [blame] | 27 | #include "pci_host.h" |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 28 | |
blueswir1 | f390238 | 2009-02-05 20:22:07 +0000 | [diff] [blame] | 29 | /* debug UniNorth */ |
| 30 | //#define DEBUG_UNIN |
| 31 | |
| 32 | #ifdef DEBUG_UNIN |
Blue Swirl | 001faf3 | 2009-05-13 17:53:17 +0000 | [diff] [blame] | 33 | #define UNIN_DPRINTF(fmt, ...) \ |
| 34 | do { printf("UNIN: " fmt , ## __VA_ARGS__); } while (0) |
blueswir1 | f390238 | 2009-02-05 20:22:07 +0000 | [diff] [blame] | 35 | #else |
Blue Swirl | 001faf3 | 2009-05-13 17:53:17 +0000 | [diff] [blame] | 36 | #define UNIN_DPRINTF(fmt, ...) |
blueswir1 | f390238 | 2009-02-05 20:22:07 +0000 | [diff] [blame] | 37 | #endif |
| 38 | |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 39 | typedef struct UNINState { |
| 40 | SysBusDevice busdev; |
| 41 | PCIHostState host_state; |
| 42 | } UNINState; |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 43 | |
pbrook | d2b5931 | 2006-09-24 00:16:34 +0000 | [diff] [blame] | 44 | /* Don't know if this matches real hardware, but it agrees with OHW. */ |
| 45 | static int pci_unin_map_irq(PCIDevice *pci_dev, int irq_num) |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 46 | { |
pbrook | d2b5931 | 2006-09-24 00:16:34 +0000 | [diff] [blame] | 47 | return (irq_num + (pci_dev->devfn >> 3)) & 3; |
| 48 | } |
| 49 | |
Juan Quintela | 5d4e84c | 2009-08-28 15:28:17 +0200 | [diff] [blame] | 50 | static void pci_unin_set_irq(void *opaque, int irq_num, int level) |
pbrook | d2b5931 | 2006-09-24 00:16:34 +0000 | [diff] [blame] | 51 | { |
Juan Quintela | 5d4e84c | 2009-08-28 15:28:17 +0200 | [diff] [blame] | 52 | qemu_irq *pic = opaque; |
| 53 | |
pbrook | d537cf6 | 2007-04-07 18:14:41 +0000 | [diff] [blame] | 54 | qemu_set_irq(pic[irq_num + 8], level); |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 55 | } |
| 56 | |
blueswir1 | f390238 | 2009-02-05 20:22:07 +0000 | [diff] [blame] | 57 | static void pci_unin_save(QEMUFile* f, void *opaque) |
| 58 | { |
| 59 | PCIDevice *d = opaque; |
| 60 | |
| 61 | pci_device_save(d, f); |
| 62 | } |
| 63 | |
| 64 | static int pci_unin_load(QEMUFile* f, void *opaque, int version_id) |
| 65 | { |
| 66 | PCIDevice *d = opaque; |
| 67 | |
| 68 | if (version_id != 1) |
| 69 | return -EINVAL; |
| 70 | |
| 71 | return pci_device_load(d, f); |
| 72 | } |
| 73 | |
| 74 | static void pci_unin_reset(void *opaque) |
| 75 | { |
| 76 | } |
| 77 | |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 78 | static int pci_unin_main_init_device(SysBusDevice *dev) |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 79 | { |
| 80 | UNINState *s; |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 81 | int pci_mem_config, pci_mem_data; |
| 82 | |
| 83 | /* Use values found on a real PowerMac */ |
| 84 | /* Uninorth main bus */ |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 85 | s = FROM_SYSBUS(UNINState, dev); |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 86 | |
Isaku Yamahata | f08b32f | 2009-11-12 14:58:34 +0900 | [diff] [blame] | 87 | pci_mem_config = pci_host_conf_register_mmio(&s->host_state); |
| 88 | pci_mem_data = pci_host_data_register_mmio(&s->host_state); |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 89 | sysbus_init_mmio(dev, 0x1000, pci_mem_config); |
| 90 | sysbus_init_mmio(dev, 0x1000, pci_mem_data); |
| 91 | |
| 92 | register_savevm("uninorth", 0, 1, pci_unin_save, pci_unin_load, &s->host_state); |
| 93 | qemu_register_reset(pci_unin_reset, &s->host_state); |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 94 | return 0; |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 95 | } |
| 96 | |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 97 | static int pci_dec_21154_init_device(SysBusDevice *dev) |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 98 | { |
| 99 | UNINState *s; |
| 100 | int pci_mem_config, pci_mem_data; |
| 101 | |
| 102 | /* Uninorth bridge */ |
| 103 | s = FROM_SYSBUS(UNINState, dev); |
| 104 | |
| 105 | // XXX: s = &pci_bridge[2]; |
Isaku Yamahata | f08b32f | 2009-11-12 14:58:34 +0900 | [diff] [blame] | 106 | pci_mem_config = pci_host_conf_register_mmio_noswap(&s->host_state); |
| 107 | pci_mem_data = pci_host_data_register_mmio(&s->host_state); |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 108 | sysbus_init_mmio(dev, 0x1000, pci_mem_config); |
| 109 | sysbus_init_mmio(dev, 0x1000, pci_mem_data); |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 110 | return 0; |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 111 | } |
| 112 | |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 113 | static int pci_unin_agp_init_device(SysBusDevice *dev) |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 114 | { |
| 115 | UNINState *s; |
| 116 | int pci_mem_config, pci_mem_data; |
| 117 | |
| 118 | /* Uninorth AGP bus */ |
| 119 | s = FROM_SYSBUS(UNINState, dev); |
| 120 | |
Isaku Yamahata | f08b32f | 2009-11-12 14:58:34 +0900 | [diff] [blame] | 121 | pci_mem_config = pci_host_conf_register_mmio_noswap(&s->host_state); |
| 122 | pci_mem_data = pci_host_data_register_mmio(&s->host_state); |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 123 | sysbus_init_mmio(dev, 0x1000, pci_mem_config); |
| 124 | sysbus_init_mmio(dev, 0x1000, pci_mem_data); |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 125 | return 0; |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 126 | } |
| 127 | |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 128 | static int pci_unin_internal_init_device(SysBusDevice *dev) |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 129 | { |
| 130 | UNINState *s; |
| 131 | int pci_mem_config, pci_mem_data; |
| 132 | |
| 133 | /* Uninorth internal bus */ |
| 134 | s = FROM_SYSBUS(UNINState, dev); |
| 135 | |
Isaku Yamahata | f08b32f | 2009-11-12 14:58:34 +0900 | [diff] [blame] | 136 | pci_mem_config = pci_host_conf_register_mmio_noswap(&s->host_state); |
| 137 | pci_mem_data = pci_host_data_register_mmio(&s->host_state); |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 138 | sysbus_init_mmio(dev, 0x1000, pci_mem_config); |
| 139 | sysbus_init_mmio(dev, 0x1000, pci_mem_data); |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 140 | return 0; |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | PCIBus *pci_pmac_init(qemu_irq *pic) |
| 144 | { |
| 145 | DeviceState *dev; |
| 146 | SysBusDevice *s; |
| 147 | UNINState *d; |
| 148 | |
| 149 | /* Use values found on a real PowerMac */ |
| 150 | /* Uninorth main bus */ |
Markus Armbruster | 18dd19a | 2009-12-14 10:41:21 +0100 | [diff] [blame] | 151 | dev = qdev_create(NULL, "uni-north"); |
Markus Armbruster | e23a1b3 | 2009-10-07 01:15:58 +0200 | [diff] [blame] | 152 | qdev_init_nofail(dev); |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 153 | s = sysbus_from_qdev(dev); |
| 154 | d = FROM_SYSBUS(UNINState, s); |
Blue Swirl | cdd0935 | 2009-09-19 17:59:10 +0000 | [diff] [blame] | 155 | d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci", |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 156 | pci_unin_set_irq, pci_unin_map_irq, |
| 157 | pic, 11 << 3, 4); |
| 158 | |
Blue Swirl | 6039874 | 2009-11-15 14:30:56 +0000 | [diff] [blame] | 159 | #if 0 |
Markus Armbruster | 18dd19a | 2009-12-14 10:41:21 +0100 | [diff] [blame] | 160 | pci_create_simple(d->host_state.bus, 11 << 3, "uni-north"); |
Blue Swirl | 6039874 | 2009-11-15 14:30:56 +0000 | [diff] [blame] | 161 | #endif |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 162 | |
| 163 | sysbus_mmio_map(s, 0, 0xf2800000); |
| 164 | sysbus_mmio_map(s, 1, 0xf2c00000); |
| 165 | |
| 166 | /* DEC 21154 bridge */ |
| 167 | #if 0 |
| 168 | /* XXX: not activated as PPC BIOS doesn't handle multiple buses properly */ |
Markus Armbruster | 556cd09 | 2009-12-09 17:07:53 +0100 | [diff] [blame] | 169 | pci_create_simple(d->host_state.bus, 12 << 3, "dec-21154"); |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 170 | #endif |
| 171 | |
| 172 | /* Uninorth AGP bus */ |
Markus Armbruster | 18dd19a | 2009-12-14 10:41:21 +0100 | [diff] [blame] | 173 | pci_create_simple(d->host_state.bus, 11 << 3, "uni-north-agp"); |
| 174 | dev = qdev_create(NULL, "uni-north-agp"); |
Blue Swirl | d27d06f | 2009-11-15 17:42:17 +0000 | [diff] [blame] | 175 | qdev_init_nofail(dev); |
| 176 | s = sysbus_from_qdev(dev); |
| 177 | sysbus_mmio_map(s, 0, 0xf0800000); |
| 178 | sysbus_mmio_map(s, 1, 0xf0c00000); |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 179 | |
| 180 | /* Uninorth internal bus */ |
| 181 | #if 0 |
| 182 | /* XXX: not needed for now */ |
Markus Armbruster | 18dd19a | 2009-12-14 10:41:21 +0100 | [diff] [blame] | 183 | pci_create_simple(d->host_state.bus, 14 << 3, "uni-north-pci"); |
| 184 | dev = qdev_create(NULL, "uni-north-pci"); |
Blue Swirl | d27d06f | 2009-11-15 17:42:17 +0000 | [diff] [blame] | 185 | qdev_init_nofail(dev); |
| 186 | s = sysbus_from_qdev(dev); |
| 187 | sysbus_mmio_map(s, 0, 0xf4800000); |
| 188 | sysbus_mmio_map(s, 1, 0xf4c00000); |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 189 | #endif |
| 190 | |
| 191 | return d->host_state.bus; |
| 192 | } |
| 193 | |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 194 | static int unin_main_pci_host_init(PCIDevice *d) |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 195 | { |
aliguori | deb5439 | 2009-01-26 15:37:35 +0000 | [diff] [blame] | 196 | pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_APPLE); |
blueswir1 | 4ebcf88 | 2009-02-01 12:01:04 +0000 | [diff] [blame] | 197 | pci_config_set_device_id(d->config, PCI_DEVICE_ID_APPLE_UNI_N_PCI); |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 198 | d->config[0x08] = 0x00; // revision |
blueswir1 | 173a543 | 2009-02-01 19:26:20 +0000 | [diff] [blame] | 199 | pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST); |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 200 | d->config[0x0C] = 0x08; // cache_line_size |
| 201 | d->config[0x0D] = 0x10; // latency_timer |
Isaku Yamahata | 6407f37 | 2009-05-03 19:03:00 +0000 | [diff] [blame] | 202 | d->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 203 | d->config[0x34] = 0x00; // capabilities_pointer |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 204 | return 0; |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 205 | } |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 206 | |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 207 | static int dec_21154_pci_host_init(PCIDevice *d) |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 208 | { |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 209 | /* pci-to-pci bridge */ |
blueswir1 | 4ebcf88 | 2009-02-01 12:01:04 +0000 | [diff] [blame] | 210 | pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_DEC); |
| 211 | pci_config_set_device_id(d->config, PCI_DEVICE_ID_DEC_21154); |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 212 | d->config[0x08] = 0x05; // revision |
blueswir1 | 173a543 | 2009-02-01 19:26:20 +0000 | [diff] [blame] | 213 | pci_config_set_class(d->config, PCI_CLASS_BRIDGE_PCI); |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 214 | d->config[0x0C] = 0x08; // cache_line_size |
| 215 | d->config[0x0D] = 0x20; // latency_timer |
Isaku Yamahata | 6407f37 | 2009-05-03 19:03:00 +0000 | [diff] [blame] | 216 | d->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_BRIDGE; // header_type |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 217 | |
| 218 | d->config[0x18] = 0x01; // primary_bus |
| 219 | d->config[0x19] = 0x02; // secondary_bus |
| 220 | d->config[0x1A] = 0x02; // subordinate_bus |
| 221 | d->config[0x1B] = 0x20; // secondary_latency_timer |
| 222 | d->config[0x1C] = 0x11; // io_base |
| 223 | d->config[0x1D] = 0x01; // io_limit |
| 224 | d->config[0x20] = 0x00; // memory_base |
| 225 | d->config[0x21] = 0x80; |
| 226 | d->config[0x22] = 0x00; // memory_limit |
| 227 | d->config[0x23] = 0x80; |
| 228 | d->config[0x24] = 0x01; // prefetchable_memory_base |
| 229 | d->config[0x25] = 0x80; |
| 230 | d->config[0x26] = 0xF1; // prefectchable_memory_limit |
| 231 | d->config[0x27] = 0x7F; |
| 232 | // d->config[0x34] = 0xdc // capabilities_pointer |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 233 | return 0; |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 234 | } |
blueswir1 | 783a20d | 2009-03-07 20:53:18 +0000 | [diff] [blame] | 235 | |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 236 | static int unin_agp_pci_host_init(PCIDevice *d) |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 237 | { |
aliguori | deb5439 | 2009-01-26 15:37:35 +0000 | [diff] [blame] | 238 | pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_APPLE); |
| 239 | pci_config_set_device_id(d->config, PCI_DEVICE_ID_APPLE_UNI_N_AGP); |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 240 | d->config[0x08] = 0x00; // revision |
blueswir1 | 173a543 | 2009-02-01 19:26:20 +0000 | [diff] [blame] | 241 | pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST); |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 242 | d->config[0x0C] = 0x08; // cache_line_size |
| 243 | d->config[0x0D] = 0x10; // latency_timer |
Isaku Yamahata | 6407f37 | 2009-05-03 19:03:00 +0000 | [diff] [blame] | 244 | d->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 245 | // d->config[0x34] = 0x80; // capabilities_pointer |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 246 | return 0; |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 247 | } |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 248 | |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 249 | static int unin_internal_pci_host_init(PCIDevice *d) |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 250 | { |
aliguori | deb5439 | 2009-01-26 15:37:35 +0000 | [diff] [blame] | 251 | pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_APPLE); |
blueswir1 | 4ebcf88 | 2009-02-01 12:01:04 +0000 | [diff] [blame] | 252 | pci_config_set_device_id(d->config, PCI_DEVICE_ID_APPLE_UNI_N_I_PCI); |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 253 | d->config[0x08] = 0x00; // revision |
blueswir1 | 173a543 | 2009-02-01 19:26:20 +0000 | [diff] [blame] | 254 | pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST); |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 255 | d->config[0x0C] = 0x08; // cache_line_size |
| 256 | d->config[0x0D] = 0x10; // latency_timer |
Isaku Yamahata | 6407f37 | 2009-05-03 19:03:00 +0000 | [diff] [blame] | 257 | d->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 258 | d->config[0x34] = 0x00; // capabilities_pointer |
Gerd Hoffmann | 81a322d | 2009-08-14 10:36:05 +0200 | [diff] [blame] | 259 | return 0; |
pbrook | 502a539 | 2006-05-13 16:11:23 +0000 | [diff] [blame] | 260 | } |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 261 | |
| 262 | static PCIDeviceInfo unin_main_pci_host_info = { |
Markus Armbruster | 18dd19a | 2009-12-14 10:41:21 +0100 | [diff] [blame] | 263 | .qdev.name = "uni-north", |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 264 | .qdev.size = sizeof(PCIDevice), |
| 265 | .init = unin_main_pci_host_init, |
| 266 | }; |
| 267 | |
| 268 | static PCIDeviceInfo dec_21154_pci_host_info = { |
Markus Armbruster | 556cd09 | 2009-12-09 17:07:53 +0100 | [diff] [blame] | 269 | .qdev.name = "dec-21154", |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 270 | .qdev.size = sizeof(PCIDevice), |
| 271 | .init = dec_21154_pci_host_init, |
| 272 | }; |
| 273 | |
| 274 | static PCIDeviceInfo unin_agp_pci_host_info = { |
Markus Armbruster | 18dd19a | 2009-12-14 10:41:21 +0100 | [diff] [blame] | 275 | .qdev.name = "uni-north-agp", |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 276 | .qdev.size = sizeof(PCIDevice), |
| 277 | .init = unin_agp_pci_host_init, |
| 278 | }; |
| 279 | |
| 280 | static PCIDeviceInfo unin_internal_pci_host_info = { |
Markus Armbruster | 18dd19a | 2009-12-14 10:41:21 +0100 | [diff] [blame] | 281 | .qdev.name = "uni-north-pci", |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 282 | .qdev.size = sizeof(PCIDevice), |
| 283 | .init = unin_internal_pci_host_init, |
| 284 | }; |
| 285 | |
| 286 | static void unin_register_devices(void) |
| 287 | { |
Markus Armbruster | 18dd19a | 2009-12-14 10:41:21 +0100 | [diff] [blame] | 288 | sysbus_register_dev("uni-north", sizeof(UNINState), |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 289 | pci_unin_main_init_device); |
| 290 | pci_qdev_register(&unin_main_pci_host_info); |
Markus Armbruster | 556cd09 | 2009-12-09 17:07:53 +0100 | [diff] [blame] | 291 | sysbus_register_dev("dec-21154", sizeof(UNINState), |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 292 | pci_dec_21154_init_device); |
| 293 | pci_qdev_register(&dec_21154_pci_host_info); |
Markus Armbruster | 18dd19a | 2009-12-14 10:41:21 +0100 | [diff] [blame] | 294 | sysbus_register_dev("uni-north-agp", sizeof(UNINState), |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 295 | pci_unin_agp_init_device); |
| 296 | pci_qdev_register(&unin_agp_pci_host_info); |
Markus Armbruster | 18dd19a | 2009-12-14 10:41:21 +0100 | [diff] [blame] | 297 | sysbus_register_dev("uni-north-pci", sizeof(UNINState), |
Blue Swirl | 2e29bd0 | 2009-07-31 20:23:28 +0000 | [diff] [blame] | 298 | pci_unin_internal_init_device); |
| 299 | pci_qdev_register(&unin_internal_pci_host_info); |
| 300 | } |
| 301 | |
| 302 | device_init(unin_register_devices) |