machine_hpcarm.cc Source File

Back to the index.

machine_hpcarm.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2009 Anders Gavare. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. The name of the author may not be used to endorse or promote products
13  * derived from this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  *
28  * COMMENT: Handheld ARM-based machines
29  */
30 
31 #include <stdio.h>
32 #include <stdlib.h>
33 #include <string.h>
34 
35 #include "cpu.h"
36 #include "device.h"
37 #include "devices.h"
38 #include "machine.h"
39 #include "memory.h"
40 #include "misc.h"
41 
43 #include "thirdparty/vripreg.h"
44 
45 
47 {
49  int hpc_platid_flags = 0, hpc_platid_cpu_submodel = 0,
50  hpc_platid_cpu_model = 0, hpc_platid_cpu_series = 0,
51  hpc_platid_cpu_arch = 0,
52  hpc_platid_submodel = 0, hpc_platid_model = 0,
53  hpc_platid_series = 0, hpc_platid_vendor = 0;
54  uint64_t hpc_fb_addr = 0;
55  int hpc_fb_bits = 0, hpc_fb_encoding = 0;
56  int hpc_fb_xsize = 0;
57  int hpc_fb_ysize = 0;
58  int hpc_fb_xsize_mem = 0;
59  int hpc_fb_ysize_mem = 0;
60 
61  memset(&hpc_bootinfo, 0, sizeof(hpc_bootinfo));
62 
64 
65  switch (machine->machine_subtype) {
66 
68  /* SA-1110 206MHz */
69  machine->machine_name = strdup("Compaq iPAQ H3600");
70  hpc_fb_addr = 0x48200000; /* TODO */
71  hpc_fb_xsize = 240;
72  hpc_fb_ysize = 320;
73  hpc_fb_xsize_mem = 256;
74  hpc_fb_ysize_mem = 320;
75  hpc_fb_bits = 15;
76  hpc_fb_encoding = BIFB_D16_0000;
77  hpc_platid_cpu_arch = 3; /* ARM */
78  hpc_platid_cpu_series = 1; /* StrongARM */
79  hpc_platid_cpu_model = 2; /* SA-1110 */
80  hpc_platid_cpu_submodel = 0;
81  hpc_platid_vendor = 7; /* Compaq */
82  hpc_platid_series = 4; /* IPAQ */
83  hpc_platid_model = 2; /* H36xx */
84  hpc_platid_submodel = 1; /* H3600 */
85  break;
86 
89  /* SA-1110 206MHz */
92  "Jornada 720" : "Jornada 728");
93  hpc_fb_addr = 0x48200000;
94  hpc_fb_xsize = 640;
95  hpc_fb_ysize = 240;
96  hpc_fb_xsize_mem = 640;
97  hpc_fb_ysize_mem = 240;
98  hpc_fb_bits = 16;
99  hpc_fb_encoding = BIFB_D16_0000;
100  hpc_platid_cpu_arch = 3; /* ARM */
101  hpc_platid_cpu_series = 1; /* StrongARM */
102  hpc_platid_cpu_model = 2; /* SA-1110 */
103  hpc_platid_cpu_submodel = 0;
104  hpc_platid_vendor = 11; /* HP */
105  hpc_platid_series = 2; /* Jornada */
106  hpc_platid_model = 2; /* 7xx */
107  hpc_platid_submodel = 1; /* 720 */
108  break;
109 
110  default:printf("Unimplemented hpcarm machine number.\n");
111  exit(1);
112  }
113 
115  (hpc_platid_cpu_arch << 26) + (hpc_platid_cpu_series << 20)
116  + (hpc_platid_cpu_model << 14) + (hpc_platid_cpu_submodel << 8)
117  + hpc_platid_flags);
118  store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.
119  platid_machine,(hpc_platid_vendor << 22) + (hpc_platid_series << 16)
120  + (hpc_platid_model << 8) + hpc_platid_submodel);
121 
122  /* Physical RAM at 0xc0000000: */
123  dev_ram_init(machine, 0xc0000000, 0x20000000,
124  DEV_RAM_MIRROR, 0x0);
125 
126  /* Cache flush region: */
127  dev_ram_init(machine, 0xe0000000, 0x10000, DEV_RAM_RAM, 0x0);
128 
129  if (hpc_fb_addr != 0) {
130  dev_fb_init(machine, machine->memory, hpc_fb_addr, VFB_HPC,
131  hpc_fb_xsize, hpc_fb_ysize,
132  hpc_fb_xsize_mem, hpc_fb_ysize_mem,
133  hpc_fb_bits, machine->machine_name);
134  }
135 
136  if (!machine->prom_emulation)
137  return;
138 
139 
140  /* NetBSD/hpcarm and possibly others expects the following: */
141 
142  cpu->cd.arm.r[0] = 1; /* argc */
143  cpu->cd.arm.r[1] = machine->physical_ram_in_mb * 1048576 - 512; /*argv*/
144  cpu->cd.arm.r[2] = machine->physical_ram_in_mb * 1048576 - 256;
145  /* r[2] = ptr to hpc_bootinfo */
146 
149  machine->physical_ram_in_mb * 1048576 - 512 + 16);
150  store_32bit_word(cpu, machine->physical_ram_in_mb * 1048576 - 512 +4,0);
151  store_string(cpu, machine->physical_ram_in_mb * 1048576 - 512 + 16,
152  machine->bootstr);
153 
154  if (machine->boot_string_argument[0]) {
155  cpu->cd.arm.r[0] ++; /* argc */
156 
158  512 + 4, machine->physical_ram_in_mb * 1048576 - 512 + 64);
160  512 + 8, 0);
161 
162  store_string(cpu, machine->physical_ram_in_mb * 1048576 - 512
164 
166  }
167 
168  store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.length,
169  sizeof(hpc_bootinfo));
170  store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.magic,
173  hpc_fb_addr);
174  store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.
175  fb_line_bytes, hpc_fb_xsize_mem * (((hpc_fb_bits-1)|7)+1) / 8);
177  hpc_fb_xsize);
179  hpc_fb_ysize);
181  hpc_fb_encoding);
184 
185  store_32bit_word_in_host(cpu,(unsigned char *)&hpc_bootinfo.timezone,0);
186  store_buf(cpu, machine->physical_ram_in_mb * 1048576 - 256,
187  (char *)&hpc_bootinfo, sizeof(hpc_bootinfo));
188 
189  /* TODO: What is a good default stack pointer? */
190  /* I.e. what does hpcboot.exe for NetBSD/hpcarm usually use? */
191  cpu->cd.arm.r[ARM_SP] = 0xc02dfff0;
192 }
193 
194 
196 {
197  machine->cpu_name = strdup("SA1110");
198 }
199 
200 
202 {
203  switch (machine->machine_subtype) {
205  /* 720 has 32 MB, 728 has 64 MB. */
207  break;
208  default:
209  /* Most have 32 MB by default. */
211  }
212 }
213 
214 
216 {
217  MR_DEFAULT(hpcarm, "Handhelp ARM (HPCarm)", ARCH_ARM, MACHINE_HPCARM);
218 
219  machine_entry_add_alias(me, "hpcarm");
220 
222  "ipaq", NULL);
223 
225  "jornada720", NULL);
226 
228  "jornada728", NULL);
229 
230  me->set_default_ram = machine_default_ram_hpcarm;
231 }
232 
machine::machine_subtype
int machine_subtype
Definition: machine.h:112
hpc_bootinfo.h
machine::bootarg
char * bootarg
Definition: machine.h:156
store_buf
void store_buf(struct cpu *cpu, uint64_t addr, const char *s, size_t len)
Definition: memory.cc:826
MACHINE_REGISTER
MACHINE_REGISTER(hpcarm)
Definition: machine_hpcarm.cc:215
hpc_bootinfo
Definition: hpc_bootinfo.h:41
machine::physical_ram_in_mb
int physical_ram_in_mb
Definition: machine.h:147
DEV_RAM_MIRROR
#define DEV_RAM_MIRROR
Definition: devices.h:365
hpc_bootinfo::fb_type
int16_t fb_type
Definition: hpc_bootinfo.h:49
MACHINE_DEFAULT_RAM
MACHINE_DEFAULT_RAM(hpcarm)
Definition: machine_hpcarm.cc:201
cpu::byte_order
uint8_t byte_order
Definition: cpu.h:347
machine::prom_emulation
int prom_emulation
Definition: machine.h:149
DEV_RAM_RAM
#define DEV_RAM_RAM
Definition: devices.h:364
BI_CNUSE_BUILTIN
#define BI_CNUSE_BUILTIN
Definition: hpc_bootinfo.h:58
device.h
machine::boot_string_argument
char * boot_string_argument
Definition: machine.h:171
MACHINE_HPCARM
#define MACHINE_HPCARM
Definition: machine.h:241
MACHINE_HPCARM_JORNADA720
#define MACHINE_HPCARM_JORNADA720
Definition: machine.h:294
hpc_bootinfo::platid_machine
uint32_t platid_machine
Definition: hpc_bootinfo.h:53
machine::cpu_name
char * cpu_name
Definition: machine.h:133
machine_entry_add_subtype
void machine_entry_add_subtype(struct machine_entry *me, const char *name, int oldstyle_subtype,...)
Definition: machine.cc:717
x11_md::in_use
int in_use
Definition: machine.h:82
BIFB_D16_0000
#define BIFB_D16_0000
Definition: hpc_bootinfo.h:79
misc.h
hpc_bootinfo::platid_cpu
uint32_t platid_cpu
Definition: hpc_bootinfo.h:52
cpu::cd
union cpu::@1 cd
MACHINE_SETUP
MACHINE_SETUP(hpcarm)
Definition: machine_hpcarm.cc:46
machine.h
machine
Definition: machine.h:97
vripreg.h
MR_DEFAULT
#define MR_DEFAULT(x, name, arch, type)
Definition: machine.h:370
arm_cpu::r
uint32_t r[N_ARM_REGS]
Definition: cpu_arm.h:155
hpc_bootinfo::magic
int32_t magic
Definition: hpc_bootinfo.h:44
store_string
void store_string(struct cpu *cpu, uint64_t addr, const char *s)
Definition: memory.cc:695
store_16bit_word_in_host
void store_16bit_word_in_host(struct cpu *cpu, unsigned char *data, uint16_t data16)
Definition: memory.cc:992
machine::x11_md
struct x11_md x11_md
Definition: machine.h:179
HPC_BOOTINFO_MAGIC
#define HPC_BOOTINFO_MAGIC
Definition: hpc_bootinfo.h:62
cpu.h
MACHINE_HPCARM_IPAQ
#define MACHINE_HPCARM_IPAQ
Definition: machine.h:293
MACHINE_DEFAULT_CPU
MACHINE_DEFAULT_CPU(hpcarm)
Definition: machine_hpcarm.cc:195
machine::memory
struct memory * memory
Definition: machine.h:126
EMUL_LITTLE_ENDIAN
#define EMUL_LITTLE_ENDIAN
Definition: misc.h:164
machine::boot_kernel_filename
char * boot_kernel_filename
Definition: machine.h:170
hpc_bootinfo::bi_cnuse
int16_t bi_cnuse
Definition: hpc_bootinfo.h:51
hpc_bootinfo::fb_line_bytes
int16_t fb_line_bytes
Definition: hpc_bootinfo.h:46
cpu::arm
struct arm_cpu arm
Definition: cpu.h:441
hpc_bootinfo::length
int16_t length
Definition: hpc_bootinfo.h:42
store_32bit_word
int store_32bit_word(struct cpu *cpu, uint64_t addr, uint64_t data32)
Definition: memory.cc:783
hpc_bootinfo::fb_height
int16_t fb_height
Definition: hpc_bootinfo.h:48
store_32bit_word_in_host
void store_32bit_word_in_host(struct cpu *cpu, unsigned char *data, uint64_t data32)
Definition: memory.cc:973
ARCH_ARM
#define ARCH_ARM
Definition: machine.h:206
hpc_bootinfo::fb_width
int16_t fb_width
Definition: hpc_bootinfo.h:47
machine::bootstr
char * bootstr
Definition: machine.h:155
VFB_HPC
#define VFB_HPC
Definition: devices.h:191
BI_CNUSE_SERIAL
#define BI_CNUSE_SERIAL
Definition: hpc_bootinfo.h:59
devices.h
machine::machine_name
const char * machine_name
Definition: machine.h:115
cpu
Definition: cpu.h:326
hpc_bootinfo::timezone
int32_t timezone
Definition: hpc_bootinfo.h:55
hpc_bootinfo::fb_addr
uint32_t fb_addr
Definition: hpc_bootinfo.h:45
machine_entry_add_alias
void machine_entry_add_alias(struct machine_entry *me, const char *name)
Definition: machine.cc:697
ARM_SP
#define ARM_SP
Definition: cpu_arm.h:54
dev_ram_init
void dev_ram_init(struct machine *machine, uint64_t baseaddr, uint64_t length, int mode, uint64_t otheraddress, const char *name)
Definition: dev_ram.cc:134
memory.h
dev_fb_init
struct vfb_data * dev_fb_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int vfb_type, int visible_xsize, int visible_ysize, int xsize, int ysize, int bit_depth, const char *name)
Definition: dev_fb.cc:834
MACHINE_HPCARM_JORNADA728
#define MACHINE_HPCARM_JORNADA728
Definition: machine.h:295

Generated on Tue Mar 24 2020 14:04:48 for GXemul by doxygen 1.8.17