microblaze: Fix latent bug with default DTB lookup
microblaze_load_kernel() fails to call qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename) when no -machine options are given. This can't normally happen, because -machine option kernel is mandatory for this target. Fix it anyway, by using qemu_get_machine_opts(). Cc: Peter Crosthwaite <peter.crosthwaite@petalogix.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372943363-24081-6-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
		
							parent
							
								
									36ad0e948e
								
							
						
					
					
						commit
						7bccd94026
					
				@ -28,6 +28,7 @@
 | 
				
			|||||||
#include "qemu/config-file.h"
 | 
					#include "qemu/config-file.h"
 | 
				
			||||||
#include "qemu-common.h"
 | 
					#include "qemu-common.h"
 | 
				
			||||||
#include "sysemu/device_tree.h"
 | 
					#include "sysemu/device_tree.h"
 | 
				
			||||||
 | 
					#include "sysemu/sysemu.h"
 | 
				
			||||||
#include "hw/loader.h"
 | 
					#include "hw/loader.h"
 | 
				
			||||||
#include "elf.h"
 | 
					#include "elf.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -93,20 +94,18 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base,
 | 
				
			|||||||
                            void (*machine_cpu_reset)(MicroBlazeCPU *))
 | 
					                            void (*machine_cpu_reset)(MicroBlazeCPU *))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    QemuOpts *machine_opts;
 | 
					    QemuOpts *machine_opts;
 | 
				
			||||||
    const char *kernel_filename = NULL;
 | 
					    const char *kernel_filename;
 | 
				
			||||||
    const char *kernel_cmdline = NULL;
 | 
					    const char *kernel_cmdline;
 | 
				
			||||||
 | 
					    const char *dtb_arg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
 | 
					    machine_opts = qemu_get_machine_opts();
 | 
				
			||||||
    if (machine_opts) {
 | 
					    kernel_filename = qemu_opt_get(machine_opts, "kernel");
 | 
				
			||||||
        const char *dtb_arg;
 | 
					    kernel_cmdline = qemu_opt_get(machine_opts, "append");
 | 
				
			||||||
        kernel_filename = qemu_opt_get(machine_opts, "kernel");
 | 
					    dtb_arg = qemu_opt_get(machine_opts, "dtb");
 | 
				
			||||||
        kernel_cmdline = qemu_opt_get(machine_opts, "append");
 | 
					    if (dtb_arg) { /* Preference a -dtb argument */
 | 
				
			||||||
        dtb_arg = qemu_opt_get(machine_opts, "dtb");
 | 
					        dtb_filename = dtb_arg;
 | 
				
			||||||
        if (dtb_arg) { /* Preference a -dtb argument */
 | 
					    } else { /* default to pcbios dtb as passed by machine_init */
 | 
				
			||||||
            dtb_filename = dtb_arg;
 | 
					        dtb_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename);
 | 
				
			||||||
        } else { /* default to pcbios dtb as passed by machine_init */
 | 
					 | 
				
			||||||
            dtb_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    boot_info.machine_cpu_reset = machine_cpu_reset;
 | 
					    boot_info.machine_cpu_reset = machine_cpu_reset;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user