[PATCH] powerpc: trivial: modify comments to refer to new location of files
[linux-2.6/verdex.git] / arch / ppc / boot / common / bootinfo.c
blobf4dc9b9fab9c1d8e5110bec55fe57a82b87c8c9b
1 /*
2 * General bootinfo record utilities
3 * Author: Randy Vinson <rvinson@mvista.com>
5 * 2002 (c) MontaVista Software, Inc. This file is licensed under the terms
6 * of the GNU General Public License version 2. This program is licensed
7 * "as is" without any warranty of any kind, whether express or implied.
8 */
10 #include <linux/types.h>
11 #include <linux/string.h>
12 #include <asm/bootinfo.h>
14 #include "nonstdio.h"
16 static struct bi_record * birec = NULL;
18 static struct bi_record *
19 __bootinfo_build(struct bi_record *rec, unsigned long tag, unsigned long size,
20 void *data)
22 /* set the tag */
23 rec->tag = tag;
25 /* if the caller has any data, copy it */
26 if (size)
27 memcpy(rec->data, (char *)data, size);
29 /* set the record size */
30 rec->size = sizeof(struct bi_record) + size;
32 /* advance to the next available space */
33 rec = (struct bi_record *)((unsigned long)rec + rec->size);
35 return rec;
38 void
39 bootinfo_init(struct bi_record *rec)
42 /* save start of birec area */
43 birec = rec;
45 /* create an empty list */
46 rec = __bootinfo_build(rec, BI_FIRST, 0, NULL);
47 (void) __bootinfo_build(rec, BI_LAST, 0, NULL);
51 void
52 bootinfo_append(unsigned long tag, unsigned long size, void * data)
55 struct bi_record *rec = birec;
57 /* paranoia */
58 if ((rec == NULL) || (rec->tag != BI_FIRST))
59 return;
61 /* find the last entry in the list */
62 while (rec->tag != BI_LAST)
63 rec = (struct bi_record *)((ulong)rec + rec->size);
65 /* overlay BI_LAST record with new one and tag on a new BI_LAST */
66 rec = __bootinfo_build(rec, tag, size, data);
67 (void) __bootinfo_build(rec, BI_LAST, 0, NULL);