bootinfo.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note
  3. *
  4. * Bootinfo tags from linux bootinfo.h and bootinfo-mac.h:
  5. * This is an easily parsable and extendable structure containing all
  6. * information to be passed from the bootstrap to the kernel
  7. *
  8. * This structure is copied right after the kernel by the bootstrap
  9. * routine.
  10. */
  11. #ifndef HW_M68K_BOOTINFO_H
  12. #define HW_M68K_BOOTINFO_H
  13. #define BOOTINFO0(base, id) \
  14. do { \
  15. stw_be_p(base, id); \
  16. base += 2; \
  17. stw_be_p(base, sizeof(struct bi_record)); \
  18. base += 2; \
  19. } while (0)
  20. #define BOOTINFO1(base, id, value) \
  21. do { \
  22. stw_be_p(base, id); \
  23. base += 2; \
  24. stw_be_p(base, sizeof(struct bi_record) + 4); \
  25. base += 2; \
  26. stl_be_p(base, value); \
  27. base += 4; \
  28. } while (0)
  29. #define BOOTINFO2(base, id, value1, value2) \
  30. do { \
  31. stw_be_p(base, id); \
  32. base += 2; \
  33. stw_be_p(base, sizeof(struct bi_record) + 8); \
  34. base += 2; \
  35. stl_be_p(base, value1); \
  36. base += 4; \
  37. stl_be_p(base, value2); \
  38. base += 4; \
  39. } while (0)
  40. #define BOOTINFOSTR(base, id, string) \
  41. do { \
  42. stw_be_p(base, id); \
  43. base += 2; \
  44. stw_be_p(base, \
  45. (sizeof(struct bi_record) + strlen(string) + \
  46. 1 /* null termination */ + 3 /* padding */) & ~3); \
  47. base += 2; \
  48. for (unsigned i_ = 0; string[i_]; i_++) { \
  49. stb_p(base++, string[i_]); \
  50. } \
  51. stb_p(base++, 0); \
  52. base = QEMU_ALIGN_PTR_UP(base, 4); \
  53. } while (0)
  54. #define BOOTINFODATA(base, id, data, len) \
  55. do { \
  56. stw_be_p(base, id); \
  57. base += 2; \
  58. stw_be_p(base, \
  59. (sizeof(struct bi_record) + len + \
  60. 2 /* length field */ + 3 /* padding */) & ~3); \
  61. base += 2; \
  62. stw_be_p(base, len); \
  63. base += 2; \
  64. for (unsigned i_ = 0; i_ < len; ++i_) { \
  65. stb_p(base++, data[i_]); \
  66. } \
  67. base = QEMU_ALIGN_PTR_UP(base, 4); \
  68. } while (0)
  69. #endif