From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Cc: kvm-ppc@vger.kernel.org
Subject: Re: [Qemu-devel] [PATCH 4/6] Implement device tree support needed
Date: Thu, 11 Dec 2008 21:33:38 +0000 [thread overview]
Message-ID: <49418732.4060206@codemonkey.ws> (raw)
In-Reply-To: <a7a1caa39906b4968399c9bdc32e13bf2ca509e9.1229027683.git.hollisb@us.ibm.com>
Hollis Blanchard wrote:
> diff --git a/device_tree.c b/device_tree.c
> new file mode 100644
> index 0000000..d7350e3
> --- /dev/null
> +++ b/device_tree.c
> @@ -0,0 +1,116 @@
> +/*
> + * Functions to help device tree manipulation using libfdt.
> + * It also provides functions to read entries from device tree proc
> + * interface.
> + *
> + * Copyright 2008 IBM Corporation.
> + * Authors: Jerone Young <jyoung5@us.ibm.com>
> + * Hollis Blanchard <hollisb@us.ibm.com>
> + *
> + * This work is licensed under the GNU GPL license version 2 or later.
> + *
> + */
> +
> +#include <stdio.h>
> +#include <sys/types.h>
> +#include <sys/stat.h>
> +#include <fcntl.h>
> +#include <unistd.h>
> +#include <stdlib.h>
> +
> +#include "config.h"
> +#include "qemu-common.h"
> +#include "sysemu.h"
> +#include "device_tree.h"
> +
> +#include "libfdt.h"
>
#include <libfdt.h>
> +void *load_device_tree(const char *filename_path, void *load_addr)
> +{
> + int dt_file_size;
> + int dt_file_load_size;
> + int new_dt_size;
> + int ret;
> + void *dt_file = NULL;
> + void *fdt;
> +
> + dt_file_size = get_image_size(filename_path);
> + if (dt_file_size < 0) {
> + printf("Unable to get size of device tree file '%s'\n",
> + filename_path);
> + goto fail;
> + }
> +
> + /* First allocate space in qemu for device tree */
> + dt_file = qemu_malloc(dt_file_size);
> + if (dt_file = NULL) {
> + printf("Unable to allocate memory in qemu for device tree\n");
> + goto fail;
> + }
> + memset(dt_file, 0, dt_file_size);
>
>
qemu_mallocz(). Indent is still bad.
> + dt_file_load_size = load_image(filename_path, dt_file);
> +
> + /* Second we place new copy of 2x size in guest memory
> + * This give us enough room for manipulation.
> + */
> + new_dt_size = dt_file_size * 2;
> +
> + fdt = load_addr;
> + ret = fdt_open_into(dt_file, fdt, new_dt_size);
> + if (ret) {
> + printf("Unable to copy device tree in memory\n");
> + goto fail;
> + }
> +
> + /* Check sanity of device tree */
> + if (fdt_check_header(fdt)) {
> + printf ("Device tree file loaded into memory is invalid: %s\n",
> + filename_path);
> + goto fail;
> + }
> + /* free qemu memory with old device tree */
> + qemu_free(dt_file);
> + return fdt;
> +
> +fail:
> + if (dt_file)
> + qemu_free(dt_file);
>
free() can safely take a NULL value.
> + return NULL;
> +}
> +
> +int qemu_devtree_setprop(void *fdt, const char *node_path,
> + const char *property, uint32_t *val_array, int size)
> +{
> + int offset;
> +
> + offset = fdt_path_offset(fdt, node_path);
> + if (offset < 0)
> + return offset;
>
This is just goofy :-)
> diff --git a/device_tree.h b/device_tree.h
> new file mode 100644
> index 0000000..9e6ef3d
> --- /dev/null
> +++ b/device_tree.h
> @@ -0,0 +1,26 @@
> +/*
> + * Header with function prototypes to help device tree manipulation using
> + * libfdt. It also provides functions to read entries from device tree proc
> + * interface.
> + *
> + * Copyright 2008 IBM Corporation.
> + * Authors: Jerone Young <jyoung5@us.ibm.com>
> + * Hollis Blanchard <hollisb@us.ibm.com>
> + *
> + * This work is licensed under the GNU GPL license version 2 or later.
> + *
> + */
> +
> +#ifndef __DEVICE_TREE_H__
> +#define __DEVICE_TREE_H__
> +
> +void *load_device_tree(const char *filename_path, void *load_addr);
> +
> +int qemu_devtree_setprop(void *fdt, const char *node_path,
> + const char *property, uint32_t *val_array, int size);
> +int qemu_devtree_setprop_cell(void *fdt, const char *node_path,
> + const char *property, uint32_t val);
> +int qemu_devtree_setprop_string(void *fdt, const char *node_path,
> + const char *property, const char *string);
> +
> +#endif /* __DEVICE_TREE_H__ */
> diff --git a/libfdt_env.h b/libfdt_env.h
> new file mode 100644
> index 0000000..59f2536
> --- /dev/null
> +++ b/libfdt_env.h
>
Missing copyright?
Regards,
Anthony Liguori
WARNING: multiple messages have this Message-ID (diff)
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Cc: kvm-ppc@vger.kernel.org
Subject: Re: [Qemu-devel] [PATCH 4/6] Implement device tree support needed for Bamboo emulation
Date: Thu, 11 Dec 2008 15:33:38 -0600 [thread overview]
Message-ID: <49418732.4060206@codemonkey.ws> (raw)
In-Reply-To: <a7a1caa39906b4968399c9bdc32e13bf2ca509e9.1229027683.git.hollisb@us.ibm.com>
Hollis Blanchard wrote:
> diff --git a/device_tree.c b/device_tree.c
> new file mode 100644
> index 0000000..d7350e3
> --- /dev/null
> +++ b/device_tree.c
> @@ -0,0 +1,116 @@
> +/*
> + * Functions to help device tree manipulation using libfdt.
> + * It also provides functions to read entries from device tree proc
> + * interface.
> + *
> + * Copyright 2008 IBM Corporation.
> + * Authors: Jerone Young <jyoung5@us.ibm.com>
> + * Hollis Blanchard <hollisb@us.ibm.com>
> + *
> + * This work is licensed under the GNU GPL license version 2 or later.
> + *
> + */
> +
> +#include <stdio.h>
> +#include <sys/types.h>
> +#include <sys/stat.h>
> +#include <fcntl.h>
> +#include <unistd.h>
> +#include <stdlib.h>
> +
> +#include "config.h"
> +#include "qemu-common.h"
> +#include "sysemu.h"
> +#include "device_tree.h"
> +
> +#include "libfdt.h"
>
#include <libfdt.h>
> +void *load_device_tree(const char *filename_path, void *load_addr)
> +{
> + int dt_file_size;
> + int dt_file_load_size;
> + int new_dt_size;
> + int ret;
> + void *dt_file = NULL;
> + void *fdt;
> +
> + dt_file_size = get_image_size(filename_path);
> + if (dt_file_size < 0) {
> + printf("Unable to get size of device tree file '%s'\n",
> + filename_path);
> + goto fail;
> + }
> +
> + /* First allocate space in qemu for device tree */
> + dt_file = qemu_malloc(dt_file_size);
> + if (dt_file == NULL) {
> + printf("Unable to allocate memory in qemu for device tree\n");
> + goto fail;
> + }
> + memset(dt_file, 0, dt_file_size);
>
>
qemu_mallocz(). Indent is still bad.
> + dt_file_load_size = load_image(filename_path, dt_file);
> +
> + /* Second we place new copy of 2x size in guest memory
> + * This give us enough room for manipulation.
> + */
> + new_dt_size = dt_file_size * 2;
> +
> + fdt = load_addr;
> + ret = fdt_open_into(dt_file, fdt, new_dt_size);
> + if (ret) {
> + printf("Unable to copy device tree in memory\n");
> + goto fail;
> + }
> +
> + /* Check sanity of device tree */
> + if (fdt_check_header(fdt)) {
> + printf ("Device tree file loaded into memory is invalid: %s\n",
> + filename_path);
> + goto fail;
> + }
> + /* free qemu memory with old device tree */
> + qemu_free(dt_file);
> + return fdt;
> +
> +fail:
> + if (dt_file)
> + qemu_free(dt_file);
>
free() can safely take a NULL value.
> + return NULL;
> +}
> +
> +int qemu_devtree_setprop(void *fdt, const char *node_path,
> + const char *property, uint32_t *val_array, int size)
> +{
> + int offset;
> +
> + offset = fdt_path_offset(fdt, node_path);
> + if (offset < 0)
> + return offset;
>
This is just goofy :-)
> diff --git a/device_tree.h b/device_tree.h
> new file mode 100644
> index 0000000..9e6ef3d
> --- /dev/null
> +++ b/device_tree.h
> @@ -0,0 +1,26 @@
> +/*
> + * Header with function prototypes to help device tree manipulation using
> + * libfdt. It also provides functions to read entries from device tree proc
> + * interface.
> + *
> + * Copyright 2008 IBM Corporation.
> + * Authors: Jerone Young <jyoung5@us.ibm.com>
> + * Hollis Blanchard <hollisb@us.ibm.com>
> + *
> + * This work is licensed under the GNU GPL license version 2 or later.
> + *
> + */
> +
> +#ifndef __DEVICE_TREE_H__
> +#define __DEVICE_TREE_H__
> +
> +void *load_device_tree(const char *filename_path, void *load_addr);
> +
> +int qemu_devtree_setprop(void *fdt, const char *node_path,
> + const char *property, uint32_t *val_array, int size);
> +int qemu_devtree_setprop_cell(void *fdt, const char *node_path,
> + const char *property, uint32_t val);
> +int qemu_devtree_setprop_string(void *fdt, const char *node_path,
> + const char *property, const char *string);
> +
> +#endif /* __DEVICE_TREE_H__ */
> diff --git a/libfdt_env.h b/libfdt_env.h
> new file mode 100644
> index 0000000..59f2536
> --- /dev/null
> +++ b/libfdt_env.h
>
Missing copyright?
Regards,
Anthony Liguori
next prev parent reply other threads:[~2008-12-11 21:33 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-11 20:52 PowerPC KVM support Hollis Blanchard
2008-12-11 20:52 ` [Qemu-devel] " Hollis Blanchard
2008-12-11 20:52 ` [PATCH 1/6] Include headers for types used in helper_regs.h Hollis Blanchard
2008-12-11 20:52 ` [Qemu-devel] " Hollis Blanchard
2008-12-11 20:52 ` [PATCH 2/6] kvm: sync vcpu state during initialization Hollis Blanchard
2008-12-11 20:52 ` [Qemu-devel] " Hollis Blanchard
2008-12-11 20:57 ` Hollis Blanchard
2008-12-11 20:57 ` [Qemu-devel] " Hollis Blanchard
2008-12-11 21:24 ` [Qemu-devel] " Anthony Liguori
2008-12-11 21:24 ` Anthony Liguori
2008-12-13 0:23 ` [Qemu-devel] [PATCH 2/6] kvm: sync vcpu state during Hollis Blanchard
2008-12-13 0:23 ` [Qemu-devel] [PATCH 2/6] kvm: sync vcpu state during initialization Hollis Blanchard
2008-12-13 0:24 ` [Qemu-devel] [PATCH 2/6] kvm: sync vcpu state during Hollis Blanchard
2008-12-13 0:24 ` [Qemu-devel] [PATCH 2/6] kvm: sync vcpu state during initialization Hollis Blanchard
2008-12-13 16:37 ` Anthony Liguori
2008-12-13 16:37 ` Anthony Liguori
2008-12-11 20:52 ` [PATCH 3/6] Enable KVM for ppcemb Hollis Blanchard
2008-12-11 20:52 ` [Qemu-devel] " Hollis Blanchard
2008-12-11 21:19 ` Blue Swirl
2008-12-12 0:04 ` Hollis Blanchard
2008-12-11 21:30 ` Anthony Liguori
2008-12-11 21:30 ` Anthony Liguori
2008-12-11 22:54 ` Hollis Blanchard
2008-12-11 22:54 ` Hollis Blanchard
2008-12-14 1:37 ` Hollis Blanchard
2008-12-14 1:37 ` Hollis Blanchard
2008-12-14 3:29 ` Anthony Liguori
2008-12-14 3:29 ` Anthony Liguori
2008-12-11 20:52 ` [PATCH 4/6] Implement device tree support needed for Bamboo emulation Hollis Blanchard
2008-12-11 20:52 ` [Qemu-devel] " Hollis Blanchard
2008-12-11 21:33 ` Anthony Liguori [this message]
2008-12-11 21:33 ` Anthony Liguori
2008-12-11 20:52 ` [PATCH 5/6] PowerPC 440EP SoC emulation Hollis Blanchard
2008-12-11 20:52 ` [Qemu-devel] " Hollis Blanchard
2008-12-11 20:52 ` [PATCH 6/6] IBM PowerPC 440EP Bamboo reference board emulation Hollis Blanchard
2008-12-11 20:52 ` [Qemu-devel] " Hollis Blanchard
2008-12-11 21:25 ` Blue Swirl
2008-12-11 21:25 ` Blue Swirl
2008-12-11 21:39 ` [Qemu-devel] [PATCH 6/6] IBM PowerPC 440EP Bamboo reference board Anthony Liguori
2008-12-11 21:39 ` [Qemu-devel] [PATCH 6/6] IBM PowerPC 440EP Bamboo reference board emulation Anthony Liguori
2008-12-11 23:08 ` [Qemu-devel] [PATCH 6/6] IBM PowerPC 440EP Bamboo reference Hollis Blanchard
2008-12-11 23:08 ` [Qemu-devel] [PATCH 6/6] IBM PowerPC 440EP Bamboo reference board emulation Hollis Blanchard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49418732.4060206@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=kvm-ppc@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.