setup.h 3.8 KB

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