~vcs-imports/qemu/git

« back to all changes in this revision

Viewing changes to hw/spitz.c

  • Committer: ths
  • Date: 2007-05-05 19:24:38 UTC
  • Revision ID: git-v1:608e8ce280cee231b3de0e7922060efd23447a54
Linker scripts for MIPS hosts.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2772 c046a42c-6fe2-441c-8c8c-71466251a162

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 * This code is licensed under the GNU GPL v2.
8
8
 */
9
9
 
10
 
#include "hw.h"
11
 
#include "pxa.h"
12
 
#include "arm-misc.h"
13
 
#include "sysemu.h"
14
 
#include "pcmcia.h"
15
 
#include "i2c.h"
16
 
#include "flash.h"
17
 
#include "qemu-timer.h"
18
 
#include "devices.h"
19
 
#include "sharpsl.h"
20
 
#include "console.h"
21
 
#include "block.h"
22
 
#include "audio/audio.h"
23
 
#include "boards.h"
 
10
#include "vl.h"
24
11
 
 
12
#define spitz_printf(format, ...)       \
 
13
    fprintf(stderr, "%s: " format, __FUNCTION__, ##__VA_ARGS__)
25
14
#undef REG_FMT
26
 
#if TARGET_PHYS_ADDR_BITS == 32
27
 
#define REG_FMT                 "0x%02x"
28
 
#else
29
15
#define REG_FMT                 "0x%02lx"
30
 
#endif
31
16
 
32
17
/* Spitz Flash */
33
18
#define FLASH_BASE              0x0c000000
88
73
        return ecc_digest(&s->ecc, nand_getio(s->nand));
89
74
 
90
75
    default:
91
 
        zaurus_printf("Bad register offset " REG_FMT "\n", addr);
 
76
        spitz_printf("Bad register offset " REG_FMT "\n", addr);
92
77
    }
93
78
    return 0;
94
79
}
95
80
 
96
 
static uint32_t sl_readl(void *opaque, target_phys_addr_t addr)
97
 
{
98
 
    struct sl_nand_s *s = (struct sl_nand_s *) opaque;
99
 
    addr -= s->target_base;
100
 
 
101
 
    if (addr == FLASH_FLASHIO)
102
 
        return ecc_digest(&s->ecc, nand_getio(s->nand)) |
103
 
                (ecc_digest(&s->ecc, nand_getio(s->nand)) << 16);
104
 
 
105
 
    return sl_readb(opaque, addr);
106
 
}
107
 
 
108
81
static void sl_writeb(void *opaque, target_phys_addr_t addr,
109
82
                uint32_t value)
110
83
{
132
105
        break;
133
106
 
134
107
    default:
135
 
        zaurus_printf("Bad register offset " REG_FMT "\n", addr);
 
108
        spitz_printf("Bad register offset " REG_FMT "\n", addr);
136
109
    }
137
110
}
138
111
 
139
 
static void sl_save(QEMUFile *f, void *opaque)
140
 
{
141
 
    struct sl_nand_s *s = (struct sl_nand_s *) opaque;
142
 
 
143
 
    qemu_put_8s(f, &s->ctl);
144
 
    ecc_put(f, &s->ecc);
145
 
}
146
 
 
147
 
static int sl_load(QEMUFile *f, void *opaque, int version_id)
148
 
{
149
 
    struct sl_nand_s *s = (struct sl_nand_s *) opaque;
150
 
 
151
 
    qemu_get_8s(f, &s->ctl);
152
 
    ecc_get(f, &s->ecc);
153
 
 
154
 
    return 0;
155
 
}
156
 
 
157
112
enum {
158
113
    FLASH_128M,
159
114
    FLASH_1024M,
166
121
    CPUReadMemoryFunc *sl_readfn[] = {
167
122
        sl_readb,
168
123
        sl_readb,
169
 
        sl_readl,
 
124
        sl_readb,
170
125
    };
171
126
    CPUWriteMemoryFunc *sl_writefn[] = {
172
127
        sl_writeb,
185
140
    iomemtype = cpu_register_io_memory(0, sl_readfn,
186
141
                    sl_writefn, s);
187
142
    cpu_register_physical_memory(s->target_base, 0x40, iomemtype);
188
 
 
189
 
    register_savevm("sl_flash", 0, 0, sl_save, sl_load, s);
190
143
}
191
144
 
192
145
/* Spitz Keyboard */
209
162
    { 0x0f, 0x10, 0x12, 0x14, 0x22, 0x16, 0x24, 0x25,  -1 ,  -1 ,  -1  },
210
163
    { 0x3c, 0x11, 0x1f, 0x21, 0x2f, 0x23, 0x32, 0x26,  -1 , 0x36,  -1  },
211
164
    { 0x3b, 0x1e, 0x20, 0x2e, 0x30, 0x31, 0x34,  -1 , 0x1c, 0x2a,  -1  },
212
 
    { 0x44, 0x2c, 0x2d, 0x0c, 0x39, 0x33,  -1 , 0x48,  -1 ,  -1 , 0x38 },
213
 
    { 0x37, 0x3d,  -1 , 0x45, 0x57, 0x58, 0x4b, 0x50, 0x4d,  -1 ,  -1  },
 
165
    { 0x44, 0x2c, 0x2d, 0x0c, 0x39, 0x33,  -1 , 0x48,  -1 ,  -1 , 0x3d },
 
166
    { 0x37, 0x38,  -1 , 0x45, 0x57, 0x58, 0x4b, 0x50, 0x4d,  -1 ,  -1  },
214
167
    { 0x52, 0x43, 0x01, 0x47, 0x49,  -1 ,  -1 ,  -1 ,  -1 ,  -1 ,  -1  },
215
168
};
216
169
 
228
181
static int spitz_gpio_invert[5] = { 0, 0, 0, 0, 0, };
229
182
 
230
183
struct spitz_keyboard_s {
231
 
    qemu_irq sense[SPITZ_KEY_SENSE_NUM];
232
 
    qemu_irq *strobe;
233
 
    qemu_irq gpiomap[5];
 
184
    struct pxa2xx_state_s *cpu;
234
185
    int keymap[0x80];
235
186
    uint16_t keyrow[SPITZ_KEY_SENSE_NUM];
236
187
    uint16_t strobe_state;
253
204
        if (strobe) {
254
205
            sense |= 1 << i;
255
206
            if (!(s->sense_state & (1 << i)))
256
 
                qemu_irq_raise(s->sense[i]);
 
207
                pxa2xx_gpio_set(s->cpu->gpio, spitz_gpio_key_sense[i], 1);
257
208
        } else if (s->sense_state & (1 << i))
258
 
            qemu_irq_lower(s->sense[i]);
 
209
            pxa2xx_gpio_set(s->cpu->gpio, spitz_gpio_key_sense[i], 0);
259
210
    }
260
211
 
261
212
    s->sense_state = sense;
262
213
}
263
214
 
264
 
static void spitz_keyboard_strobe(void *opaque, int line, int level)
 
215
static void spitz_keyboard_strobe(int line, int level,
 
216
                struct spitz_keyboard_s *s)
265
217
{
266
 
    struct spitz_keyboard_s *s = (struct spitz_keyboard_s *) opaque;
 
218
    int i;
 
219
    for (i = 0; i < SPITZ_KEY_STROBE_NUM; i ++)
 
220
        if (spitz_gpio_key_strobe[i] == line) {
 
221
            if (level)
 
222
                s->strobe_state |= 1 << i;
 
223
            else
 
224
                s->strobe_state &= ~(1 << i);
267
225
 
268
 
    if (level)
269
 
        s->strobe_state |= 1 << line;
270
 
    else
271
 
        s->strobe_state &= ~(1 << line);
272
 
    spitz_keyboard_sense_update(s);
 
226
            spitz_keyboard_sense_update(s);
 
227
            break;
 
228
        }
273
229
}
274
230
 
275
231
static void spitz_keyboard_keydown(struct spitz_keyboard_s *s, int keycode)
280
236
 
281
237
    /* Handle the additional keys */
282
238
    if ((spitz_keycode >> 4) == SPITZ_KEY_SENSE_NUM) {
283
 
        qemu_set_irq(s->gpiomap[spitz_keycode & 0xf], (keycode < 0x80) ^
 
239
        pxa2xx_gpio_set(s->cpu->gpio, spitz_gpiomap[spitz_keycode & 0xf],
 
240
                        (keycode < 0x80) ^
284
241
                        spitz_gpio_invert[spitz_keycode & 0xf]);
285
242
        return;
286
243
    }
426
383
    s->pre_map[0x0d | SHIFT     ] = 0x13 | FN;          /* plus */
427
384
    s->pre_map[0x1a             ] = 0x14 | FN;          /* bracketleft */
428
385
    s->pre_map[0x1b             ] = 0x15 | FN;          /* bracketright */
429
 
    s->pre_map[0x1a | SHIFT     ] = 0x16 | FN;          /* braceleft */
430
 
    s->pre_map[0x1b | SHIFT     ] = 0x17 | FN;          /* braceright */
431
386
    s->pre_map[0x27             ] = 0x22 | FN;          /* semicolon */
432
387
    s->pre_map[0x27 | SHIFT     ] = 0x23 | FN;          /* colon */
433
388
    s->pre_map[0x09 | SHIFT     ] = 0x24 | FN;          /* asterisk */
434
389
    s->pre_map[0x2b             ] = 0x25 | FN;          /* backslash */
435
390
    s->pre_map[0x2b | SHIFT     ] = 0x26 | FN;          /* bar */
436
391
    s->pre_map[0x0c | SHIFT     ] = 0x30 | FN;          /* underscore */
437
 
    s->pre_map[0x33 | SHIFT     ] = 0x33 | FN;          /* less */
438
392
    s->pre_map[0x35             ] = 0x33 | SHIFT;       /* slash */
439
 
    s->pre_map[0x34 | SHIFT     ] = 0x34 | FN;          /* greater */
440
393
    s->pre_map[0x35 | SHIFT     ] = 0x34 | SHIFT;       /* question */
441
394
    s->pre_map[0x49             ] = 0x48 | FN;          /* Page_Up */
442
395
    s->pre_map[0x51             ] = 0x50 | FN;          /* Page_Down */
453
406
#undef CTRL
454
407
#undef FN
455
408
 
456
 
static void spitz_keyboard_save(QEMUFile *f, void *opaque)
457
 
{
458
 
    struct spitz_keyboard_s *s = (struct spitz_keyboard_s *) opaque;
459
 
    int i;
460
 
 
461
 
    qemu_put_be16s(f, &s->sense_state);
462
 
    qemu_put_be16s(f, &s->strobe_state);
463
 
    for (i = 0; i < 5; i ++)
464
 
        qemu_put_byte(f, spitz_gpio_invert[i]);
465
 
}
466
 
 
467
 
static int spitz_keyboard_load(QEMUFile *f, void *opaque, int version_id)
468
 
{
469
 
    struct spitz_keyboard_s *s = (struct spitz_keyboard_s *) opaque;
470
 
    int i;
471
 
 
472
 
    qemu_get_be16s(f, &s->sense_state);
473
 
    qemu_get_be16s(f, &s->strobe_state);
474
 
    for (i = 0; i < 5; i ++)
475
 
        spitz_gpio_invert[i] = qemu_get_byte(f);
476
 
 
477
 
    /* Release all pressed keys */
478
 
    memset(s->keyrow, 0, sizeof(s->keyrow));
479
 
    spitz_keyboard_sense_update(s);
480
 
    s->modifiers = 0;
481
 
    s->imodifiers = 0;
482
 
    s->fifopos = 0;
483
 
    s->fifolen = 0;
484
 
 
485
 
    return 0;
486
 
}
487
 
 
488
409
static void spitz_keyboard_register(struct pxa2xx_state_s *cpu)
489
410
{
490
411
    int i, j;
493
414
    s = (struct spitz_keyboard_s *)
494
415
            qemu_mallocz(sizeof(struct spitz_keyboard_s));
495
416
    memset(s, 0, sizeof(struct spitz_keyboard_s));
 
417
    s->cpu = cpu;
496
418
 
497
419
    for (i = 0; i < 0x80; i ++)
498
420
        s->keymap[i] = -1;
501
423
            if (spitz_keymap[i][j] != -1)
502
424
                s->keymap[spitz_keymap[i][j]] = (i << 4) | j;
503
425
 
504
 
    for (i = 0; i < SPITZ_KEY_SENSE_NUM; i ++)
505
 
        s->sense[i] = pxa2xx_gpio_in_get(cpu->gpio)[spitz_gpio_key_sense[i]];
506
 
 
507
 
    for (i = 0; i < 5; i ++)
508
 
        s->gpiomap[i] = pxa2xx_gpio_in_get(cpu->gpio)[spitz_gpiomap[i]];
509
 
 
510
 
    s->strobe = qemu_allocate_irqs(spitz_keyboard_strobe, s,
511
 
                    SPITZ_KEY_STROBE_NUM);
512
426
    for (i = 0; i < SPITZ_KEY_STROBE_NUM; i ++)
513
 
        pxa2xx_gpio_out_set(cpu->gpio, spitz_gpio_key_strobe[i], s->strobe[i]);
 
427
        pxa2xx_gpio_handler_set(cpu->gpio, spitz_gpio_key_strobe[i],
 
428
                        (gpio_handler_t) spitz_keyboard_strobe, s);
514
429
 
515
430
    spitz_keyboard_pre_map(s);
516
431
    qemu_add_kbd_event_handler((QEMUPutKBDEvent *) spitz_keyboard_handler, s);
517
 
 
518
 
    register_savevm("spitz_keyboard", 0, 0,
519
 
                    spitz_keyboard_save, spitz_keyboard_load, s);
 
432
}
 
433
 
 
434
/* SCOOP devices */
 
435
 
 
436
struct scoop_info_s {
 
437
    target_phys_addr_t target_base;
 
438
    uint16_t status;
 
439
    uint16_t power;
 
440
    uint32_t gpio_level;
 
441
    uint32_t gpio_dir;
 
442
    uint32_t prev_level;
 
443
    struct {
 
444
        gpio_handler_t fn;
 
445
        void *opaque;
 
446
    } handler[16];
 
447
 
 
448
    uint16_t mcr;
 
449
    uint16_t cdr;
 
450
    uint16_t ccr;
 
451
    uint16_t irr;
 
452
    uint16_t imr;
 
453
    uint16_t isr;
 
454
    uint16_t gprr;
 
455
};
 
456
 
 
457
#define SCOOP_MCR       0x00
 
458
#define SCOOP_CDR       0x04
 
459
#define SCOOP_CSR       0x08
 
460
#define SCOOP_CPR       0x0c
 
461
#define SCOOP_CCR       0x10
 
462
#define SCOOP_IRR_IRM   0x14
 
463
#define SCOOP_IMR       0x18
 
464
#define SCOOP_ISR       0x1c
 
465
#define SCOOP_GPCR      0x20
 
466
#define SCOOP_GPWR      0x24
 
467
#define SCOOP_GPRR      0x28
 
468
 
 
469
static inline void scoop_gpio_handler_update(struct scoop_info_s *s) {
 
470
    uint32_t level, diff;
 
471
    int bit;
 
472
    level = s->gpio_level & s->gpio_dir;
 
473
 
 
474
    for (diff = s->prev_level ^ level; diff; diff ^= 1 << bit) {
 
475
        bit = ffs(diff) - 1;
 
476
        if (s->handler[bit].fn)
 
477
            s->handler[bit].fn(bit, (level >> bit) & 1,
 
478
                            s->handler[bit].opaque);
 
479
    }
 
480
 
 
481
    s->prev_level = level;
 
482
}
 
483
 
 
484
static uint32_t scoop_readb(void *opaque, target_phys_addr_t addr)
 
485
{
 
486
    struct scoop_info_s *s = (struct scoop_info_s *) opaque;
 
487
    addr -= s->target_base;
 
488
 
 
489
    switch (addr) {
 
490
    case SCOOP_MCR:
 
491
        return s->mcr;
 
492
    case SCOOP_CDR:
 
493
        return s->cdr;
 
494
    case SCOOP_CSR:
 
495
        return s->status;
 
496
    case SCOOP_CPR:
 
497
        return s->power;
 
498
    case SCOOP_CCR:
 
499
        return s->ccr;
 
500
    case SCOOP_IRR_IRM:
 
501
        return s->irr;
 
502
    case SCOOP_IMR:
 
503
        return s->imr;
 
504
    case SCOOP_ISR:
 
505
        return s->isr;
 
506
    case SCOOP_GPCR:
 
507
        return s->gpio_dir;
 
508
    case SCOOP_GPWR:
 
509
        return s->gpio_level;
 
510
    case SCOOP_GPRR:
 
511
        return s->gprr;
 
512
    default:
 
513
        spitz_printf("Bad register offset " REG_FMT "\n", addr);
 
514
    }
 
515
 
 
516
    return 0;
 
517
}
 
518
 
 
519
static void scoop_writeb(void *opaque, target_phys_addr_t addr, uint32_t value)
 
520
{
 
521
    struct scoop_info_s *s = (struct scoop_info_s *) opaque;
 
522
    addr -= s->target_base;
 
523
    value &= 0xffff;
 
524
 
 
525
    switch (addr) {
 
526
    case SCOOP_MCR:
 
527
        s->mcr = value;
 
528
        break;
 
529
    case SCOOP_CDR:
 
530
        s->cdr = value;
 
531
        break;
 
532
    case SCOOP_CPR:
 
533
        s->power = value;
 
534
        if (value & 0x80)
 
535
            s->power |= 0x8040;
 
536
        break;
 
537
    case SCOOP_CCR:
 
538
        s->ccr = value;
 
539
        break;
 
540
    case SCOOP_IRR_IRM:
 
541
        s->irr = value;
 
542
        break;
 
543
    case SCOOP_IMR:
 
544
        s->imr = value;
 
545
        break;
 
546
    case SCOOP_ISR:
 
547
        s->isr = value;
 
548
        break;
 
549
    case SCOOP_GPCR:
 
550
        s->gpio_dir = value;
 
551
        scoop_gpio_handler_update(s);
 
552
        break;
 
553
    case SCOOP_GPWR:
 
554
        s->gpio_level = value & s->gpio_dir;
 
555
        scoop_gpio_handler_update(s);
 
556
        break;
 
557
    case SCOOP_GPRR:
 
558
        s->gprr = value;
 
559
        break;
 
560
    default:
 
561
        spitz_printf("Bad register offset " REG_FMT "\n", addr);
 
562
    }
 
563
}
 
564
 
 
565
CPUReadMemoryFunc *scoop_readfn[] = {
 
566
    scoop_readb,
 
567
    scoop_readb,
 
568
    scoop_readb,
 
569
};
 
570
CPUWriteMemoryFunc *scoop_writefn[] = {
 
571
    scoop_writeb,
 
572
    scoop_writeb,
 
573
    scoop_writeb,
 
574
};
 
575
 
 
576
static inline void scoop_gpio_set(struct scoop_info_s *s, int line, int level)
 
577
{
 
578
    if (line >= 16) {
 
579
        spitz_printf("No GPIO pin %i\n", line);
 
580
        return;
 
581
    }
 
582
 
 
583
    if (level)
 
584
        s->gpio_level |= (1 << line);
 
585
    else
 
586
        s->gpio_level &= ~(1 << line);
 
587
}
 
588
 
 
589
static inline void scoop_gpio_handler_set(struct scoop_info_s *s, int line,
 
590
                gpio_handler_t handler, void *opaque) {
 
591
    if (line >= 16) {
 
592
        spitz_printf("No GPIO pin %i\n", line);
 
593
        return;
 
594
    }
 
595
 
 
596
    s->handler[line].fn = handler;
 
597
    s->handler[line].opaque = opaque;
 
598
}
 
599
 
 
600
static struct scoop_info_s *spitz_scoop_init(struct pxa2xx_state_s *cpu,
 
601
                int count) {
 
602
    int iomemtype;
 
603
    struct scoop_info_s *s;
 
604
 
 
605
    s = (struct scoop_info_s *)
 
606
            qemu_mallocz(sizeof(struct scoop_info_s) * 2);
 
607
    memset(s, 0, sizeof(struct scoop_info_s) * count);
 
608
    s[0].target_base = 0x10800000;
 
609
    s[1].target_base = 0x08800040;
 
610
 
 
611
    /* Ready */
 
612
    s[0].status = 0x02;
 
613
    s[1].status = 0x02;
 
614
 
 
615
    iomemtype = cpu_register_io_memory(0, scoop_readfn,
 
616
                    scoop_writefn, &s[0]);
 
617
    cpu_register_physical_memory(s[0].target_base, 0xfff, iomemtype);
 
618
 
 
619
    if (count < 2)
 
620
        return s;
 
621
 
 
622
    iomemtype = cpu_register_io_memory(0, scoop_readfn,
 
623
                    scoop_writefn, &s[1]);
 
624
    cpu_register_physical_memory(s[1].target_base, 0xfff, iomemtype);
 
625
 
 
626
    return s;
520
627
}
521
628
 
522
629
/* LCD backlight controller */
535
642
static void spitz_bl_update(struct pxa2xx_state_s *s)
536
643
{
537
644
    if (bl_power && bl_intensity)
538
 
        zaurus_printf("LCD Backlight now at %i/63\n", bl_intensity);
 
645
        spitz_printf("LCD Backlight now at %i/63\n", bl_intensity);
539
646
    else
540
 
        zaurus_printf("LCD Backlight now off\n");
 
647
        spitz_printf("LCD Backlight now off\n");
541
648
}
542
649
 
543
 
static inline void spitz_bl_bit5(void *opaque, int line, int level)
 
650
static void spitz_bl_bit5(int line, int level, void *opaque)
544
651
{
545
652
    int prev = bl_intensity;
546
653
 
553
660
        spitz_bl_update((struct pxa2xx_state_s *) opaque);
554
661
}
555
662
 
556
 
static inline void spitz_bl_power(void *opaque, int line, int level)
 
663
static void spitz_bl_power(int line, int level, void *opaque)
557
664
{
558
665
    bl_power = !!level;
559
666
    spitz_bl_update((struct pxa2xx_state_s *) opaque);
568
675
    switch (addr) {
569
676
    case LCDTG_RESCTL:
570
677
        if (value)
571
 
            zaurus_printf("LCD in QVGA mode\n");
 
678
            spitz_printf("LCD in QVGA mode\n");
572
679
        else
573
 
            zaurus_printf("LCD in VGA mode\n");
 
680
            spitz_printf("LCD in VGA mode\n");
574
681
        break;
575
682
 
576
683
    case LCDTG_DUTYCTRL:
621
728
        max111x_write(max1111, value);
622
729
}
623
730
 
624
 
static void corgi_ssp_gpio_cs(void *opaque, int line, int level)
 
731
static void corgi_ssp_gpio_cs(int line, int level, struct pxa2xx_state_s *s)
625
732
{
626
 
    switch (line) {
627
 
    case 0:
 
733
    if (line == SPITZ_GPIO_LCDCON_CS)
628
734
        lcd_en = !level;
629
 
        break;
630
 
    case 1:
 
735
    else if (line == SPITZ_GPIO_ADS7846_CS)
631
736
        ads_en = !level;
632
 
        break;
633
 
    case 2:
 
737
    else if (line == SPITZ_GPIO_MAX1111_CS)
634
738
        max_en = !level;
635
 
        break;
636
 
    }
637
739
}
638
740
 
639
741
#define MAX1111_BATT_VOLT       1
644
746
#define SPITZ_BATTERY_VOLT      0xd0    /* About 4.0V */
645
747
#define SPITZ_CHARGEON_ACIN     0x80    /* About 5.0V */
646
748
 
647
 
static void spitz_adc_temp_on(void *opaque, int line, int level)
 
749
static void spitz_adc_temp_on(int line, int level, void *opaque)
648
750
{
649
751
    if (!max1111)
650
752
        return;
655
757
        max111x_set_input(max1111, MAX1111_BATT_TEMP, 0);
656
758
}
657
759
 
658
 
static void spitz_ssp_save(QEMUFile *f, void *opaque)
659
 
{
660
 
    qemu_put_be32(f, lcd_en);
661
 
    qemu_put_be32(f, ads_en);
662
 
    qemu_put_be32(f, max_en);
663
 
    qemu_put_be32(f, bl_intensity);
664
 
    qemu_put_be32(f, bl_power);
665
 
}
666
 
 
667
 
static int spitz_ssp_load(QEMUFile *f, void *opaque, int version_id)
668
 
{
669
 
    lcd_en = qemu_get_be32(f);
670
 
    ads_en = qemu_get_be32(f);
671
 
    max_en = qemu_get_be32(f);
672
 
    bl_intensity = qemu_get_be32(f);
673
 
    bl_power = qemu_get_be32(f);
674
 
 
675
 
    return 0;
 
760
static void spitz_pendown_set(void *opaque, int line, int level)
 
761
{
 
762
    struct pxa2xx_state_s *cpu = (struct pxa2xx_state_s *) opaque;
 
763
    pxa2xx_gpio_set(cpu->gpio, SPITZ_GPIO_TP_INT, level);
676
764
}
677
765
 
678
766
static void spitz_ssp_attach(struct pxa2xx_state_s *cpu)
679
767
{
680
 
    qemu_irq *chipselects;
681
 
 
682
768
    lcd_en = ads_en = max_en = 0;
683
769
 
684
 
    ads7846 = ads7846_init(pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_TP_INT]);
 
770
    ads7846 = ads7846_init(qemu_allocate_irqs(spitz_pendown_set, cpu, 1)[0]);
685
771
 
686
772
    max1111 = max1111_init(0);
687
773
    max111x_set_input(max1111, MAX1111_BATT_VOLT, SPITZ_BATTERY_VOLT);
691
777
    pxa2xx_ssp_attach(cpu->ssp[CORGI_SSP_PORT - 1], corgi_ssp_read,
692
778
                    corgi_ssp_write, cpu);
693
779
 
694
 
    chipselects = qemu_allocate_irqs(corgi_ssp_gpio_cs, cpu, 3);
695
 
    pxa2xx_gpio_out_set(cpu->gpio, SPITZ_GPIO_LCDCON_CS,  chipselects[0]);
696
 
    pxa2xx_gpio_out_set(cpu->gpio, SPITZ_GPIO_ADS7846_CS, chipselects[1]);
697
 
    pxa2xx_gpio_out_set(cpu->gpio, SPITZ_GPIO_MAX1111_CS, chipselects[2]);
 
780
    pxa2xx_gpio_handler_set(cpu->gpio, SPITZ_GPIO_LCDCON_CS,
 
781
                    (gpio_handler_t) corgi_ssp_gpio_cs, cpu);
 
782
    pxa2xx_gpio_handler_set(cpu->gpio, SPITZ_GPIO_ADS7846_CS,
 
783
                    (gpio_handler_t) corgi_ssp_gpio_cs, cpu);
 
784
    pxa2xx_gpio_handler_set(cpu->gpio, SPITZ_GPIO_MAX1111_CS,
 
785
                    (gpio_handler_t) corgi_ssp_gpio_cs, cpu);
698
786
 
699
787
    bl_intensity = 0x20;
700
788
    bl_power = 0;
701
 
 
702
 
    register_savevm("spitz_ssp", 0, 0, spitz_ssp_save, spitz_ssp_load, cpu);
703
789
}
704
790
 
705
791
/* CF Microdrive */
707
793
static void spitz_microdrive_attach(struct pxa2xx_state_s *cpu)
708
794
{
709
795
    struct pcmcia_card_s *md;
710
 
    int index;
711
 
    BlockDriverState *bs;
 
796
    BlockDriverState *bs = bs_table[0];
712
797
 
713
 
    index = drive_get_index(IF_IDE, 0, 0);
714
 
    if (index == -1)
715
 
        return;
716
 
    bs = drives_table[index].bdrv;
717
 
    if (bdrv_is_inserted(bs) && !bdrv_is_removable(bs)) {
 
798
    if (bs && bdrv_is_inserted(bs) && !bdrv_is_removable(bs)) {
718
799
        md = dscm1xxxx_init(bs);
719
 
        pxa2xx_pcmcia_attach(cpu->pcmcia[1], md);
 
800
        pxa2xx_pcmcia_attach(cpu->pcmcia[0], md);
720
801
    }
721
802
}
722
803
 
723
 
/* Wm8750 and Max7310 on I2C */
724
 
 
725
 
#define AKITA_MAX_ADDR  0x18
726
 
#define SPITZ_WM_ADDRL  0x1b
727
 
#define SPITZ_WM_ADDRH  0x1a
728
 
 
729
 
#define SPITZ_GPIO_WM   5
730
 
 
731
 
#ifdef HAS_AUDIO
732
 
static void spitz_wm8750_addr(void *opaque, int line, int level)
733
 
{
734
 
    i2c_slave *wm = (i2c_slave *) opaque;
735
 
    if (level)
736
 
        i2c_set_slave_address(wm, SPITZ_WM_ADDRH);
737
 
    else
738
 
        i2c_set_slave_address(wm, SPITZ_WM_ADDRL);
739
 
}
740
 
#endif
741
 
 
742
 
static void spitz_i2c_setup(struct pxa2xx_state_s *cpu)
743
 
{
744
 
    /* Attach the CPU on one end of our I2C bus.  */
745
 
    i2c_bus *bus = pxa2xx_i2c_bus(cpu->i2c[0]);
746
 
 
747
 
#ifdef HAS_AUDIO
748
 
    AudioState *audio;
749
 
    i2c_slave *wm;
750
 
 
751
 
    audio = AUD_init();
752
 
    if (!audio)
753
 
        return;
754
 
    /* Attach a WM8750 to the bus */
755
 
    wm = wm8750_init(bus, audio);
756
 
 
757
 
    spitz_wm8750_addr(wm, 0, 0);
758
 
    pxa2xx_gpio_out_set(cpu->gpio, SPITZ_GPIO_WM,
759
 
                    qemu_allocate_irqs(spitz_wm8750_addr, wm, 1)[0]);
760
 
    /* .. and to the sound interface.  */
761
 
    cpu->i2s->opaque = wm;
762
 
    cpu->i2s->codec_out = wm8750_dac_dat;
763
 
    cpu->i2s->codec_in = wm8750_adc_dat;
764
 
    wm8750_data_req_set(wm, cpu->i2s->data_req, cpu->i2s);
765
 
#endif
766
 
}
767
 
 
768
 
static void spitz_akita_i2c_setup(struct pxa2xx_state_s *cpu)
769
 
{
770
 
    /* Attach a Max7310 to Akita I2C bus.  */
771
 
    i2c_set_slave_address(max7310_init(pxa2xx_i2c_bus(cpu->i2c[0])),
772
 
                    AKITA_MAX_ADDR);
773
 
}
774
 
 
775
804
/* Other peripherals */
776
805
 
777
 
static void spitz_out_switch(void *opaque, int line, int level)
778
 
{
779
 
    switch (line) {
780
 
    case 0:
781
 
        zaurus_printf("Charging %s.\n", level ? "off" : "on");
782
 
        break;
783
 
    case 1:
784
 
        zaurus_printf("Discharging %s.\n", level ? "on" : "off");
785
 
        break;
786
 
    case 2:
787
 
        zaurus_printf("Green LED %s.\n", level ? "on" : "off");
788
 
        break;
789
 
    case 3:
790
 
        zaurus_printf("Orange LED %s.\n", level ? "on" : "off");
791
 
        break;
792
 
    case 4:
793
 
        spitz_bl_bit5(opaque, line, level);
794
 
        break;
795
 
    case 5:
796
 
        spitz_bl_power(opaque, line, level);
797
 
        break;
798
 
    case 6:
799
 
        spitz_adc_temp_on(opaque, line, level);
800
 
        break;
801
 
    }
 
806
static void spitz_charge_switch(int line, int level, void *opaque)
 
807
{
 
808
    spitz_printf("Charging %s.\n", level ? "off" : "on");
 
809
}
 
810
 
 
811
static void spitz_discharge_switch(int line, int level, void *opaque)
 
812
{
 
813
    spitz_printf("Discharging %s.\n", level ? "on" : "off");
 
814
}
 
815
 
 
816
static void spitz_greenled_switch(int line, int level, void *opaque)
 
817
{
 
818
    spitz_printf("Green LED %s.\n", level ? "on" : "off");
 
819
}
 
820
 
 
821
static void spitz_orangeled_switch(int line, int level, void *opaque)
 
822
{
 
823
    spitz_printf("Orange LED %s.\n", level ? "on" : "off");
802
824
}
803
825
 
804
826
#define SPITZ_SCP_LED_GREEN             1
817
839
#define SPITZ_SCP2_MIC_BIAS             9
818
840
 
819
841
static void spitz_scoop_gpio_setup(struct pxa2xx_state_s *cpu,
820
 
                struct scoop_info_s *scp0, struct scoop_info_s *scp1)
 
842
                struct scoop_info_s *scp, int num)
821
843
{
822
 
    qemu_irq *outsignals = qemu_allocate_irqs(spitz_out_switch, cpu, 8);
823
 
 
824
 
    scoop_gpio_out_set(scp0, SPITZ_SCP_CHRG_ON, outsignals[0]);
825
 
    scoop_gpio_out_set(scp0, SPITZ_SCP_JK_B, outsignals[1]);
826
 
    scoop_gpio_out_set(scp0, SPITZ_SCP_LED_GREEN, outsignals[2]);
827
 
    scoop_gpio_out_set(scp0, SPITZ_SCP_LED_ORANGE, outsignals[3]);
828
 
 
829
 
    if (scp1) {
830
 
        scoop_gpio_out_set(scp1, SPITZ_SCP2_BACKLIGHT_CONT, outsignals[4]);
831
 
        scoop_gpio_out_set(scp1, SPITZ_SCP2_BACKLIGHT_ON, outsignals[5]);
 
844
    scoop_gpio_handler_set(&scp[0], SPITZ_SCP_CHRG_ON,
 
845
                    spitz_charge_switch, cpu);
 
846
    scoop_gpio_handler_set(&scp[0], SPITZ_SCP_JK_B,
 
847
                    spitz_discharge_switch, cpu);
 
848
    scoop_gpio_handler_set(&scp[0], SPITZ_SCP_LED_GREEN,
 
849
                    spitz_greenled_switch, cpu);
 
850
    scoop_gpio_handler_set(&scp[0], SPITZ_SCP_LED_ORANGE,
 
851
                    spitz_orangeled_switch, cpu);
 
852
 
 
853
    if (num >= 2) {
 
854
        scoop_gpio_handler_set(&scp[1], SPITZ_SCP2_BACKLIGHT_CONT,
 
855
                        spitz_bl_bit5, cpu);
 
856
        scoop_gpio_handler_set(&scp[1], SPITZ_SCP2_BACKLIGHT_ON,
 
857
                        spitz_bl_power, cpu);
832
858
    }
833
859
 
834
 
    scoop_gpio_out_set(scp0, SPITZ_SCP_ADC_TEMP_ON, outsignals[6]);
 
860
    scoop_gpio_handler_set(&scp[0], SPITZ_SCP_ADC_TEMP_ON,
 
861
                    spitz_adc_temp_on, cpu);
835
862
}
836
863
 
837
864
#define SPITZ_GPIO_HSYNC                22
844
871
#define SPITZ_GPIO_CF2_IRQ              106
845
872
#define SPITZ_GPIO_CF2_CD               93
846
873
 
847
 
static int spitz_hsync;
 
874
int spitz_hsync;
848
875
 
849
 
static void spitz_lcd_hsync_handler(void *opaque, int line, int level)
 
876
static void spitz_lcd_hsync_handler(void *opaque)
850
877
{
851
878
    struct pxa2xx_state_s *cpu = (struct pxa2xx_state_s *) opaque;
852
 
    qemu_set_irq(pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_HSYNC], spitz_hsync);
 
879
    pxa2xx_gpio_set(cpu->gpio, SPITZ_GPIO_HSYNC, spitz_hsync);
853
880
    spitz_hsync ^= 1;
854
881
}
855
882
 
 
883
static void spitz_mmc_coverswitch_change(void *opaque, int in)
 
884
{
 
885
    struct pxa2xx_state_s *cpu = (struct pxa2xx_state_s *) opaque;
 
886
    pxa2xx_gpio_set(cpu->gpio, SPITZ_GPIO_SD_DETECT, in);
 
887
}
 
888
 
 
889
static void spitz_mmc_writeprotect_change(void *opaque, int wp)
 
890
{
 
891
    struct pxa2xx_state_s *cpu = (struct pxa2xx_state_s *) opaque;
 
892
    pxa2xx_gpio_set(cpu->gpio, SPITZ_GPIO_SD_WP, wp);
 
893
}
 
894
 
 
895
static void spitz_pcmcia_cb(void *opaque, int line, int level)
 
896
{
 
897
    struct pxa2xx_state_s *cpu = (struct pxa2xx_state_s *) opaque;
 
898
    static const int gpio_map[] = {
 
899
        SPITZ_GPIO_CF1_IRQ, SPITZ_GPIO_CF1_CD,
 
900
        SPITZ_GPIO_CF2_IRQ, SPITZ_GPIO_CF2_CD,
 
901
    };
 
902
    pxa2xx_gpio_set(cpu->gpio, gpio_map[line], level);
 
903
}
 
904
 
856
905
static void spitz_gpio_setup(struct pxa2xx_state_s *cpu, int slots)
857
906
{
858
 
    qemu_irq lcd_hsync;
 
907
    qemu_irq *pcmcia_cb;
859
908
    /*
860
909
     * Bad hack: We toggle the LCD hsync GPIO on every GPIO status
861
910
     * read to satisfy broken guests that poll-wait for hsync.
863
912
     * wouldn't guarantee that a guest ever exits the loop.
864
913
     */
865
914
    spitz_hsync = 0;
866
 
    lcd_hsync = qemu_allocate_irqs(spitz_lcd_hsync_handler, cpu, 1)[0];
867
 
    pxa2xx_gpio_read_notifier(cpu->gpio, lcd_hsync);
868
 
    pxa2xx_lcd_vsync_notifier(cpu->lcd, lcd_hsync);
 
915
    pxa2xx_gpio_read_notifier(cpu->gpio, spitz_lcd_hsync_handler, cpu);
 
916
    pxa2xx_lcd_vsync_cb(cpu->lcd, spitz_lcd_hsync_handler, cpu);
869
917
 
870
918
    /* MMC/SD host */
871
 
    pxa2xx_mmci_handlers(cpu->mmc,
872
 
                    pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_SD_WP],
873
 
                    pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_SD_DETECT]);
 
919
    pxa2xx_mmci_handlers(cpu->mmc, cpu, spitz_mmc_writeprotect_change,
 
920
                    spitz_mmc_coverswitch_change);
874
921
 
875
922
    /* Battery lock always closed */
876
 
    qemu_irq_raise(pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_BAT_COVER]);
 
923
    pxa2xx_gpio_set(cpu->gpio, SPITZ_GPIO_BAT_COVER, 1);
877
924
 
878
925
    /* Handle reset */
879
 
    pxa2xx_gpio_out_set(cpu->gpio, SPITZ_GPIO_ON_RESET, cpu->reset);
 
926
    pxa2xx_gpio_handler_set(cpu->gpio, SPITZ_GPIO_ON_RESET, pxa2xx_reset, cpu);
880
927
 
881
928
    /* PCMCIA signals: card's IRQ and Card-Detect */
 
929
    pcmcia_cb = qemu_allocate_irqs(spitz_pcmcia_cb, cpu, slots * 2);
882
930
    if (slots >= 1)
883
 
        pxa2xx_pcmcia_set_irq_cb(cpu->pcmcia[0],
884
 
                        pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_CF1_IRQ],
885
 
                        pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_CF1_CD]);
 
931
        pxa2xx_pcmcia_set_irq_cb(cpu->pcmcia[0], pcmcia_cb[0], pcmcia_cb[1]);
886
932
    if (slots >= 2)
887
 
        pxa2xx_pcmcia_set_irq_cb(cpu->pcmcia[1],
888
 
                        pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_CF2_IRQ],
889
 
                        pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_CF2_CD]);
 
933
        pxa2xx_pcmcia_set_irq_cb(cpu->pcmcia[1], pcmcia_cb[2], pcmcia_cb[3]);
890
934
 
891
935
    /* Initialise the screen rotation related signals */
892
936
    spitz_gpio_invert[3] = 0;   /* Always open */
895
939
    } else {                    /* Portrait mode */
896
940
        spitz_gpio_invert[4] = 1;
897
941
    }
898
 
    qemu_set_irq(pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_SWA],
899
 
                    spitz_gpio_invert[3]);
900
 
    qemu_set_irq(pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_SWB],
901
 
                    spitz_gpio_invert[4]);
902
 
}
 
942
    pxa2xx_gpio_set(cpu->gpio, SPITZ_GPIO_SWA, spitz_gpio_invert[3]);
 
943
    pxa2xx_gpio_set(cpu->gpio, SPITZ_GPIO_SWB, spitz_gpio_invert[4]);
 
944
}
 
945
 
 
946
/* Write the bootloader parameters memory area.  */
 
947
 
 
948
#define MAGIC_CHG(a, b, c, d)   ((d << 24) | (c << 16) | (b << 8) | a)
 
949
 
 
950
struct __attribute__ ((__packed__)) sl_param_info {
 
951
    uint32_t comadj_keyword;
 
952
    int32_t comadj;
 
953
 
 
954
    uint32_t uuid_keyword;
 
955
    char uuid[16];
 
956
 
 
957
    uint32_t touch_keyword;
 
958
    int32_t touch_xp;
 
959
    int32_t touch_yp;
 
960
    int32_t touch_xd;
 
961
    int32_t touch_yd;
 
962
 
 
963
    uint32_t adadj_keyword;
 
964
    int32_t adadj;
 
965
 
 
966
    uint32_t phad_keyword;
 
967
    int32_t phadadj;
 
968
} spitz_bootparam = {
 
969
    .comadj_keyword     = MAGIC_CHG('C', 'M', 'A', 'D'),
 
970
    .comadj             = 125,
 
971
    .uuid_keyword       = MAGIC_CHG('U', 'U', 'I', 'D'),
 
972
    .uuid               = { -1 },
 
973
    .touch_keyword      = MAGIC_CHG('T', 'U', 'C', 'H'),
 
974
    .touch_xp           = -1,
 
975
    .adadj_keyword      = MAGIC_CHG('B', 'V', 'A', 'D'),
 
976
    .adadj              = -1,
 
977
    .phad_keyword       = MAGIC_CHG('P', 'H', 'A', 'D'),
 
978
    .phadadj            = 0x01,
 
979
};
 
980
 
 
981
static void sl_bootparam_write(uint32_t ptr)
 
982
{
 
983
    memcpy(phys_ram_base + ptr, &spitz_bootparam,
 
984
                    sizeof(struct sl_param_info));
 
985
}
 
986
 
 
987
#define SL_PXA_PARAM_BASE       0xa0000a00
903
988
 
904
989
/* Board init.  */
905
990
enum spitz_model_e { spitz, akita, borzoi, terrier };
906
991
 
907
 
#define SPITZ_RAM       0x04000000
908
 
#define SPITZ_ROM       0x00800000
909
 
 
910
 
static struct arm_boot_info spitz_binfo = {
911
 
    .loader_start = PXA2XX_SDRAM_BASE,
912
 
    .ram_size = 0x04000000,
913
 
};
914
 
 
915
 
static void spitz_common_init(ram_addr_t ram_size, int vga_ram_size,
 
992
static void spitz_common_init(int ram_size, int vga_ram_size,
916
993
                DisplayState *ds, const char *kernel_filename,
917
994
                const char *kernel_cmdline, const char *initrd_filename,
918
995
                const char *cpu_model, enum spitz_model_e model, int arm_id)
919
996
{
 
997
    uint32_t spitz_ram = 0x04000000;
 
998
    uint32_t spitz_rom = 0x00800000;
920
999
    struct pxa2xx_state_s *cpu;
921
 
    struct scoop_info_s *scp0, *scp1 = NULL;
 
1000
    struct scoop_info_s *scp;
922
1001
 
923
1002
    if (!cpu_model)
924
1003
        cpu_model = (model == terrier) ? "pxa270-c5" : "pxa270-c0";
 
1004
    cpu = pxa270_init(ds, cpu_model);
925
1005
 
926
 
    /* Setup CPU & memory */
927
 
    if (ram_size < SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE) {
 
1006
    /* Setup memory */
 
1007
    if (ram_size < spitz_ram + spitz_rom) {
928
1008
        fprintf(stderr, "This platform requires %i bytes of memory\n",
929
 
                        SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE);
 
1009
                        spitz_ram + spitz_rom);
930
1010
        exit(1);
931
1011
    }
932
 
    cpu = pxa270_init(spitz_binfo.ram_size, ds, cpu_model);
 
1012
    cpu_register_physical_memory(PXA2XX_RAM_BASE, spitz_ram, IO_MEM_RAM);
933
1013
 
934
1014
    sl_flash_register(cpu, (model == spitz) ? FLASH_128M : FLASH_1024M);
935
1015
 
936
 
    cpu_register_physical_memory(0, SPITZ_ROM,
937
 
                    qemu_ram_alloc(SPITZ_ROM) | IO_MEM_ROM);
 
1016
    cpu_register_physical_memory(0, spitz_rom, spitz_ram | IO_MEM_ROM);
938
1017
 
939
1018
    /* Setup peripherals */
940
1019
    spitz_keyboard_register(cpu);
941
1020
 
942
1021
    spitz_ssp_attach(cpu);
943
1022
 
944
 
    scp0 = scoop_init(cpu, 0, 0x10800000);
945
 
    if (model != akita) {
946
 
            scp1 = scoop_init(cpu, 1, 0x08800040);
947
 
    }
 
1023
    scp = spitz_scoop_init(cpu, (model == akita) ? 1 : 2);
948
1024
 
949
 
    spitz_scoop_gpio_setup(cpu, scp0, scp1);
 
1025
    spitz_scoop_gpio_setup(cpu, scp, (model == akita) ? 1 : 2);
950
1026
 
951
1027
    spitz_gpio_setup(cpu, (model == akita) ? 1 : 2);
952
1028
 
953
 
    spitz_i2c_setup(cpu);
954
 
 
955
 
    if (model == akita)
956
 
        spitz_akita_i2c_setup(cpu);
957
 
 
958
1029
    if (model == terrier)
959
 
        /* A 6.0 GB microdrive is permanently sitting in CF slot 1.  */
 
1030
        /* A 6.0 GB microdrive is permanently sitting in CF slot 0.  */
960
1031
        spitz_microdrive_attach(cpu);
961
1032
    else if (model != akita)
962
 
        /* A 4.0 GB microdrive is permanently sitting in CF slot 1.  */
 
1033
        /* A 4.0 GB microdrive is permanently sitting in CF slot 0.  */
963
1034
        spitz_microdrive_attach(cpu);
964
1035
 
965
1036
    /* Setup initial (reset) machine state */
966
 
    cpu->env->regs[15] = spitz_binfo.loader_start;
 
1037
    cpu->env->regs[15] = PXA2XX_RAM_BASE;
967
1038
 
968
 
    spitz_binfo.kernel_filename = kernel_filename;
969
 
    spitz_binfo.kernel_cmdline = kernel_cmdline;
970
 
    spitz_binfo.initrd_filename = initrd_filename;
971
 
    spitz_binfo.board_id = arm_id;
972
 
    arm_load_kernel(cpu->env, &spitz_binfo);
973
 
    sl_bootparam_write(SL_PXA_PARAM_BASE - PXA2XX_SDRAM_BASE);
 
1039
    arm_load_kernel(cpu->env, ram_size, kernel_filename, kernel_cmdline,
 
1040
                    initrd_filename, arm_id, PXA2XX_RAM_BASE);
 
1041
    sl_bootparam_write(SL_PXA_PARAM_BASE - PXA2XX_RAM_BASE);
974
1042
}
975
1043
 
976
 
static void spitz_init(ram_addr_t ram_size, int vga_ram_size,
977
 
                const char *boot_device, DisplayState *ds,
 
1044
static void spitz_init(int ram_size, int vga_ram_size, int boot_device,
 
1045
                DisplayState *ds, const char **fd_filename, int snapshot,
978
1046
                const char *kernel_filename, const char *kernel_cmdline,
979
1047
                const char *initrd_filename, const char *cpu_model)
980
1048
{
982
1050
                kernel_cmdline, initrd_filename, cpu_model, spitz, 0x2c9);
983
1051
}
984
1052
 
985
 
static void borzoi_init(ram_addr_t ram_size, int vga_ram_size,
986
 
                const char *boot_device, DisplayState *ds,
 
1053
static void borzoi_init(int ram_size, int vga_ram_size, int boot_device,
 
1054
                DisplayState *ds, const char **fd_filename, int snapshot,
987
1055
                const char *kernel_filename, const char *kernel_cmdline,
988
1056
                const char *initrd_filename, const char *cpu_model)
989
1057
{
991
1059
                kernel_cmdline, initrd_filename, cpu_model, borzoi, 0x33f);
992
1060
}
993
1061
 
994
 
static void akita_init(ram_addr_t ram_size, int vga_ram_size,
995
 
                const char *boot_device, DisplayState *ds,
 
1062
static void akita_init(int ram_size, int vga_ram_size, int boot_device,
 
1063
                DisplayState *ds, const char **fd_filename, int snapshot,
996
1064
                const char *kernel_filename, const char *kernel_cmdline,
997
1065
                const char *initrd_filename, const char *cpu_model)
998
1066
{
1000
1068
                kernel_cmdline, initrd_filename, cpu_model, akita, 0x2e8);
1001
1069
}
1002
1070
 
1003
 
static void terrier_init(ram_addr_t ram_size, int vga_ram_size,
1004
 
                const char *boot_device, DisplayState *ds,
 
1071
static void terrier_init(int ram_size, int vga_ram_size, int boot_device,
 
1072
                DisplayState *ds, const char **fd_filename, int snapshot,
1005
1073
                const char *kernel_filename, const char *kernel_cmdline,
1006
1074
                const char *initrd_filename, const char *cpu_model)
1007
1075
{
1010
1078
}
1011
1079
 
1012
1080
QEMUMachine akitapda_machine = {
1013
 
    .name = "akita",
1014
 
    .desc = "Akita PDA (PXA270)",
1015
 
    .init = akita_init,
1016
 
    .ram_require = SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED,
 
1081
    "akita",
 
1082
    "Akita PDA (PXA270)",
 
1083
    akita_init,
1017
1084
};
1018
1085
 
1019
1086
QEMUMachine spitzpda_machine = {
1020
 
    .name = "spitz",
1021
 
    .desc = "Spitz PDA (PXA270)",
1022
 
    .init = spitz_init,
1023
 
    .ram_require = SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED,
 
1087
    "spitz",
 
1088
    "Spitz PDA (PXA270)",
 
1089
    spitz_init,
1024
1090
};
1025
1091
 
1026
1092
QEMUMachine borzoipda_machine = {
1027
 
    .name = "borzoi",
1028
 
    .desc = "Borzoi PDA (PXA270)",
1029
 
    .init = borzoi_init,
1030
 
    .ram_require = SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED,
 
1093
    "borzoi",
 
1094
    "Borzoi PDA (PXA270)",
 
1095
    borzoi_init,
1031
1096
};
1032
1097
 
1033
1098
QEMUMachine terrierpda_machine = {
1034
 
    .name = "terrier",
1035
 
    .desc = "Terrier PDA (PXA270)",
1036
 
    .init = terrier_init,
1037
 
    .ram_require = SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED,
 
1099
    "terrier",
 
1100
    "Terrier PDA (PXA270)",
 
1101
    terrier_init,
1038
1102
};