Linux v2.6.13-rc3
[pohmelfs.git] / include / asm-ppc64 / bootinfo.h
blobf55e7cb48f46194c71cc25022f86f03d10bfe648
1 /*
2 * Non-machine dependent bootinfo structure. Basic idea
3 * borrowed from the m68k.
5 * Copyright (C) 1999 Cort Dougan <cort@ppc.kernel.org>
6 * Copyright (c) 2001 PPC64 Team, IBM Corp
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
15 #ifndef _PPC64_BOOTINFO_H
16 #define _PPC64_BOOTINFO_H
18 #include <asm/types.h>
20 /* We use a u32 for the type of the fields since they're written by
21 * the bootloader which is a 32-bit process and read by the kernel
22 * which is a 64-bit process. This way they can both agree on the
23 * size of the type.
25 typedef u32 bi_rec_field;
27 struct bi_record {
28 bi_rec_field tag; /* tag ID */
29 bi_rec_field size; /* size of record (in bytes) */
30 bi_rec_field data[0]; /* data */
33 #define BI_FIRST 0x1010 /* first record - marker */
34 #define BI_LAST 0x1011 /* last record - marker */
35 #define BI_CMD_LINE 0x1012
36 #define BI_BOOTLOADER_ID 0x1013
37 #define BI_INITRD 0x1014
38 #define BI_SYSMAP 0x1015
39 #define BI_MACHTYPE 0x1016
41 static __inline__ struct bi_record * bi_rec_init(unsigned long addr)
43 struct bi_record *bi_recs;
44 bi_recs = (struct bi_record *)_ALIGN(addr, PAGE_SIZE);
45 bi_recs->size = 0;
46 return bi_recs;
49 static __inline__ struct bi_record * bi_rec_alloc(struct bi_record *rec,
50 unsigned long args)
52 rec = (struct bi_record *)((unsigned long)rec + rec->size);
53 rec->size = sizeof(struct bi_record) + args*sizeof(bi_rec_field);
54 return rec;
57 static __inline__ struct bi_record * bi_rec_alloc_bytes(struct bi_record *rec,
58 unsigned long bytes)
60 rec = (struct bi_record *)((unsigned long)rec + rec->size);
61 rec->size = sizeof(struct bi_record) + bytes;
62 return rec;
65 static __inline__ struct bi_record * bi_rec_next(struct bi_record *rec)
67 return (struct bi_record *)((unsigned long)rec + rec->size);
70 #endif /* _PPC64_BOOTINFO_H */