setup.h 3.9 KB

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