setup.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /*
  2. * linux/arch/nds32/include/asm/setup.h
  3. *
  4. * Copyright (C) 1997-1999 Russell King
  5. * Copyright (C) 2008 Andes Technology Corporation
  6. * Copyright (C) 2013 Ken Kuo (ken_kuo@andestech.com)
  7. * Copyright (C) 2017 Rick Chen (rick@andestech.com)
  8. *
  9. * SPDX-License-Identifier: GPL-2.0
  10. *
  11. * Structure passed to kernel to tell it about the
  12. * hardware it's running on. See Documentation/arm/Setup
  13. * for more info.
  14. */
  15. #ifndef __RISCV_SETUP_H
  16. #define __RISCV_SETUP_H
  17. #define COMMAND_LINE_SIZE 256
  18. /* The list ends with an ATAG_NONE node. */
  19. #define ATAG_NONE 0x00000000
  20. struct tag_header {
  21. u32 size;
  22. u32 tag;
  23. };
  24. /* The list must start with an ATAG_CORE node */
  25. #define ATAG_CORE 0x54410001
  26. struct tag_core {
  27. u32 flags; /* bit 0 = read-only */
  28. u32 pagesize;
  29. u32 rootdev;
  30. };
  31. /* it is allowed to have multiple ATAG_MEM nodes */
  32. #define ATAG_MEM 0x54410002
  33. struct tag_mem32 {
  34. u32 size;
  35. u32 start; /* physical start address */
  36. };
  37. /* VGA text type displays */
  38. #define ATAG_VIDEOTEXT 0x54410003
  39. struct tag_videotext {
  40. u8 x;
  41. u8 y;
  42. u16 video_page;
  43. u8 video_mode;
  44. u8 video_cols;
  45. u16 video_ega_bx;
  46. u8 video_lines;
  47. u8 video_isvga;
  48. u16 video_points;
  49. };
  50. /* describes how the ramdisk will be used in kernel */
  51. #define ATAG_RAMDISK 0x54410004
  52. struct tag_ramdisk {
  53. u32 flags; /* bit 0 = load, bit 1 = prompt */
  54. u32 size; /* decompressed ramdisk size in _kilo_ bytes */
  55. u32 start; /* starting block of floppy-based RAM disk image */
  56. };
  57. /*
  58. * this one accidentally used virtual addresses - as such,
  59. * it's deprecated.
  60. * describes where the compressed ramdisk image lives (virtual address)
  61. */
  62. #define ATAG_INITRD 0x54410005
  63. /* describes where the compressed ramdisk image lives (physical address) */
  64. #define ATAG_INITRD2 0x54420005
  65. struct tag_initrd {
  66. u32 start; /* physical start address */
  67. u32 size; /* size of compressed ramdisk image in bytes */
  68. };
  69. /* board serial number. "64 bits should be enough for everybody" */
  70. #define ATAG_SERIAL 0x54410006
  71. struct tag_serialnr {
  72. u32 low;
  73. u32 high;
  74. };
  75. /* board revision */
  76. #define ATAG_REVISION 0x54410007
  77. struct tag_revision {
  78. u32 rev;
  79. };
  80. /* initial values for vesafb-type framebuffers. see struct screen_info
  81. * in include/linux/tty.h
  82. */
  83. #define ATAG_VIDEOLFB 0x54410008
  84. struct tag_videolfb {
  85. u16 lfb_width;
  86. u16 lfb_height;
  87. u16 lfb_depth;
  88. u16 lfb_linelength;
  89. u32 lfb_base;
  90. u32 lfb_size;
  91. u8 red_size;
  92. u8 red_pos;
  93. u8 green_size;
  94. u8 green_pos;
  95. u8 blue_size;
  96. u8 blue_pos;
  97. u8 rsvd_size;
  98. u8 rsvd_pos;
  99. };
  100. /* command line: \0 terminated string */
  101. #define ATAG_CMDLINE 0x54410009
  102. struct tag_cmdline {
  103. char cmdline[COMMAND_LINE_SIZE];
  104. };
  105. struct tag {
  106. struct tag_header hdr;
  107. union {
  108. struct tag_core core;
  109. struct tag_mem32 mem;
  110. struct tag_videotext videotext;
  111. struct tag_ramdisk ramdisk;
  112. struct tag_initrd initrd;
  113. struct tag_serialnr serialnr;
  114. struct tag_revision revision;
  115. struct tag_videolfb videolfb;
  116. struct tag_cmdline cmdline;
  117. } u;
  118. };
  119. struct tagtable {
  120. u32 tag;
  121. int (*parse)(const struct tag *);
  122. };
  123. #define tag_member_present(tag, member) \
  124. ((unsigned long)(&((struct tag *)0L)->member + 1) \
  125. <= (tag)->hdr.size * 4)
  126. #define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size))
  127. #define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
  128. #define for_each_tag(t, base) \
  129. for (t = base; t->hdr.size; t = tag_next(t))
  130. #ifdef __KERNEL__
  131. #define __tag __used __attribute__((__section__(".taglist")))
  132. #define __tagtable(tag, fn) \
  133. static struct tagtable __tagtable_##fn __tag = { tag, fn }
  134. /*
  135. * Memory map description
  136. */
  137. #define NR_BANKS 8
  138. struct meminfo {
  139. int nr_banks;
  140. struct {
  141. unsigned long start;
  142. unsigned long size;
  143. int node;
  144. } bank[NR_BANKS];
  145. };
  146. /*
  147. * Early command line parameters.
  148. */
  149. struct early_params {
  150. const char *arg;
  151. void (*fn)(char **p);
  152. };
  153. #define __early_param(name, fn) \
  154. static struct early_params __early_##fn __used \
  155. __attribute__((__section__("__early_param"))) = { name, fn }
  156. #endif
  157. #endif