initial qemu support.

This commit is contained in:
Mariano Alvira 2009-04-10 12:14:26 -04:00
parent 5fc1a9f224
commit cb89cef7a0
7 changed files with 11729 additions and 0 deletions

104
qemu/hw/boards.h Normal file
View file

@ -0,0 +1,104 @@
/* Declarations for use by board files for creating devices. */
#ifndef HW_BOARDS_H
#define HW_BOARDS_H
typedef void QEMUMachineInitFunc(int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char *kernel_filename,
const char *kernel_cmdline,
const char *initrd_filename,
const char *cpu_model);
typedef struct QEMUMachine {
const char *name;
const char *desc;
QEMUMachineInitFunc *init;
struct QEMUMachine *next;
} QEMUMachine;
int qemu_register_machine(QEMUMachine *m);
/* Axis ETRAX. */
extern QEMUMachine bareetraxfs_machine;
/* pc.c */
extern QEMUMachine pc_machine;
extern QEMUMachine isapc_machine;
/* ppc.c */
extern QEMUMachine prep_machine;
extern QEMUMachine core99_machine;
extern QEMUMachine heathrow_machine;
extern QEMUMachine ref405ep_machine;
extern QEMUMachine taihu_machine;
/* mips_r4k.c */
extern QEMUMachine mips_machine;
/* mips_malta.c */
extern QEMUMachine mips_malta_machine;
/* mips_pica61.c */
extern QEMUMachine mips_pica61_machine;
/* mips_mipssim.c */
extern QEMUMachine mips_mipssim_machine;
/* shix.c */
extern QEMUMachine shix_machine;
/* r2d.c */
extern QEMUMachine r2d_machine;
/* sun4m.c */
extern QEMUMachine ss5_machine, ss10_machine, ss600mp_machine, ss20_machine;
extern QEMUMachine ss2_machine;
extern QEMUMachine ss1000_machine, ss2000_machine;
/* sun4u.c */
extern QEMUMachine sun4u_machine;
/* integratorcp.c */
extern QEMUMachine integratorcp_machine;
/* versatilepb.c */
extern QEMUMachine versatilepb_machine;
extern QEMUMachine versatileab_machine;
/* realview.c */
extern QEMUMachine realview_machine;
/* spitz.c */
extern QEMUMachine akitapda_machine;
extern QEMUMachine spitzpda_machine;
extern QEMUMachine borzoipda_machine;
extern QEMUMachine terrierpda_machine;
/* palm.c */
extern QEMUMachine palmte_machine;
/* gumstix.c */
extern QEMUMachine connex_machine;
extern QEMUMachine verdex_machine;
/* mc1322x.c */
extern QEMUMachine mc1322x_machine;
/* stellaris.c */
extern QEMUMachine lm3s811evb_machine;
extern QEMUMachine lm3s6965evb_machine;
/* an5206.c */
extern QEMUMachine an5206_machine;
/* mcf5208.c */
extern QEMUMachine mcf5208evb_machine;
/* dummy_m68k.c */
extern QEMUMachine dummy_m68k_machine;
/* mainstone.c */
extern QEMUMachine mainstone2_machine;
#endif

56
qemu/hw/mc1322x.c Normal file
View file

@ -0,0 +1,56 @@
/* Freescale mc1322x support
*
* Copyright (c) 2009 Mariano Alvira
* Written by Mariano Alvira <mar@devl.org>
*
* This code is licenced under the GPL.
*/
#include "hw.h"
#include "mc1322x.h"
#include "sysemu.h"
#include "boards.h"
#include "flash.h"
static const int sector_len = 128 * 1024;
/* Initialize a MC1322x (ARM7) */
struct mc1322x_state_s *mc1322x_init(void)
{
struct mc1322x_state_s *s;
int index;
s = (struct mc1322x_state_s *) qemu_mallocz(sizeof(struct mc1322x_state_s));
s->env = cpu_init("mc1322x");
if (!s->env) {
fprintf(stderr, "Unable to find CPU definition\n");
exit(1);
}
register_savevm("cpu", 0, ARM_CPU_SAVE_VERSION, cpu_save, cpu_load,
s->env);
/* SDRAM & Internal Memory Storage */
cpu_register_physical_memory(MC1322X_ROMBASE, MC1322X_ROMSIZE,
qemu_ram_alloc(MC1322X_ROMSIZE) | IO_MEM_RAM);
cpu_register_physical_memory(MC1322X_RAMBASE, MC1322X_RAMSIZE,
qemu_ram_alloc(MC1322X_RAMSIZE) | IO_MEM_RAM);
index = drive_get_index(IF_PFLASH, 0, 0);
if (!pflash_cfi01_register(0x00400000, qemu_ram_alloc(MC1322X_RAMBASE),
drives_table[index].bdrv, sector_len, MC1322X_RAMBASE / sector_len,
2, 0, 0, 0, 0)) {
fprintf(stderr, "qemu: Error registering flash memory.\n");
exit(1);
}
s->env->regs[15] = 0x00400000;
return s;
}
QEMUMachine mc1322x_machine = {
"mc1322x",
"mc1322x board",
mc1322x_init,
};

37
qemu/hw/mc1322x.h Normal file
View file

@ -0,0 +1,37 @@
/* Freescale mc1322x support
*
* Copyright (c) 2009 Mariano Alvira
* Written by Mariano Alvira <mar@devl.org>
*
* This code is licenced under the GPL.
*/
#ifndef PXA_H
#define PXA_H "pxa.h"
#define MC1322X_ROMBASE 0x00000000
#define MC1322X_ROMSIZE 0x00014000
#define MC1322X_RAMBASE 0x04000000
#define MC1322X_RAMSIZE 0x00020000
/* mc1322x.c */
struct mc1322x_state_s {
CPUState *env;
qemu_irq *pic;
qemu_irq reset;
struct mc1322x_gpio_info_s *gpio;
struct mc1322x_keypad_s *kp;
/* Power management */
target_phys_addr_t pm_base;
uint32_t pm_regs[0x40];
/* Clock management */
target_phys_addr_t cm_base;
uint32_t cm_regs[4];
uint32_t clkcfg;
};
#endif