~ubuntu-branches/ubuntu/precise/qemu-kvm/precise

« back to all changes in this revision

Viewing changes to hw/realview.c

  • Committer: Serge Hallyn
  • Date: 2011-10-19 07:37:43 UTC
  • mfrom: (1.2.7)
  • Revision ID: serge.hallyn@ubuntu.com-20111019073743-7i7n9irsxlm38wic
Tags: 0.15.0+noroms-0ubuntu1
* New upstream release
* Remaining changes from upstream:
  - removed all binary roms and tests/pi_10.com
* Removed Detect-and-use-GCC-atomic-builtins-for-locking.patch - non-NPTL
  implementations were removed with commit
  02615337ef295443daa03233e492194e289a807e
* Drop spice-qxl-locking-fix-for-qemu-kvm.patch - should be unnecessary
  as of commit 196a778428989217b82de042725dc8eb29c8f8d8
* drop patches applied upstream:
  - CVE-2011-1751.diff
  - virtio-guard-against-negative-vq-notifies-CVE-2011-2512.diff
  - CVE-2011-2527.patch
  - fix-pa-configure.patch
* Refreshed the remaining patches:
  - larger_default_ram_size.patch
  - CVE-2011-2212-virtqueue-indirect-overflow.patch
  - qemuifup-fix-paths.patch
  - vpc.patch
* e1000-Dont-set-the-Capabilities-List-bit.patch - switched to the
  cherrypicked upstream patch (as the source file changed quite a bit,
  and the hand-ported patch backported to 0.14.1 does not apply).
* Drop qemu-kvm-spice (all changes from 0.14.1+noroms-0ubuntu7), it will
  need its own source package (LP: #878162)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 * Copyright (c) 2006-2007 CodeSourcery.
5
5
 * Written by Paul Brook
6
6
 *
7
 
 * This code is licenced under the GPL.
 
7
 * This code is licensed under the GPL.
8
8
 */
9
9
 
10
10
#include "sysbus.h"
17
17
#include "sysemu.h"
18
18
#include "boards.h"
19
19
#include "bitbang_i2c.h"
20
 
#include "sysbus.h"
21
20
#include "blockdev.h"
22
21
 
23
22
#define SMP_BOOT_ADDR 0xe0000000
104
103
    .smp_loader_start = SMP_BOOT_ADDR,
105
104
};
106
105
 
107
 
static void secondary_cpu_reset(void *opaque)
108
 
{
109
 
  CPUState *env = opaque;
110
 
 
111
 
  cpu_reset(env);
112
 
  /* Set entry point for secondary CPUs.  This assumes we're using
113
 
     the init code from arm_boot.c.  Real hardware resets all CPUs
114
 
     the same.  */
115
 
  env->regs[15] = SMP_BOOT_ADDR;
116
 
}
117
 
 
118
106
/* The following two lists must be consistent.  */
119
107
enum realview_board_type {
120
108
    BOARD_EB,
138
126
{
139
127
    CPUState *env = NULL;
140
128
    ram_addr_t ram_offset;
141
 
    DeviceState *dev;
 
129
    DeviceState *dev, *sysctl, *gpio2;
142
130
    SysBusDevice *busdev;
143
131
    qemu_irq *irqp;
144
132
    qemu_irq pic[64];
 
133
    qemu_irq mmc_irq[2];
145
134
    PCIBus *pci_bus;
146
135
    NICInfo *nd;
147
136
    i2c_bus *i2c;
176
165
        }
177
166
        irqp = arm_pic_init_cpu(env);
178
167
        cpu_irq[n] = irqp[ARM_PIC_CPU_IRQ];
179
 
        if (n > 0) {
180
 
            qemu_register_reset(secondary_cpu_reset, env);
181
 
        }
182
168
    }
183
169
    if (arm_feature(env, ARM_FEATURE_V7)) {
184
170
        if (is_mpcore) {
218
204
    }
219
205
 
220
206
    sys_id = is_pb ? 0x01780500 : 0xc1400400;
221
 
    arm_sysctl_init(0x10000000, sys_id, proc_id);
 
207
    sysctl = qdev_create(NULL, "realview_sysctl");
 
208
    qdev_prop_set_uint32(sysctl, "sys_id", sys_id);
 
209
    qdev_init_nofail(sysctl);
 
210
    qdev_prop_set_uint32(sysctl, "proc_id", proc_id);
 
211
    sysbus_mmio_map(sysbus_from_qdev(sysctl), 0, 0x10000000);
222
212
 
223
213
    if (is_mpcore) {
224
214
        dev = qdev_create(NULL, is_pb ? "a9mpcore_priv": "realview_mpcore");
257
247
    sysbus_create_simple("sp804", 0x10011000, pic[4]);
258
248
    sysbus_create_simple("sp804", 0x10012000, pic[5]);
259
249
 
 
250
    sysbus_create_simple("pl061", 0x10013000, pic[6]);
 
251
    sysbus_create_simple("pl061", 0x10014000, pic[7]);
 
252
    gpio2 = sysbus_create_simple("pl061", 0x10015000, pic[8]);
 
253
 
260
254
    sysbus_create_simple("pl110_versatile", 0x10020000, pic[23]);
261
255
 
262
 
    sysbus_create_varargs("pl181", 0x10005000, pic[17], pic[18], NULL);
 
256
    dev = sysbus_create_varargs("pl181", 0x10005000, pic[17], pic[18], NULL);
 
257
    /* Wire up MMC card detect and read-only signals. These have
 
258
     * to go to both the PL061 GPIO and the sysctl register.
 
259
     * Note that the PL181 orders these lines (readonly,inserted)
 
260
     * and the PL061 has them the other way about. Also the card
 
261
     * detect line is inverted.
 
262
     */
 
263
    mmc_irq[0] = qemu_irq_split(
 
264
        qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT),
 
265
        qdev_get_gpio_in(gpio2, 1));
 
266
    mmc_irq[1] = qemu_irq_split(
 
267
        qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN),
 
268
        qemu_irq_invert(qdev_get_gpio_in(gpio2, 0)));
 
269
    qdev_connect_gpio_out(dev, 0, mmc_irq[0]);
 
270
    qdev_connect_gpio_out(dev, 1, mmc_irq[1]);
263
271
 
264
272
    sysbus_create_simple("pl031", 0x10017000, pic[10]);
265
273
 
279
287
    for(n = 0; n < nb_nics; n++) {
280
288
        nd = &nd_table[n];
281
289
 
282
 
        if ((!nd->model && !done_nic)
283
 
            || strcmp(nd->model, is_pb ? "lan9118" : "smc91c111") == 0) {
 
290
        if (!done_nic && (!nd->model ||
 
291
                    strcmp(nd->model, is_pb ? "lan9118" : "smc91c111") == 0)) {
284
292
            if (is_pb) {
285
293
                lan9118_init(nd, 0x4e000000, pic[28]);
286
294
            } else {