root / hw / palm.c @ fe71e81a
History | View | Annotate | Download (4.7 kB)
1 | c3d2689d | balrog | /*
|
---|---|---|---|
2 | c3d2689d | balrog | * PalmOne's (TM) PDAs.
|
3 | c3d2689d | balrog | *
|
4 | c3d2689d | balrog | * Copyright (C) 2006-2007 Andrzej Zaborowski <balrog@zabor.org>
|
5 | c3d2689d | balrog | *
|
6 | c3d2689d | balrog | * This program is free software; you can redistribute it and/or
|
7 | c3d2689d | balrog | * modify it under the terms of the GNU General Public License as
|
8 | c3d2689d | balrog | * published by the Free Software Foundation; either version 2 of
|
9 | c3d2689d | balrog | * the License, or (at your option) any later version.
|
10 | c3d2689d | balrog | *
|
11 | c3d2689d | balrog | * This program is distributed in the hope that it will be useful,
|
12 | c3d2689d | balrog | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | c3d2689d | balrog | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 | c3d2689d | balrog | * GNU General Public License for more details.
|
15 | c3d2689d | balrog | *
|
16 | c3d2689d | balrog | * You should have received a copy of the GNU General Public License
|
17 | c3d2689d | balrog | * along with this program; if not, write to the Free Software
|
18 | c3d2689d | balrog | * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
19 | c3d2689d | balrog | * MA 02111-1307 USA
|
20 | c3d2689d | balrog | */
|
21 | c3d2689d | balrog | #include "vl.h" |
22 | c3d2689d | balrog | |
23 | c3d2689d | balrog | static uint32_t static_readb(void *opaque, target_phys_addr_t offset) |
24 | c3d2689d | balrog | { |
25 | c3d2689d | balrog | uint32_t *val = (uint32_t *) opaque; |
26 | c3d2689d | balrog | return *val >> ((offset & 3) << 3); |
27 | c3d2689d | balrog | } |
28 | c3d2689d | balrog | |
29 | c3d2689d | balrog | static uint32_t static_readh(void *opaque, target_phys_addr_t offset) { |
30 | c3d2689d | balrog | uint32_t *val = (uint32_t *) opaque; |
31 | c3d2689d | balrog | return *val >> ((offset & 1) << 3); |
32 | c3d2689d | balrog | } |
33 | c3d2689d | balrog | |
34 | c3d2689d | balrog | static uint32_t static_readw(void *opaque, target_phys_addr_t offset) { |
35 | c3d2689d | balrog | uint32_t *val = (uint32_t *) opaque; |
36 | c3d2689d | balrog | return *val >> ((offset & 0) << 3); |
37 | c3d2689d | balrog | } |
38 | c3d2689d | balrog | |
39 | c3d2689d | balrog | static void static_write(void *opaque, target_phys_addr_t offset, |
40 | c3d2689d | balrog | uint32_t value) { |
41 | c3d2689d | balrog | #ifdef SPY
|
42 | c3d2689d | balrog | printf("%s: value %08lx written at " PA_FMT "\n", |
43 | c3d2689d | balrog | __FUNCTION__, value, offset); |
44 | c3d2689d | balrog | #endif
|
45 | c3d2689d | balrog | } |
46 | c3d2689d | balrog | |
47 | c3d2689d | balrog | static CPUReadMemoryFunc *static_readfn[] = {
|
48 | c3d2689d | balrog | static_readb, |
49 | c3d2689d | balrog | static_readh, |
50 | c3d2689d | balrog | static_readw, |
51 | c3d2689d | balrog | }; |
52 | c3d2689d | balrog | |
53 | c3d2689d | balrog | static CPUWriteMemoryFunc *static_writefn[] = {
|
54 | c3d2689d | balrog | static_write, |
55 | c3d2689d | balrog | static_write, |
56 | c3d2689d | balrog | static_write, |
57 | c3d2689d | balrog | }; |
58 | c3d2689d | balrog | |
59 | c3d2689d | balrog | /* Palm Tunsgten|E support */
|
60 | c3d2689d | balrog | static void palmte_microwire_setup(struct omap_mpu_state_s *cpu) |
61 | c3d2689d | balrog | { |
62 | c3d2689d | balrog | } |
63 | c3d2689d | balrog | |
64 | c3d2689d | balrog | static void palmte_init(int ram_size, int vga_ram_size, int boot_device, |
65 | c3d2689d | balrog | DisplayState *ds, const char **fd_filename, int snapshot, |
66 | c3d2689d | balrog | const char *kernel_filename, const char *kernel_cmdline, |
67 | c3d2689d | balrog | const char *initrd_filename, const char *cpu_model) |
68 | c3d2689d | balrog | { |
69 | c3d2689d | balrog | struct omap_mpu_state_s *cpu;
|
70 | c3d2689d | balrog | int flash_size = 0x00800000; |
71 | c3d2689d | balrog | int sdram_size = 0x02000000; |
72 | c3d2689d | balrog | int io;
|
73 | c3d2689d | balrog | static uint32_t cs0val = 0xffffffff; |
74 | c3d2689d | balrog | static uint32_t cs1val = 0x0000e1a0; |
75 | c3d2689d | balrog | static uint32_t cs2val = 0x0000e1a0; |
76 | c3d2689d | balrog | static uint32_t cs3val = 0xe1a0e1a0; |
77 | c3d2689d | balrog | ram_addr_t phys_flash; |
78 | c3d2689d | balrog | int rom_size, rom_loaded = 0; |
79 | c3d2689d | balrog | |
80 | c3d2689d | balrog | if (ram_size < flash_size + sdram_size + OMAP15XX_SRAM_SIZE) {
|
81 | c3d2689d | balrog | fprintf(stderr, "This architecture uses %i bytes of memory\n",
|
82 | c3d2689d | balrog | flash_size + sdram_size + OMAP15XX_SRAM_SIZE); |
83 | c3d2689d | balrog | exit(1);
|
84 | c3d2689d | balrog | } |
85 | c3d2689d | balrog | |
86 | c3d2689d | balrog | cpu = omap310_mpu_init(sdram_size, ds, cpu_model); |
87 | c3d2689d | balrog | |
88 | c3d2689d | balrog | /* External Flash (EMIFS) */
|
89 | c3d2689d | balrog | cpu_register_physical_memory(OMAP_CS0_BASE, flash_size, |
90 | c3d2689d | balrog | (phys_flash = qemu_ram_alloc(flash_size)) | IO_MEM_ROM); |
91 | c3d2689d | balrog | |
92 | c3d2689d | balrog | io = cpu_register_io_memory(0, static_readfn, static_writefn, &cs0val);
|
93 | c3d2689d | balrog | cpu_register_physical_memory(OMAP_CS0_BASE + flash_size, |
94 | c3d2689d | balrog | OMAP_CS0_SIZE - flash_size, io); |
95 | c3d2689d | balrog | io = cpu_register_io_memory(0, static_readfn, static_writefn, &cs1val);
|
96 | c3d2689d | balrog | cpu_register_physical_memory(OMAP_CS1_BASE, OMAP_CS1_SIZE, io); |
97 | c3d2689d | balrog | io = cpu_register_io_memory(0, static_readfn, static_writefn, &cs2val);
|
98 | c3d2689d | balrog | cpu_register_physical_memory(OMAP_CS2_BASE, OMAP_CS2_SIZE, io); |
99 | c3d2689d | balrog | io = cpu_register_io_memory(0, static_readfn, static_writefn, &cs3val);
|
100 | c3d2689d | balrog | cpu_register_physical_memory(OMAP_CS3_BASE, OMAP_CS3_SIZE, io); |
101 | c3d2689d | balrog | |
102 | c3d2689d | balrog | palmte_microwire_setup(cpu); |
103 | c3d2689d | balrog | |
104 | c3d2689d | balrog | /* Setup initial (reset) machine state */
|
105 | c3d2689d | balrog | if (nb_option_roms) {
|
106 | c3d2689d | balrog | rom_size = get_image_size(option_rom[0]);
|
107 | c3d2689d | balrog | if (rom_size > flash_size)
|
108 | c3d2689d | balrog | fprintf(stderr, "%s: ROM image too big (%x > %x)\n",
|
109 | c3d2689d | balrog | __FUNCTION__, rom_size, flash_size); |
110 | c3d2689d | balrog | else if (rom_size > 0 && load_image(option_rom[0], |
111 | c3d2689d | balrog | phys_ram_base + phys_flash) > 0) {
|
112 | c3d2689d | balrog | rom_loaded = 1;
|
113 | c3d2689d | balrog | cpu->env->regs[15] = 0x00000000; |
114 | c3d2689d | balrog | } else
|
115 | c3d2689d | balrog | fprintf(stderr, "%s: error loading '%s'\n",
|
116 | c3d2689d | balrog | __FUNCTION__, option_rom[0]);
|
117 | c3d2689d | balrog | } |
118 | c3d2689d | balrog | |
119 | c3d2689d | balrog | if (!rom_loaded && !kernel_filename) {
|
120 | c3d2689d | balrog | fprintf(stderr, "Kernel or ROM image must be specified\n");
|
121 | c3d2689d | balrog | exit(1);
|
122 | c3d2689d | balrog | } |
123 | c3d2689d | balrog | |
124 | c3d2689d | balrog | /* Load the kernel. */
|
125 | c3d2689d | balrog | if (kernel_filename) {
|
126 | c3d2689d | balrog | /* Start at bootloader. */
|
127 | c3d2689d | balrog | cpu->env->regs[15] = OMAP_EMIFF_BASE;
|
128 | c3d2689d | balrog | |
129 | c3d2689d | balrog | arm_load_kernel(cpu->env, sdram_size, kernel_filename, kernel_cmdline, |
130 | c3d2689d | balrog | initrd_filename, 0x331, OMAP_EMIFF_BASE);
|
131 | c3d2689d | balrog | } |
132 | c3d2689d | balrog | |
133 | c3d2689d | balrog | dpy_resize(ds, 320, 320); |
134 | c3d2689d | balrog | } |
135 | c3d2689d | balrog | |
136 | c3d2689d | balrog | QEMUMachine palmte_machine = { |
137 | c3d2689d | balrog | "cheetah",
|
138 | c3d2689d | balrog | "Palm Tungsten|E aka. Cheetah PDA (OMAP310)",
|
139 | c3d2689d | balrog | palmte_init, |
140 | c3d2689d | balrog | }; |