# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 4055b6b010a4ccdd480abae1a97d1ca9de18703e
# Parent 4cffec02b4788bc74d8a0ed7560fadbf332892b1
# Parent 9c72449e4370128446fa902d0183080289bdde12
[merge]
---
tools/libxc/powerpc64/ft_build.c | 165 +++++++--------------------------------
tools/libxc/powerpc64/ft_build.h | 29 ++++--
2 files changed, 49 insertions(+), 145 deletions(-)
diff -r 4cffec02b478 -r 4055b6b010a4 tools/libxc/powerpc64/ft_build.c
--- a/tools/libxc/powerpc64/ft_build.c Sun Aug 20 11:08:45 2006 -0400
+++ b/tools/libxc/powerpc64/ft_build.c Sun Aug 20 11:09:37 2006 -0400
@@ -1,17 +1,22 @@
/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of version 2.1 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright Pantelis Antoniou 2006
+ * Copyright (C) IBM Corporation 2006
+ *
+ * Authors: Pantelis Antoniou <pantelis@xxxxxxxxxxxxxxxxx>
+ * Hollis Blanchard <hollisb@xxxxxxxxxx>
*/
#include <stddef.h>
@@ -527,126 +532,20 @@ void *ft_get_prop(void *bphp, const char
return NULL;
}
-/********************************************************************/
-
-#if 0
-extern unsigned char oftree_dtb[];
-extern unsigned int oftree_dtb_len;
-
-void ft_setup(void *blob, int size, bd_t * bd)
-{
- DECLARE_GLOBAL_DATA_PTR;
- char *end;
- u32 *p;
- int len;
- struct ft_cxt cxt;
- int i, k, nxt;
- static char tmpenv[256];
- char *s, *lval, *rval;
- ulong clock;
- u32 v;
-
- /* disable OF tree; booting old kernel */
- if (getenv("disable_of") != NULL) {
- memcpy(blob, bd, sizeof(*bd));
- return;
- }
-
- ft_begin(&cxt, blob, size);
-
- /* fs_add_rsvmap not used */
-
- ft_begin_tree(&cxt);
-
- ft_begin_node(&cxt, "");
-
- ft_end_node(&cxt);
-
- /* copy RO tree */
- ft_merge_blob(&cxt, oftree_dtb);
-
- /* back into root */
- ft_backtrack_node(&cxt);
-
- ft_begin_node(&cxt, "u-boot-env");
-
- for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
- for (nxt = i; env_get_char(nxt) != '\0'; ++nxt) ;
- s = tmpenv;
- for (k = i; k < nxt && s < &tmpenv[sizeof(tmpenv) - 1]; ++k)
- *s++ = env_get_char(k);
- *s++ = '\0';
- lval = tmpenv;
- s = strchr(tmpenv, '=');
- if (s != NULL) {
- *s++ = '\0';
- rval = s;
- } else
- continue;
- ft_prop_str(&cxt, lval, rval);
- }
-
- ft_end_node(&cxt);
-
- ft_begin_node(&cxt, "chosen");
-
- ft_prop_str(&cxt, "name", "chosen");
- ft_prop_str(&cxt, "bootargs", getenv("bootargs"));
- ft_prop_int(&cxt, "linux,platform", 0x600); /* what is this? */
-
- ft_end_node(&cxt);
-
- ft_end_node(&cxt); /* end root */
-
- ft_end_tree(&cxt);
-
- /*
- printf("merged OF-tree\n");
- ft_dump_blob(blob);
- */
-
- /* paste the bd_t at the end of the flat tree */
- end = (char *)blob +
- be32_to_cpu(((struct boot_param_header *)blob)->totalsize);
- memcpy(end, bd, sizeof(*bd));
-
-#ifdef CONFIG_PPC
-
- for (i = 0; i < sizeof(bd_map)/sizeof(bd_map[0]); i++) {
- sprintf(tmpenv, "/bd_t/%s", bd_map[i].name);
- v = *(u32 *)((char *)bd + bd_map[i].offset);
-
- p = ft_get_prop(blob, tmpenv, &len);
- if (p != NULL)
- *p = cpu_to_be32(v);
- }
-
- p = ft_get_prop(blob, "/bd_t/enetaddr", &len);
- if (p != NULL)
- memcpy(p, bd->bi_enetaddr, 6);
-
- p = ft_get_prop(blob, "/bd_t/ethspeed", &len);
- if (p != NULL)
- *p = cpu_to_be32((u32) bd->bi_ethspeed);
-
- clock = bd->bi_intfreq;
- p = ft_get_prop(blob, "/cpus/" OF_CPU "/clock-frequency", &len);
- if (p != NULL)
- *p = cpu_to_be32(clock);
-
-#ifdef OF_TBCLK
- clock = OF_TBCLK;
- p = ft_get_prop(blob, "/cpus/" OF_CPU "/timebase-frequency", &len);
- if (p != NULL)
- *p = cpu_to_be32(OF_TBCLK);
-#endif
-
-#endif /* __powerpc__ */
-
- /*
- printf("final OF-tree\n");
- ft_dump_blob(blob);
- */
-
-}
-#endif
+int ft_set_prop(void *bphp, const char *propname, const void *val,
+ unsigned int len)
+{
+ void *prop;
+ unsigned int proplen;
+
+ prop = ft_get_prop(bphp, propname, &proplen);
+ if (prop == NULL)
+ return -ENOENT;
+
+ if (proplen != len)
+ /* XXX to be removed when property resize is supported */
+ return -EINVAL;
+
+ memcpy(prop, val, len);
+ return 0;
+}
diff -r 4cffec02b478 -r 4055b6b010a4 tools/libxc/powerpc64/ft_build.h
--- a/tools/libxc/powerpc64/ft_build.h Sun Aug 20 11:08:45 2006 -0400
+++ b/tools/libxc/powerpc64/ft_build.h Sun Aug 20 11:09:37 2006 -0400
@@ -1,17 +1,22 @@
/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of version 2.1 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright Pantelis Antoniou 2006
+ * Copyright (C) IBM Corporation 2006
+ *
+ * Authors: Pantelis Antoniou <pantelis@xxxxxxxxxxxxxxxxx>
+ * Hollis Blanchard <hollisb@xxxxxxxxxx>
*/
#ifndef FT_BUILD_H
@@ -116,7 +121,7 @@ void ft_dump_blob(const void *bphp);
void ft_dump_blob(const void *bphp);
void ft_merge_blob(struct ft_cxt *cxt, void *blob);
void *ft_get_prop(void *bphp, const char *propname, unsigned int *szp);
-void ft_set_prop(void *bphp, const char *propname,
- void *val, unsigned int len);
+int ft_set_prop(void *bphp, const char *propname, const void *val,
+ unsigned int len);
#endif
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|