#include "chardev/char.h"
#include "qemu/cutils.h"
#include "qemu/bswap.h"
+#include "qemu/hw-version.h"
#include "sysemu/reset.h"
#include "sysemu/runstate.h"
#include "sysemu/sysemu.h"
#include "hw/boards.h"
#include "hw/i2c/i2c.h"
#include "hw/display/blizzard.h"
+#include "hw/input/lm832x.h"
#include "hw/input/tsc2xxx.h"
#include "hw/misc/cbus.h"
-#include "hw/misc/tmp105.h"
+#include "hw/sensor/tmp105.h"
#include "hw/qdev-properties.h"
#include "hw/block/flash.h"
#include "hw/hw.h"
#include "hw/loader.h"
#include "hw/sysbus.h"
#include "qemu/log.h"
-#include "exec/address-spaces.h"
/* Nokia N8x0 support */
struct n800_s {
}
/* Touchscreen and keypad controller */
-static MouseTransformInfo n800_pointercal = {
+static const MouseTransformInfo n800_pointercal = {
.x = 800,
.y = 480,
.a = { 14560, -68, -3455208, -39, -9621, 35152972, 65536 },
};
-static MouseTransformInfo n810_pointercal = {
+static const MouseTransformInfo n810_pointercal = {
.x = 800,
.y = 480,
.a = { 15041, 148, -4731056, 171, -10238, 35933380, 65536 },
#define M 0
-static int n810_keys[0x80] = {
+static const int n810_keys[0x80] = {
[0x01] = 16, /* Q */
[0x02] = 37, /* K */
[0x03] = 24, /* O */
/* Attach the LM8322 keyboard to the I2C bus,
* should happen in n8x0_i2c_setup and s->kbd be initialised here. */
s->kbd = DEVICE(i2c_slave_create_simple(omap_i2c_bus(s->mpu->i2c[0]),
- "lm8323", N810_LM8323_ADDR));
+ TYPE_LM8323, N810_LM8323_ADDR));
qdev_connect_gpio_out(s->kbd, 0, kbd_irq);
}
default:
bad_cmd:
qemu_log_mask(LOG_GUEST_ERROR,
- "%s: unknown command %02x\n", __func__, s->cmd);
+ "%s: unknown command 0x%02x\n", __func__, s->cmd);
break;
}
static void *mipid_init(void)
{
- struct mipid_s *s = (struct mipid_s *) g_malloc0(sizeof(*s));
+ struct mipid_s *s = g_malloc0(sizeof(*s));
s->id = 0x838f03;
mipid_reset(s);
cbus_attach(cbus, s->tahvo = tahvo_init(tahvo_irq, 1));
}
-static void n8x0_uart_setup(struct n800_s *s)
-{
- Chardev *radio = qemu_chr_new("bt-dummy-uart", "null", NULL);
- /*
- * Note: We used to connect N8X0_BT_RESET_GPIO and N8X0_BT_WKUP_GPIO
- * here, but this code has been removed with the bluetooth backend.
- */
- omap_uart_attach(s->mpu->uart[BT_UART], radio);
-}
-
static void n8x0_usb_setup(struct n800_s *s)
{
SysBusDevice *dev;
/* Setup done before the main bootloader starts by some early setup code
* - used when we want to run the main bootloader in emulation. This
* isn't documented. */
-static uint32_t n800_pinout[104] = {
+static const uint32_t n800_pinout[104] = {
0x080f00d8, 0x00d40808, 0x03080808, 0x080800d0,
0x00dc0808, 0x0b0f0f00, 0x080800b4, 0x00c00808,
0x08080808, 0x180800c4, 0x00b80000, 0x08080808,
#define OMAP_TAG_CBUS 0x4e03
#define OMAP_TAG_EM_ASIC_BB5 0x4e04
-static struct omap_gpiosw_info_s {
+static const struct omap_gpiosw_info_s {
const char *name;
int line;
int type;
"headphone", N8X0_HEADPHONE_GPIO,
OMAP_GPIOSW_TYPE_CONNECTION | OMAP_GPIOSW_INVERTED,
},
- { NULL }
+ { /* end of list */ }
}, n810_gpiosw_info[] = {
{
"gps_reset", N810_GPS_RESET_GPIO,
"slide", N810_SLIDE_GPIO,
OMAP_GPIOSW_TYPE_COVER | OMAP_GPIOSW_INVERTED,
},
- { NULL }
+ { /* end of list */ }
};
-static struct omap_partition_info_s {
+static const struct omap_partition_info_s {
uint32_t offset;
uint32_t size;
int mask;
{ 0x00080000, 0x00200000, 0x0, "kernel" },
{ 0x00280000, 0x00200000, 0x3, "initfs" },
{ 0x00480000, 0x0fb80000, 0x3, "rootfs" },
-
- { 0, 0, 0, NULL }
+ { /* end of list */ }
}, n810_part_info[] = {
{ 0x00000000, 0x00020000, 0x3, "bootloader" },
{ 0x00020000, 0x00060000, 0x0, "config" },
{ 0x00080000, 0x00220000, 0x0, "kernel" },
{ 0x002a0000, 0x00400000, 0x0, "initfs" },
{ 0x006a0000, 0x0f960000, 0x0, "rootfs" },
-
- { 0, 0, 0, NULL }
+ { /* end of list */ }
};
-static uint8_t n8x0_bd_addr[6] = { N8X0_BD_ADDR };
+static const uint8_t n8x0_bd_addr[6] = { N8X0_BD_ADDR };
static int n8x0_atag_setup(void *p, int model)
{
uint8_t *b;
uint16_t *w;
uint32_t *l;
- struct omap_gpiosw_info_s *gpiosw;
- struct omap_partition_info_s *partition;
+ const struct omap_gpiosw_info_s *gpiosw;
+ const struct omap_partition_info_s *partition;
const char *tag;
w = p;
static void n8x0_init(MachineState *machine,
struct arm_boot_info *binfo, int model)
{
- struct n800_s *s = (struct n800_s *) g_malloc0(sizeof(*s));
+ struct n800_s *s = g_malloc0(sizeof(*s));
MachineClass *mc = MACHINE_GET_CLASS(machine);
if (machine->ram_size != mc->default_ram_size) {
g_free(sz);
exit(EXIT_FAILURE);
}
+ binfo->ram_size = machine->ram_size;
memory_region_add_subregion(get_system_memory(), OMAP2_Q2_BASE,
machine->ram);
n8x0_spi_setup(s);
n8x0_dss_setup(s);
n8x0_cbus_setup(s);
- n8x0_uart_setup(s);
if (machine_usb(machine)) {
n8x0_usb_setup(s);
}
}
if (option_rom[0].name &&
- (machine->boot_order[0] == 'n' || !machine->kernel_filename)) {
+ (machine->boot_config.order[0] == 'n' || !machine->kernel_filename)) {
uint8_t *nolo_tags = g_new(uint8_t, 0x10000);
/* No, wait, better start at the ROM. */
s->mpu->cpu->env.regs[15] = OMAP2_Q2_BASE + 0x400000;
- /* This is intended for loading the `secondary.bin' program from
+ /*
+ * This is intended for loading the `secondary.bin' program from
* Nokia images (the NOLO bootloader). The entry point seems
* to be at OMAP2_Q2_BASE + 0x400000.
*
* for them the entry point needs to be set to OMAP2_SRAM_BASE.
*
* The code above is for loading the `zImage' file from Nokia
- * images. */
- load_image_targphys(option_rom[0].name, OMAP2_Q2_BASE + 0x400000,
- machine->ram_size - 0x400000);
+ * images.
+ */
+ if (load_image_targphys(option_rom[0].name,
+ OMAP2_Q2_BASE + 0x400000,
+ machine->ram_size - 0x400000) < 0) {
+ error_report("Failed to load secondary bootloader %s",
+ option_rom[0].name);
+ exit(EXIT_FAILURE);
+ }
n800_setup_nolo_tags(nolo_tags);
cpu_physical_memory_write(OMAP2_SRAM_BASE, nolo_tags, 0x10000);