mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-30 13:53:54 -06:00
system/datadir: Add new type constant for DTB files
Currently DTB files are mixed with ROMs under BIOS type. Separate them under a new type constant and turn defines into an enum while at it. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <ae793d1f81e3577605759c43871722324a1ef2cb.1745402140.git.balaton@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
8af0e52b28
commit
fcb1ad456c
6 changed files with 14 additions and 8 deletions
|
@ -130,7 +130,7 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, bool is_little_endian,
|
||||||
dtb_arg = current_machine->dtb;
|
dtb_arg = current_machine->dtb;
|
||||||
/* default to pcbios dtb as passed by machine_init */
|
/* default to pcbios dtb as passed by machine_init */
|
||||||
if (!dtb_arg && dtb_filename) {
|
if (!dtb_arg && dtb_filename) {
|
||||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename);
|
filename = qemu_find_file(QEMU_FILE_TYPE_DTB, dtb_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
boot_info.machine_cpu_reset = machine_cpu_reset;
|
boot_info.machine_cpu_reset = machine_cpu_reset;
|
||||||
|
|
|
@ -64,7 +64,7 @@ static int bamboo_load_device_tree(MachineState *machine,
|
||||||
uint32_t tb_freq = 400000000;
|
uint32_t tb_freq = 400000000;
|
||||||
uint32_t clock_freq = 400000000;
|
uint32_t clock_freq = 400000000;
|
||||||
|
|
||||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
|
filename = qemu_find_file(QEMU_FILE_TYPE_DTB, BINARY_DEVICE_TREE_FILE);
|
||||||
if (!filename) {
|
if (!filename) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,7 @@ static int sam460ex_load_device_tree(MachineState *machine,
|
||||||
uint32_t clock_freq = CPU_FREQ;
|
uint32_t clock_freq = CPU_FREQ;
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
|
filename = qemu_find_file(QEMU_FILE_TYPE_DTB, BINARY_DEVICE_TREE_FILE);
|
||||||
if (!filename) {
|
if (!filename) {
|
||||||
error_report("Couldn't find dtb file `%s'", BINARY_DEVICE_TREE_FILE);
|
error_report("Couldn't find dtb file `%s'", BINARY_DEVICE_TREE_FILE);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -146,7 +146,7 @@ static int xilinx_load_device_tree(MachineState *machine,
|
||||||
/* Try the local "ppc.dtb" override. */
|
/* Try the local "ppc.dtb" override. */
|
||||||
fdt = load_device_tree("ppc.dtb", &fdt_size);
|
fdt = load_device_tree("ppc.dtb", &fdt_size);
|
||||||
if (!fdt) {
|
if (!fdt) {
|
||||||
path = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
|
path = qemu_find_file(QEMU_FILE_TYPE_DTB, BINARY_DEVICE_TREE_FILE);
|
||||||
if (path) {
|
if (path) {
|
||||||
fdt = load_device_tree(path, &fdt_size);
|
fdt = load_device_tree(path, &fdt_size);
|
||||||
g_free(path);
|
g_free(path);
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
#ifndef QEMU_DATADIR_H
|
#ifndef QEMU_DATADIR_H
|
||||||
#define QEMU_DATADIR_H
|
#define QEMU_DATADIR_H
|
||||||
|
|
||||||
#define QEMU_FILE_TYPE_BIOS 0
|
typedef enum {
|
||||||
#define QEMU_FILE_TYPE_KEYMAP 1
|
QEMU_FILE_TYPE_BIOS,
|
||||||
|
QEMU_FILE_TYPE_DTB,
|
||||||
|
QEMU_FILE_TYPE_KEYMAP,
|
||||||
|
} QemuFileType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qemu_find_file:
|
* qemu_find_file:
|
||||||
* @type: QEMU_FILE_TYPE_BIOS (for BIOS, VGA BIOS)
|
* @type: QEMU_FILE_TYPE_BIOS (for BIOS, VGA BIOS)
|
||||||
|
* QEMU_FILE_TYPE_DTB (for device tree blobs)
|
||||||
* or QEMU_FILE_TYPE_KEYMAP (for keymaps).
|
* or QEMU_FILE_TYPE_KEYMAP (for keymaps).
|
||||||
* @name: Relative or absolute file name
|
* @name: Relative or absolute file name
|
||||||
*
|
*
|
||||||
|
@ -20,7 +25,7 @@
|
||||||
*
|
*
|
||||||
* Returns: a path that can access @name, or NULL if no matching file exists.
|
* Returns: a path that can access @name, or NULL if no matching file exists.
|
||||||
*/
|
*/
|
||||||
char *qemu_find_file(int type, const char *name);
|
char *qemu_find_file(QemuFileType type, const char *name);
|
||||||
void qemu_add_default_firmwarepath(void);
|
void qemu_add_default_firmwarepath(void);
|
||||||
void qemu_add_data_dir(char *path);
|
void qemu_add_data_dir(char *path);
|
||||||
void qemu_list_data_dirs(void);
|
void qemu_list_data_dirs(void);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
static const char *data_dir[16];
|
static const char *data_dir[16];
|
||||||
static int data_dir_idx;
|
static int data_dir_idx;
|
||||||
|
|
||||||
char *qemu_find_file(int type, const char *name)
|
char *qemu_find_file(QemuFileType type, const char *name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const char *subdir;
|
const char *subdir;
|
||||||
|
@ -44,6 +44,7 @@ char *qemu_find_file(int type, const char *name)
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QEMU_FILE_TYPE_BIOS:
|
case QEMU_FILE_TYPE_BIOS:
|
||||||
|
case QEMU_FILE_TYPE_DTB:
|
||||||
subdir = "";
|
subdir = "";
|
||||||
break;
|
break;
|
||||||
case QEMU_FILE_TYPE_KEYMAP:
|
case QEMU_FILE_TYPE_KEYMAP:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue