Revision 0f921197

b/hw/pci_ids.h
63 63

  
64 64
#define PCI_VENDOR_ID_APPLE              0x106b
65 65
#define PCI_DEVICE_ID_APPLE_UNI_N_AGP    0x0020
66
#define PCI_DEVICE_ID_APPLE_U3_AGP       0x004b
66 67

  
67 68
#define PCI_VENDOR_ID_SUN                0x108e
68 69
#define PCI_DEVICE_ID_SUN_EBUS           0x1000
b/hw/ppc.h
40 40
    ARCH_PREP = 0,
41 41
    ARCH_MAC99,
42 42
    ARCH_HEATHROW,
43
    ARCH_MAC99_U3,
43 44
};
44 45

  
45 46
#define FW_CFG_PPC_WIDTH	(FW_CFG_ARCH_LOCAL + 0x00)
b/hw/ppc_mac.h
58 58

  
59 59
/* UniNorth PCI */
60 60
PCIBus *pci_pmac_init(qemu_irq *pic);
61
PCIBus *pci_pmac_u3_init(qemu_irq *pic);
61 62

  
62 63
/* Mac NVRAM */
63 64
typedef struct MacIONVRAMState MacIONVRAMState;
b/hw/ppc_newworld.c
114 114
    void *fw_cfg;
115 115
    void *dbdma;
116 116
    uint8_t *vga_bios_ptr;
117
    int machine_arch;
117 118

  
118 119
    linux_boot = (kernel_filename != NULL);
119 120

  
......
317 318
        }
318 319
    }
319 320
    pic = openpic_init(NULL, &pic_mem_index, smp_cpus, openpic_irqs, NULL);
320
    pci_bus = pci_pmac_init(pic);
321
    if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) {
322
        /* 970 gets a U3 bus */
323
        pci_bus = pci_pmac_u3_init(pic);
324
        machine_arch = ARCH_MAC99_U3;
325
    } else {
326
        pci_bus = pci_pmac_init(pic);
327
        machine_arch = ARCH_MAC99;
328
    }
321 329
    /* init basic PC hardware */
322 330
    pci_vga_init(pci_bus, vga_bios_offset, vga_bios_size);
323 331

  
......
364 372
    fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
365 373
    fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
366 374
    fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
367
    fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_MAC99);
375
    fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, machine_arch);
368 376
    fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base);
369 377
    fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size);
370 378
    if (kernel_cmdline) {
b/hw/unin_pci.c
159 159
    return 0;
160 160
}
161 161

  
162
static int pci_u3_agp_init_device(SysBusDevice *dev)
163
{
164
    UNINState *s;
165
    int pci_mem_config, pci_mem_data;
166

  
167
    /* Uninorth U3 AGP bus */
168
    s = FROM_SYSBUS(UNINState, dev);
169

  
170
    pci_mem_config = pci_host_conf_register_mmio(&s->host_state);
171
    s->data_handler.read = unin_data_read;
172
    s->data_handler.write = unin_data_write;
173
    pci_mem_data = cpu_register_io_memory_simple(&s->data_handler);
174
    sysbus_init_mmio(dev, 0x1000, pci_mem_config);
175
    sysbus_init_mmio(dev, 0x1000, pci_mem_data);
176

  
177
    register_savevm("uninorth", 0, 1, pci_unin_save, pci_unin_load, &s->host_state);
178
    qemu_register_reset(pci_unin_reset, &s->host_state);
179

  
180
    return 0;
181
}
182

  
162 183
static int pci_unin_agp_init_device(SysBusDevice *dev)
163 184
{
164 185
    UNINState *s;
......
240 261
    return d->host_state.bus;
241 262
}
242 263

  
264
PCIBus *pci_pmac_u3_init(qemu_irq *pic)
265
{
266
    DeviceState *dev;
267
    SysBusDevice *s;
268
    UNINState *d;
269

  
270
    /* Uninorth AGP bus */
271

  
272
    dev = qdev_create(NULL, "u3-agp");
273
    qdev_init_nofail(dev);
274
    s = sysbus_from_qdev(dev);
275
    d = FROM_SYSBUS(UNINState, s);
276

  
277
    d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci",
278
                                         pci_unin_set_irq, pci_unin_map_irq,
279
                                         pic, 11 << 3, 4);
280

  
281
    sysbus_mmio_map(s, 0, 0xf0800000);
282
    sysbus_mmio_map(s, 1, 0xf0c00000);
283

  
284
    pci_create_simple(d->host_state.bus, 11 << 3, "u3-agp");
285

  
286
    return d->host_state.bus;
287
}
288

  
243 289
static int unin_main_pci_host_init(PCIDevice *d)
244 290
{
245 291
    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_APPLE);
......
266 312
    return 0;
267 313
}
268 314

  
315
static int u3_agp_pci_host_init(PCIDevice *d)
316
{
317
    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_APPLE);
318
    pci_config_set_device_id(d->config, PCI_DEVICE_ID_APPLE_U3_AGP);
319
    /* revision */
320
    d->config[0x08] = 0x00;
321
    pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);
322
    /* cache line size */
323
    d->config[0x0C] = 0x08;
324
    /* latency timer */
325
    d->config[0x0D] = 0x10;
326
    d->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL;
327
    return 0;
328
}
329

  
269 330
static int unin_internal_pci_host_init(PCIDevice *d)
270 331
{
271 332
    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_APPLE);
......
285 346
    .init      = unin_main_pci_host_init,
286 347
};
287 348

  
349
static PCIDeviceInfo u3_agp_pci_host_info = {
350
    .qdev.name = "u3-agp",
351
    .qdev.size = sizeof(PCIDevice),
352
    .init      = u3_agp_pci_host_init,
353
};
354

  
288 355
static PCIDeviceInfo unin_agp_pci_host_info = {
289 356
    .qdev.name = "uni-north-agp",
290 357
    .qdev.size = sizeof(PCIDevice),
......
302 369
    sysbus_register_dev("uni-north", sizeof(UNINState),
303 370
                        pci_unin_main_init_device);
304 371
    pci_qdev_register(&unin_main_pci_host_info);
372
    sysbus_register_dev("u3-agp", sizeof(UNINState),
373
                        pci_u3_agp_init_device);
374
    pci_qdev_register(&u3_agp_pci_host_info);
305 375
    sysbus_register_dev("uni-north-agp", sizeof(UNINState),
306 376
                        pci_unin_agp_init_device);
307 377
    pci_qdev_register(&unin_agp_pci_host_info);

Also available in: Unified diff