setup.h 4.0 KB

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