Statistics
| Branch: | Revision:

root / hw / realview.c @ 6ac0e82d

History | View | Annotate | Download (4.3 kB)

1
/*
2
 * ARM RealView Baseboard System emulation.
3
 *
4
 * Copyright (c) 2006-2007 CodeSourcery.
5
 * Written by Paul Brook
6
 *
7
 * This code is licenced under the GPL.
8
 */
9

    
10
#include "vl.h"
11
#include "arm_pic.h"
12

    
13
/* Board init.  */
14

    
15
static void realview_init(int ram_size, int vga_ram_size,
16
                     const char *boot_device, DisplayState *ds,
17
                     const char **fd_filename, int snapshot,
18
                     const char *kernel_filename, const char *kernel_cmdline,
19
                     const char *initrd_filename, const char *cpu_model)
20
{
21
    CPUState *env;
22
    qemu_irq *pic;
23
    void *scsi_hba;
24
    PCIBus *pci_bus;
25
    NICInfo *nd;
26
    int n;
27
    int done_smc = 0;
28

    
29
    env = cpu_init();
30
    if (!cpu_model)
31
        cpu_model = "arm926";
32
    cpu_arm_set_model(env, cpu_model);
33
    /* ??? RAM shoud repeat to fill physical memory space.  */
34
    /* SDRAM at address zero.  */
35
    cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
36

    
37
    arm_sysctl_init(0x10000000, 0xc1400400);
38
    pic = arm_pic_init_cpu(env);
39
    /* ??? The documentation says GIC1 is nFIQ and either GIC2 or GIC3
40
       is nIRQ (there are inconsistencies).  However Linux 2.6.17 expects
41
       GIC1 to be nIRQ and ignores all the others, so do that for now.  */
42
    pic = arm_gic_init(0x10040000, pic[ARM_PIC_CPU_IRQ]);
43
    pl050_init(0x10006000, pic[20], 0);
44
    pl050_init(0x10007000, pic[21], 1);
45

    
46
    pl011_init(0x10009000, pic[12], serial_hds[0]);
47
    pl011_init(0x1000a000, pic[13], serial_hds[1]);
48
    pl011_init(0x1000b000, pic[14], serial_hds[2]);
49
    pl011_init(0x1000c000, pic[15], serial_hds[3]);
50

    
51
    /* DMA controller is optional, apparently.  */
52
    pl080_init(0x10030000, pic[24], 2);
53

    
54
    sp804_init(0x10011000, pic[4]);
55
    sp804_init(0x10012000, pic[5]);
56

    
57
    pl110_init(ds, 0x10020000, pic[23], 1);
58

    
59
    pl181_init(0x10005000, sd_bdrv, pic[17], pic[18]);
60

    
61
    pl031_init(0x10017000, pic[10]);
62

    
63
    pci_bus = pci_vpb_init(pic, 48, 1);
64
    if (usb_enabled) {
65
        usb_ohci_init_pci(pci_bus, 3, -1);
66
    }
67
    scsi_hba = lsi_scsi_init(pci_bus, -1);
68
    for (n = 0; n < MAX_DISKS; n++) {
69
        if (bs_table[n]) {
70
            lsi_scsi_attach(scsi_hba, bs_table[n], n);
71
        }
72
    }
73
    for(n = 0; n < nb_nics; n++) {
74
        nd = &nd_table[n];
75
        if (!nd->model)
76
            nd->model = done_smc ? "rtl8139" : "smc91c111";
77
        if (strcmp(nd->model, "smc91c111") == 0) {
78
            smc91c111_init(nd, 0x4e000000, pic[28]);
79
        } else {
80
            pci_nic_init(pci_bus, nd, -1);
81
        }
82
    }
83

    
84
    /* Memory map for RealView Emulation Baseboard:  */
85
    /* 0x10000000 System registers.  */
86
    /*  0x10001000 System controller.  */
87
    /*  0x10002000 Two-Wire Serial Bus.  */
88
    /* 0x10003000 Reserved.  */
89
    /*  0x10004000 AACI.  */
90
    /*  0x10005000 MCI.  */
91
    /* 0x10006000 KMI0.  */
92
    /* 0x10007000 KMI1.  */
93
    /*  0x10008000 Character LCD.  */
94
    /* 0x10009000 UART0.  */
95
    /* 0x1000a000 UART1.  */
96
    /* 0x1000b000 UART2.  */
97
    /* 0x1000c000 UART3.  */
98
    /*  0x1000d000 SSPI.  */
99
    /*  0x1000e000 SCI.  */
100
    /* 0x1000f000 Reserved.  */
101
    /*  0x10010000 Watchdog.  */
102
    /* 0x10011000 Timer 0+1.  */
103
    /* 0x10012000 Timer 2+3.  */
104
    /*  0x10013000 GPIO 0.  */
105
    /*  0x10014000 GPIO 1.  */
106
    /*  0x10015000 GPIO 2.  */
107
    /* 0x10016000 Reserved.  */
108
    /* 0x10017000 RTC.  */
109
    /*  0x10018000 DMC.  */
110
    /*  0x10019000 PCI controller config.  */
111
    /*  0x10020000 CLCD.  */
112
    /* 0x10030000 DMA Controller.  */
113
    /* 0x10040000 GIC1 (FIQ1).  */
114
    /* 0x10050000 GIC2 (IRQ1).  */
115
    /*  0x10060000 GIC3 (FIQ2).  */
116
    /*  0x10070000 GIC4 (IRQ2).  */
117
    /*  0x10080000 SMC.  */
118
    /*  0x40000000 NOR flash.  */
119
    /*  0x44000000 DoC flash.  */
120
    /*  0x48000000 SRAM.  */
121
    /*  0x4c000000 Configuration flash.  */
122
    /* 0x4e000000 Ethernet.  */
123
    /*  0x4f000000 USB.  */
124
    /*  0x50000000 PISMO.  */
125
    /*  0x54000000 PISMO.  */
126
    /*  0x58000000 PISMO.  */
127
    /*  0x5c000000 PISMO.  */
128
    /* 0x60000000 PCI.  */
129
    /* 0x61000000 PCI Self Config.  */
130
    /* 0x62000000 PCI Config.  */
131
    /* 0x63000000 PCI IO.  */
132
    /* 0x64000000 PCI mem 0.  */
133
    /* 0x68000000 PCI mem 1.  */
134
    /* 0x6c000000 PCI mem 2.  */
135

    
136
    arm_load_kernel(env, ram_size, kernel_filename, kernel_cmdline,
137
                    initrd_filename, 0x33b, 0x0);
138
}
139

    
140
QEMUMachine realview_machine = {
141
    "realview",
142
    "ARM RealView Emulation Baseboard (ARM926EJ-S)",
143
    realview_init
144
};