~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to hw/arm/highbank.c

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-10-22 22:47:07 UTC
  • mfrom: (1.8.3) (10.1.42 sid)
  • Revision ID: package-import@ubuntu.com-20131022224707-1lya34fw3k3f24tv
Tags: 1.6.0+dfsg-2ubuntu1
* Merge 1.6.0~rc0+dfsg-2exp from debian experimental.  Remaining changes:
  - debian/control
    * update maintainer
    * remove libiscsi, usb-redir, vde, vnc-jpeg, and libssh2-1-dev
      from build-deps
    * enable rbd
    * add qemu-system and qemu-common B/R to qemu-keymaps
    * add D:udev, R:qemu, R:qemu-common and B:qemu-common to
      qemu-system-common
    * qemu-system-arm, qemu-system-ppc, qemu-system-sparc:
      - add qemu-kvm to Provides
      - add qemu-common, qemu-kvm, kvm to B/R
      - remove openbios-sparc from qemu-system-sparc D
      - drop openbios-ppc and openhackware Depends to Suggests (for now)
    * qemu-system-x86:
      - add qemu-common to Breaks/Replaces.
      - add cpu-checker to Recommends.
    * qemu-user: add B/R:qemu-kvm
    * qemu-kvm:
      - add armhf armel powerpc sparc to Architecture
      - C/R/P: qemu-kvm-spice
    * add qemu-common package
    * drop qemu-slof which is not packaged in ubuntu
  - add qemu-system-common.links for tap ifup/down scripts and OVMF link.
  - qemu-system-x86.links:
    * remove pxe rom links which are in kvm-ipxe
    * add symlink for kvm.1 manpage
  - debian/rules
    * add kvm-spice symlink to qemu-kvm
    * call dh_installmodules for qemu-system-x86
    * update dh_installinit to install upstart script
    * run dh_installman (Closes: #709241) (cherrypicked from 1.5.0+dfsg-2)
  - Add qemu-utils.links for kvm-* symlinks.
  - Add qemu-system-x86.qemu-kvm.upstart and .default
  - Add qemu-system-x86.modprobe to set nesting=1
  - Add qemu-system-common.preinst to add kvm group
  - qemu-system-common.postinst: remove bad group acl if there, then have
    udev relabel /dev/kvm.
  - New linaro patches from qemu-linaro rebasing branch
  - Dropped patches:
    * xen-simplify-xen_enabled.patch
    * sparc-linux-user-fix-missing-symbols-in-.rel-.rela.plt-sections.patch
    * main_loop-do-not-set-nonblocking-if-xen_enabled.patch
    * xen_machine_pv-do-not-create-a-dummy-CPU-in-machine-.patch
    * virtio-rng-fix-crash
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * linaro arm patches from qemu-linaro rebasing branch
  - New patches:
    * fix-pci-add: change CONFIG variable in ifdef to make sure that
      pci_add is defined.
* Add linaro patches
* Add experimental mach-virt patches for arm virtualization.
* qemu-system-common.install: add debian/tmp/usr/lib to install the
  qemu-bridge-helper

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "net/net.h"
25
25
#include "sysemu/sysemu.h"
26
26
#include "hw/boards.h"
27
 
#include "hw/sysbus.h"
28
27
#include "sysemu/blockdev.h"
29
28
#include "exec/address-spaces.h"
30
29
 
117
116
    .endianness = DEVICE_NATIVE_ENDIAN,
118
117
};
119
118
 
 
119
#define TYPE_HIGHBANK_REGISTERS "highbank-regs"
 
120
#define HIGHBANK_REGISTERS(obj) \
 
121
    OBJECT_CHECK(HighbankRegsState, (obj), TYPE_HIGHBANK_REGISTERS)
 
122
 
120
123
typedef struct {
121
 
    SysBusDevice busdev;
 
124
    /*< private >*/
 
125
    SysBusDevice parent_obj;
 
126
    /*< public >*/
 
127
 
122
128
    MemoryRegion *iomem;
123
129
    uint32_t regs[NUM_REGS];
124
130
} HighbankRegsState;
136
142
 
137
143
static void highbank_regs_reset(DeviceState *dev)
138
144
{
139
 
    SysBusDevice *sys_dev = SYS_BUS_DEVICE(dev);
140
 
    HighbankRegsState *s = FROM_SYSBUS(HighbankRegsState, sys_dev);
 
145
    HighbankRegsState *s = HIGHBANK_REGISTERS(dev);
141
146
 
142
147
    s->regs[0x40] = 0x05F20121;
143
148
    s->regs[0x41] = 0x2;
147
152
 
148
153
static int highbank_regs_init(SysBusDevice *dev)
149
154
{
150
 
    HighbankRegsState *s = FROM_SYSBUS(HighbankRegsState, dev);
 
155
    HighbankRegsState *s = HIGHBANK_REGISTERS(dev);
151
156
 
152
157
    s->iomem = g_new(MemoryRegion, 1);
153
 
    memory_region_init_io(s->iomem, &hb_mem_ops, s->regs, "highbank_regs",
154
 
                          0x1000);
 
158
    memory_region_init_io(s->iomem, OBJECT(s), &hb_mem_ops, s->regs,
 
159
                          "highbank_regs", 0x1000);
155
160
    sysbus_init_mmio(dev, s->iomem);
156
161
 
157
162
    return 0;
169
174
}
170
175
 
171
176
static const TypeInfo highbank_regs_info = {
172
 
    .name          = "highbank-regs",
 
177
    .name          = TYPE_HIGHBANK_REGISTERS,
173
178
    .parent        = TYPE_SYS_BUS_DEVICE,
174
179
    .instance_size = sizeof(HighbankRegsState),
175
180
    .class_init    = highbank_regs_class_init,
184
189
 
185
190
static struct arm_boot_info highbank_binfo;
186
191
 
 
192
enum cxmachines {
 
193
    CALXEDA_HIGHBANK,
 
194
    CALXEDA_MIDWAY,
 
195
};
 
196
 
187
197
/* ram_size must be set to match the upper bound of memory in the
188
198
 * device tree (linux/arch/arm/boot/dts/highbank.dts), which is
189
199
 * normally 0xff900000 or -m 4089. When running this board on a
190
200
 * 32-bit host, set the reg value of memory to 0xf7ff00000 in the
191
201
 * device tree and pass -m 2047 to QEMU.
192
202
 */
193
 
static void highbank_init(QEMUMachineInitArgs *args)
 
203
static void calxeda_init(QEMUMachineInitArgs *args, enum cxmachines machine)
194
204
{
195
205
    ram_addr_t ram_size = args->ram_size;
196
206
    const char *cpu_model = args->cpu_model;
197
207
    const char *kernel_filename = args->kernel_filename;
198
208
    const char *kernel_cmdline = args->kernel_cmdline;
199
209
    const char *initrd_filename = args->initrd_filename;
200
 
    DeviceState *dev;
 
210
    DeviceState *dev = NULL;
201
211
    SysBusDevice *busdev;
202
212
    qemu_irq *irqp;
203
213
    qemu_irq pic[128];
209
219
    char *sysboot_filename;
210
220
 
211
221
    if (!cpu_model) {
212
 
        cpu_model = "cortex-a9";
 
222
        switch (machine) {
 
223
        case CALXEDA_HIGHBANK:
 
224
            cpu_model = "cortex-a9";
 
225
            break;
 
226
        case CALXEDA_MIDWAY:
 
227
            cpu_model = "cortex-a15";
 
228
            break;
 
229
        }
213
230
    }
214
231
 
215
232
    for (n = 0; n < smp_cpus; n++) {
228
245
 
229
246
    sysmem = get_system_memory();
230
247
    dram = g_new(MemoryRegion, 1);
231
 
    memory_region_init_ram(dram, "highbank.dram", ram_size);
 
248
    memory_region_init_ram(dram, NULL, "highbank.dram", ram_size);
232
249
    /* SDRAM at address zero.  */
233
250
    memory_region_add_subregion(sysmem, 0, dram);
234
251
 
235
252
    sysram = g_new(MemoryRegion, 1);
236
 
    memory_region_init_ram(sysram, "highbank.sysram", 0x8000);
 
253
    memory_region_init_ram(sysram, NULL, "highbank.sysram", 0x8000);
237
254
    memory_region_add_subregion(sysmem, 0xfff88000, sysram);
238
255
    if (bios_name != NULL) {
239
256
        sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
247
264
        }
248
265
    }
249
266
 
250
 
    dev = qdev_create(NULL, "a9mpcore_priv");
 
267
    switch (machine) {
 
268
    case CALXEDA_HIGHBANK:
 
269
        dev = qdev_create(NULL, "l2x0");
 
270
        qdev_init_nofail(dev);
 
271
        busdev = SYS_BUS_DEVICE(dev);
 
272
        sysbus_mmio_map(busdev, 0, 0xfff12000);
 
273
 
 
274
        dev = qdev_create(NULL, "a9mpcore_priv");
 
275
        break;
 
276
    case CALXEDA_MIDWAY:
 
277
        dev = qdev_create(NULL, "a15mpcore_priv");
 
278
        break;
 
279
    }
251
280
    qdev_prop_set_uint32(dev, "num-cpu", smp_cpus);
252
281
    qdev_prop_set_uint32(dev, "num-irq", NIRQ_GIC);
253
282
    qdev_init_nofail(dev);
261
290
        pic[n] = qdev_get_gpio_in(dev, n);
262
291
    }
263
292
 
264
 
    dev = qdev_create(NULL, "l2x0");
265
 
    qdev_init_nofail(dev);
266
 
    busdev = SYS_BUS_DEVICE(dev);
267
 
    sysbus_mmio_map(busdev, 0, 0xfff12000);
268
 
 
269
293
    dev = qdev_create(NULL, "sp804");
270
294
    qdev_prop_set_uint32(dev, "freq0", 150000000);
271
295
    qdev_prop_set_uint32(dev, "freq1", 150000000);
322
346
    highbank_binfo.loader_start = 0;
323
347
    highbank_binfo.write_secondary_boot = hb_write_secondary;
324
348
    highbank_binfo.secondary_cpu_reset_hook = hb_reset_secondary;
325
 
    arm_load_kernel(arm_env_get_cpu(first_cpu), &highbank_binfo);
 
349
    arm_load_kernel(ARM_CPU(first_cpu), &highbank_binfo);
 
350
}
 
351
 
 
352
static void highbank_init(QEMUMachineInitArgs *args)
 
353
{
 
354
    calxeda_init(args, CALXEDA_HIGHBANK);
 
355
}
 
356
 
 
357
static void midway_init(QEMUMachineInitArgs *args)
 
358
{
 
359
    calxeda_init(args, CALXEDA_MIDWAY);
326
360
}
327
361
 
328
362
static QEMUMachine highbank_machine = {
334
368
    DEFAULT_MACHINE_OPTIONS,
335
369
};
336
370
 
337
 
static void highbank_machine_init(void)
 
371
static QEMUMachine midway_machine = {
 
372
    .name = "midway",
 
373
    .desc = "Calxeda Midway (ECX-2000)",
 
374
    .init = midway_init,
 
375
    .block_default_type = IF_SCSI,
 
376
    .max_cpus = 4,
 
377
    DEFAULT_MACHINE_OPTIONS,
 
378
};
 
379
 
 
380
static void calxeda_machines_init(void)
338
381
{
339
382
    qemu_register_machine(&highbank_machine);
 
383
    qemu_register_machine(&midway_machine);
340
384
}
341
385
 
342
 
machine_init(highbank_machine_init);
 
386
machine_init(calxeda_machines_init);