bootinfo.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. #ifndef _PPC64_BOOTINFO_H
  14. #define _PPC64_BOOTINFO_H
  15. #include <asm/types.h>
  16. /* We use a u32 for the type of the fields since they're written by
  17. * the bootloader which is a 32-bit process and read by the kernel
  18. * which is a 64-bit process. This way they can both agree on the
  19. * size of the type.
  20. */
  21. typedef u32 bi_rec_field;
  22. struct bi_record {
  23. bi_rec_field tag; /* tag ID */
  24. bi_rec_field size; /* size of record (in bytes) */
  25. bi_rec_field data[0]; /* data */
  26. };
  27. #define BI_FIRST 0x1010 /* first record - marker */
  28. #define BI_LAST 0x1011 /* last record - marker */
  29. #define BI_CMD_LINE 0x1012
  30. #define BI_BOOTLOADER_ID 0x1013
  31. #define BI_INITRD 0x1014
  32. #define BI_SYSMAP 0x1015
  33. #define BI_MACHTYPE 0x1016
  34. static __inline__ struct bi_record * bi_rec_init(unsigned long addr)
  35. {
  36. struct bi_record *bi_recs;
  37. bi_recs = (struct bi_record *)_ALIGN(addr, PAGE_SIZE);
  38. bi_recs->size = 0;
  39. return bi_recs;
  40. }
  41. static __inline__ struct bi_record * bi_rec_alloc(struct bi_record *rec,
  42. unsigned long args)
  43. {
  44. rec = (struct bi_record *)((unsigned long)rec + rec->size);
  45. rec->size = sizeof(struct bi_record) + args*sizeof(bi_rec_field);
  46. return rec;
  47. }
  48. static __inline__ struct bi_record * bi_rec_alloc_bytes(struct bi_record *rec,
  49. unsigned long bytes)
  50. {
  51. rec = (struct bi_record *)((unsigned long)rec + rec->size);
  52. rec->size = sizeof(struct bi_record) + bytes;
  53. return rec;
  54. }
  55. static __inline__ struct bi_record * bi_rec_next(struct bi_record *rec)
  56. {
  57. return (struct bi_record *)((unsigned long)rec + rec->size);
  58. }
  59. #endif /* _PPC64_BOOTINFO_H */