#include "kvm.h"
#include "kvm_ppc.h"
#include "device_tree.h"
+#include "loader.h"
+#include "elf.h"
#define BINARY_DEVICE_TREE_FILE "bamboo.dtb"
const char *kernel_cmdline)
{
void *fdt = NULL;
-#ifdef HAVE_FDT
+#ifdef CONFIG_FDT
uint32_t mem_reg_property[] = { 0, 0, ramsize };
- char *path;
+ char *filename;
int fdt_size;
- int pathlen;
int ret;
- pathlen = snprintf(NULL, 0, "%s/%s", bios_dir, BINARY_DEVICE_TREE_FILE) + 1;
- path = qemu_malloc(pathlen);
-
- snprintf(path, pathlen, "%s/%s", bios_dir, BINARY_DEVICE_TREE_FILE);
-
- fdt = load_device_tree(path, &fdt_size);
- free(path);
- if (fdt == NULL)
+ filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
+ if (!filename) {
goto out;
+ }
+ fdt = load_device_tree(filename, &fdt_size);
+ qemu_free(filename);
+ if (fdt == NULL) {
+ goto out;
+ }
/* Manipulate device tree in memory. */
CPUState *env;
uint64_t elf_entry;
uint64_t elf_lowaddr;
- target_ulong entry = 0;
- target_ulong loadaddr = 0;
+ target_phys_addr_t entry = 0;
+ target_phys_addr_t loadaddr = 0;
target_long kernel_size = 0;
target_ulong initrd_base = 0;
target_long initrd_size = 0;
int i;
/* Setup CPU. */
- env = ppc440ep_init(&ram_size, &pcibus, pci_irq_nrs, 1);
+ env = ppc440ep_init(&ram_size, &pcibus, pci_irq_nrs, 1, cpu_model);
if (pcibus) {
- int unit_id = 0;
-
- /* Add virtio block devices. */
- while ((i = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) {
- pci_create_simple(pcibus, -1, "virtio-blk-pci");
- unit_id++;
- }
-
- /* Add virtio console devices */
- for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
- if (virtcon_hds[i]) {
- pci_create_simple(pcibus, -1, "virtio-console-pci");
- }
- }
-
/* Register network interfaces. */
for (i = 0; i < nb_nics; i++) {
/* There are no PCI NICs on the Bamboo board, but there are
* PCI slots, so we can pick whatever default model we want. */
- pci_nic_init(pcibus, &nd_table[i], -1, "e1000");
+ pci_nic_init_nofail(&nd_table[i], "e1000", NULL);
}
}
kernel_size = load_uimage(kernel_filename, &entry, &loadaddr, NULL);
if (kernel_size < 0) {
kernel_size = load_elf(kernel_filename, 0, &elf_entry, &elf_lowaddr,
- NULL);
+ NULL, 1, ELF_MACHINE, 0);
entry = elf_entry;
loadaddr = elf_lowaddr;
}