1 /* 2 * Non-machine dependent bootinfo structure. Basic idea 3 * borrowed from the m68k. 4 * 5 * Copyright (C) 1999 Cort Dougan <cort@ppc.kernel.org> 6 * Copyright (c) 2001 PPC64 Team, IBM Corp 7 * 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. 12 */ 13 14 15 #ifndef _PPC64_BOOTINFO_H 16 #define _PPC64_BOOTINFO_H 17 18 #include <asm/types.h> 19 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. 24 */ 25 typedef u32 bi_rec_field; 26 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 */ 31 }; 32 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 40 bi_rec_init(unsigned long addr)41static __inline__ struct bi_record * bi_rec_init(unsigned long addr) 42 { 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; 47 } 48 bi_rec_alloc(struct bi_record * rec,unsigned long args)49static __inline__ struct bi_record * bi_rec_alloc(struct bi_record *rec, 50 unsigned long args) 51 { 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; 55 } 56 bi_rec_alloc_bytes(struct bi_record * rec,unsigned long bytes)57static __inline__ struct bi_record * bi_rec_alloc_bytes(struct bi_record *rec, 58 unsigned long bytes) 59 { 60 rec = (struct bi_record *)((unsigned long)rec + rec->size); 61 rec->size = sizeof(struct bi_record) + bytes; 62 return rec; 63 } 64 bi_rec_next(struct bi_record * rec)65static __inline__ struct bi_record * bi_rec_next(struct bi_record *rec) 66 { 67 return (struct bi_record *)((unsigned long)rec + rec->size); 68 } 69 70 #endif /* _PPC64_BOOTINFO_H */ 71