2 * Qemu PowerPC 440 board emualtion
4 * Copyright 2007 IBM Corporation.
5 * Authors: Jerone Young <jyoung5@us.ibm.com>
7 * This work is licensed under the GNU LGPL license, version 2.
13 #define KERNEL_LOAD_ADDR 0x400000 /* uboot loader puts kernel at 4MB */
17 /* PPC 440 refrence demo board
22 void bamboo_init(ram_addr_t ram_size
, int vga_ram_size
,
23 const char *boot_device
, DisplayState
*ds
,
24 const char *kernel_filename
,
25 const char *kernel_cmdline
,
26 const char *initrd_filename
,
27 const char *cpu_model
)
29 target_phys_addr_t ram_bases
[2], ram_sizes
[2];
33 int is_linux
=1; /* Will assume allways is Linux for now */
35 target_ulong initrd_base
=0;
36 target_ulong initrd_size
=0;
38 printf("%s: START\n", __func__
);
42 printf("Ram size specified on command line is %i bytes\n",
44 printf("WARNING: RAM is hard coded to 144MB\n");
47 printf("Using defualt ram size of %iMB\n",
48 ((int)ram_size
/1024)/1024);
51 /* Each bank can only have memory in configurations of
52 * 16MB, 32MB, 64MB, 128MB, or 256MB
55 ram_sizes
[0] = 0x08000000;
57 ram_sizes
[1] = 0x01000000;
59 printf("Ram size of domain is %d bytes\n", (int)ram_size
);
62 /* XXX We cheat for now and use 405 */
63 env
= cpu_ppc_init("405");
65 fprintf(stderr
, "Unable to initilize CPU!\n");
70 printf("Calling function ppc440_init\n");
71 ppc440_init(env
, ram_bases
, ram_sizes
, &pic
,1);
72 printf("Done calling ppc440_init\n");
75 cpu_register_physical_memory(0, ram_size
, 0);
77 kvm_cpu_register_physical_memory(0, ram_size
, 0);
79 /* load kernel with uboot loader */
80 printf("%s: load kernel\n", __func__
);
81 kernel_size
= load_uboot(kernel_filename
, &ep
, &is_linux
);
82 if (kernel_size
< 0) {
83 fprintf(stderr
, "qemu: could not load kernel '%s'\n",
89 if (initrd_filename
) {
90 initrd_base
= kernel_size
+ KERNEL_LOAD_ADDR
;
91 initrd_size
= load_image(initrd_filename
,
92 phys_ram_base
+ initrd_base
);
94 if (initrd_size
< 0) {
96 "qemu: could not load initial ram disk '%s'\n",
103 /* XXX insert TLB entries */
104 env
->gpr
[1] = (16<<20) - 8;
105 env
->gpr
[4] = initrd_base
;
106 env
->gpr
[5] = initrd_size
;
111 printf("%s: loading kvm registers\n", __func__
);
112 kvm_load_registers(env
);
115 printf("%s: DONE\n", __func__
);
118 QEMUMachine bamboo_machine
= {