Statistics
| Branch: | Revision:

root / hw / shix.c @ b0eb8449

History | View | Annotate | Download (3 kB)

1 27c7ca7e bellard
/*
2 27c7ca7e bellard
 * SHIX 2.0 board description
3 5fafdf24 ths
 *
4 27c7ca7e bellard
 * Copyright (c) 2005 Samuel Tardieu
5 5fafdf24 ths
 *
6 27c7ca7e bellard
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 27c7ca7e bellard
 * of this software and associated documentation files (the "Software"), to deal
8 27c7ca7e bellard
 * in the Software without restriction, including without limitation the rights
9 27c7ca7e bellard
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 27c7ca7e bellard
 * copies of the Software, and to permit persons to whom the Software is
11 27c7ca7e bellard
 * furnished to do so, subject to the following conditions:
12 27c7ca7e bellard
 *
13 27c7ca7e bellard
 * The above copyright notice and this permission notice shall be included in
14 27c7ca7e bellard
 * all copies or substantial portions of the Software.
15 27c7ca7e bellard
 *
16 27c7ca7e bellard
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 27c7ca7e bellard
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 27c7ca7e bellard
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 27c7ca7e bellard
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 27c7ca7e bellard
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 27c7ca7e bellard
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 27c7ca7e bellard
 * THE SOFTWARE.
23 27c7ca7e bellard
 */
24 5fafdf24 ths
/*
25 27c7ca7e bellard
   Shix 2.0 board by Alexis Polti, described at
26 27c7ca7e bellard
   http://perso.enst.fr/~polti/realisations/shix20/
27 27c7ca7e bellard

28 27c7ca7e bellard
   More information in target-sh4/README.sh4
29 27c7ca7e bellard
*/
30 87ecb68b pbrook
#include "hw.h"
31 87ecb68b pbrook
#include "sh.h"
32 87ecb68b pbrook
#include "sysemu.h"
33 87ecb68b pbrook
#include "boards.h"
34 ca20cf32 Blue Swirl
#include "loader.h"
35 27c7ca7e bellard
36 27c7ca7e bellard
#define BIOS_FILENAME "shix_bios.bin"
37 27c7ca7e bellard
#define BIOS_ADDRESS 0xA0000000
38 27c7ca7e bellard
39 c227f099 Anthony Liguori
static void shix_init(ram_addr_t ram_size,
40 3023f332 aliguori
               const char *boot_device,
41 27c7ca7e bellard
               const char *kernel_filename, const char *kernel_cmdline,
42 94fc95cd j_mayer
               const char *initrd_filename, const char *cpu_model)
43 27c7ca7e bellard
{
44 27c7ca7e bellard
    int ret;
45 27c7ca7e bellard
    CPUState *env;
46 27c7ca7e bellard
    struct SH7750State *s;
47 aaed909a bellard
    
48 aaed909a bellard
    if (!cpu_model)
49 aaed909a bellard
        cpu_model = "any";
50 27c7ca7e bellard
51 27c7ca7e bellard
    printf("Initializing CPU\n");
52 aaed909a bellard
    env = cpu_init(cpu_model);
53 27c7ca7e bellard
54 27c7ca7e bellard
    /* Allocate memory space */
55 27c7ca7e bellard
    printf("Allocating ROM\n");
56 27c7ca7e bellard
    cpu_register_physical_memory(0x00000000, 0x00004000, IO_MEM_ROM);
57 27c7ca7e bellard
    printf("Allocating SDRAM 1\n");
58 27c7ca7e bellard
    cpu_register_physical_memory(0x08000000, 0x01000000, 0x00004000);
59 27c7ca7e bellard
    printf("Allocating SDRAM 2\n");
60 27c7ca7e bellard
    cpu_register_physical_memory(0x0c000000, 0x01000000, 0x01004000);
61 27c7ca7e bellard
62 27c7ca7e bellard
    /* Load BIOS in 0 (and access it through P2, 0xA0000000) */
63 1192dad8 j_mayer
    if (bios_name == NULL)
64 1192dad8 j_mayer
        bios_name = BIOS_FILENAME;
65 1192dad8 j_mayer
    printf("%s: load BIOS '%s'\n", __func__, bios_name);
66 dcac9679 pbrook
    ret = load_image_targphys(bios_name, 0, 0x4000);
67 27c7ca7e bellard
    if (ret < 0) {                /* Check bios size */
68 27c7ca7e bellard
        fprintf(stderr, "ret=%d\n", ret);
69 27c7ca7e bellard
        fprintf(stderr, "qemu: could not load SHIX bios '%s'\n",
70 1192dad8 j_mayer
                bios_name);
71 27c7ca7e bellard
        exit(1);
72 27c7ca7e bellard
    }
73 27c7ca7e bellard
74 27c7ca7e bellard
    /* Register peripherals */
75 27c7ca7e bellard
    s = sh7750_init(env);
76 27c7ca7e bellard
    /* XXXXX Check success */
77 27c7ca7e bellard
    tc58128_init(s, "shix_linux_nand.bin", NULL);
78 27c7ca7e bellard
    fprintf(stderr, "initialization terminated\n");
79 27c7ca7e bellard
}
80 27c7ca7e bellard
81 f80f9ec9 Anthony Liguori
static QEMUMachine shix_machine = {
82 4b32e168 aliguori
    .name = "shix",
83 4b32e168 aliguori
    .desc = "shix card",
84 4b32e168 aliguori
    .init = shix_init,
85 0c257437 Anthony Liguori
    .is_default = 1,
86 27c7ca7e bellard
};
87 f80f9ec9 Anthony Liguori
88 f80f9ec9 Anthony Liguori
static void shix_machine_init(void)
89 f80f9ec9 Anthony Liguori
{
90 f80f9ec9 Anthony Liguori
    qemu_register_machine(&shix_machine);
91 f80f9ec9 Anthony Liguori
}
92 f80f9ec9 Anthony Liguori
93 f80f9ec9 Anthony Liguori
machine_init(shix_machine_init);