machine_iyonix.cc Source File

Back to the index.

machine_iyonix.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: A Iyonix machine
29  *
30  * According to NetBSD/iyonix, for Tungsten motherboards:
31  *
32  * 0x90000000 (1 MB) obio
33  * 0x900002f8 = uart1
34  * 0xa0000000 (8 MB) Flash memory
35  * 0xfe400000 iopxs vbase
36  *
37  * A dmesg can be found at the end of the following URL:
38  * http://www.sarasarado.org/~hatano/diary/d200411.html
39  */
40 
41 #include <stdio.h>
42 #include <string.h>
43 
44 #include "bus_isa.h"
45 #include "cpu.h"
46 #include "device.h"
47 #include "devices.h"
48 #include "machine.h"
49 #include "memory.h"
50 #include "misc.h"
51 
53 #include "thirdparty/i80321reg.h"
54 
55 
57 {
58  char tmpstr[1000];
59  uint32_t bootblock_addr;
60  struct bootconfig bootconfigData;
61 
62  machine->machine_name = strdup("Iyonix");
63 
65 
66  /* TODO: Is it flash, or just RAM? */
67  dev_ram_init(machine, 0xa0000000,
68  machine->physical_ram_in_mb * 1048576, DEV_RAM_MIRROR, 0x0);
69 
70  /* Uncached RAM? */
71  dev_ram_init(machine, 0xc0000000,
72  machine->physical_ram_in_mb * 1048576, DEV_RAM_MIRROR, 0x0);
73 
74  snprintf(tmpstr, sizeof(tmpstr), "i80321 irq=%s.cpu[%i].irq "
75  "addr=0x%08x", machine->path, machine->bootstrap_cpu,
76  (int) VERDE_PMMR_BASE);
77  device_add(machine, tmpstr);
78 
79  /* TODO: actual irq on the i80321! */
80  snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].irq.i80321.1",
82  bus_isa_init(machine, tmpstr, 0, 0x90000000ULL, 0x98000000ULL);
83 
84  if (!machine->prom_emulation)
85  return;
86 
87 
88  /*
89  * Set up suitable virtual memory mappings and bootconfig struct
90  * in order to boot a plain NetBSD/iyonix ELF kernel:
91  *
92  * r0 is expected to point to the bootconfig struct.
93  */
94 
96  machine->physical_ram_in_mb * 1048576 - 65536);
97  arm_translation_table_set_l1(cpu, 0x90000000, 0x90000000);
98  arm_translation_table_set_l1(cpu, 0xf0000000, 0x00000000);
99  arm_translation_table_set_l1_b(cpu, 0xff000000, 0xff000000);
100 
101  bootblock_addr = machine->physical_ram_in_mb * 1048576 - 65536 - 16384;
102  cpu->cd.arm.r[0] = bootblock_addr;
103  memset(&bootconfigData, 0, sizeof(bootconfigData));
104 
105  store_32bit_word_in_host(cpu, (unsigned char *)
106  &bootconfigData.magic, BOOTCONFIG_MAGIC);
107  store_32bit_word_in_host(cpu, (unsigned char *)
108  &bootconfigData.version, BOOTCONFIG_VERSION);
109 
110  /* TODO: More fields. */
111 
112  store_buf(cpu, bootblock_addr, (char *)&bootconfigData, sizeof(bootconfigData));
113 }
114 
115 
117 {
118  machine->cpu_name = strdup("80321_600_B0");
119 }
120 
121 
123 {
125 }
126 
127 
129 {
130  MR_DEFAULT(iyonix, "Iyonix", ARCH_ARM, MACHINE_IYONIX);
131 
132  machine_entry_add_alias(me, "iyonix");
133 
134  me->set_default_ram = machine_default_ram_iyonix;
135 }
136 
machine::bootstrap_cpu
int bootstrap_cpu
Definition: machine.h:136
i80321reg.h
MACHINE_DEFAULT_RAM
MACHINE_DEFAULT_RAM(iyonix)
Definition: machine_iyonix.cc:122
store_buf
void store_buf(struct cpu *cpu, uint64_t addr, const char *s, size_t len)
Definition: memory.cc:826
machine::physical_ram_in_mb
int physical_ram_in_mb
Definition: machine.h:147
bus_isa.h
DEV_RAM_MIRROR
#define DEV_RAM_MIRROR
Definition: devices.h:365
arm_cpu::coproc
void(* coproc[16])(struct cpu *, int opcode1, int opcode2, int l_bit, int crn, int crm, int rd)
Definition: cpu_arm.h:143
MACHINE_REGISTER
MACHINE_REGISTER(iyonix)
Definition: machine_iyonix.cc:128
BOOTCONFIG_VERSION
#define BOOTCONFIG_VERSION
Definition: netbsd_iyonix_bootconfig.h:103
arm_setup_initial_translation_table
void arm_setup_initial_translation_table(struct cpu *cpu, uint32_t ttb_addr)
Definition: cpu_arm.cc:215
machine::prom_emulation
int prom_emulation
Definition: machine.h:149
device.h
MACHINE_SETUP
MACHINE_SETUP(iyonix)
Definition: machine_iyonix.cc:56
machine::cpu_name
char * cpu_name
Definition: machine.h:133
misc.h
arm_coproc_i80321_6
void arm_coproc_i80321_6(struct cpu *cpu, int opcode1, int opcode2, int l_bit, int crn, int crm, int rd)
Definition: cpu_arm_coproc.cc:292
cpu::cd
union cpu::@1 cd
device_add
void * device_add(struct machine *machine, const char *name_and_params)
Definition: device.cc:252
machine.h
machine
Definition: machine.h:97
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
cpu.h
machine::path
char * path
Definition: machine.h:108
VERDE_PMMR_BASE
#define VERDE_PMMR_BASE
Definition: i80321reg.h:70
arm_translation_table_set_l1
void arm_translation_table_set_l1(struct cpu *cpu, uint32_t vaddr, uint32_t paddr)
Definition: cpu_arm.cc:251
bus_isa_init
struct bus_isa_data * bus_isa_init(struct machine *machine, char *interrupt_base_path, uint32_t bus_isa_flags, uint64_t isa_portbase, uint64_t isa_membase)
Definition: bus_isa.cc:174
MACHINE_DEFAULT_CPU
MACHINE_DEFAULT_CPU(iyonix)
Definition: machine_iyonix.cc:116
bootconfig::version
Xu_int version
Definition: netbsd_iyonix_bootconfig.h:60
cpu::arm
struct arm_cpu arm
Definition: cpu.h:441
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
netbsd_iyonix_bootconfig.h
MACHINE_IYONIX
#define MACHINE_IYONIX
Definition: machine.h:244
arm_translation_table_set_l1_b
void arm_translation_table_set_l1_b(struct cpu *cpu, uint32_t vaddr, uint32_t paddr)
Definition: cpu_arm.cc:279
bootconfig::magic
Xu_int magic
Definition: netbsd_iyonix_bootconfig.h:59
bootconfig
Definition: netbsd_iyonix_bootconfig.h:58
devices.h
machine::machine_name
const char * machine_name
Definition: machine.h:115
cpu
Definition: cpu.h:326
BOOTCONFIG_MAGIC
#define BOOTCONFIG_MAGIC
Definition: netbsd_iyonix_bootconfig.h:102
machine_entry_add_alias
void machine_entry_add_alias(struct machine_entry *me, const char *name)
Definition: machine.cc:697
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

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