boot_param.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. #ifndef __ASM_MACH_LOONGSON64_BOOT_PARAM_H_
  2. #define __ASM_MACH_LOONGSON64_BOOT_PARAM_H_
  3. #define SYSTEM_RAM_LOW 1
  4. #define SYSTEM_RAM_HIGH 2
  5. #define MEM_RESERVED 3
  6. #define PCI_IO 4
  7. #define PCI_MEM 5
  8. #define LOONGSON_CFG_REG 6
  9. #define VIDEO_ROM 7
  10. #define ADAPTER_ROM 8
  11. #define ACPI_TABLE 9
  12. #define SMBIOS_TABLE 10
  13. #define MAX_MEMORY_TYPE 11
  14. #define LOONGSON3_BOOT_MEM_MAP_MAX 128
  15. struct efi_memory_map_loongson {
  16. u16 vers; /* version of efi_memory_map */
  17. u32 nr_map; /* number of memory_maps */
  18. u32 mem_freq; /* memory frequence */
  19. struct mem_map {
  20. u32 node_id; /* node_id which memory attached to */
  21. u32 mem_type; /* system memory, pci memory, pci io, etc. */
  22. u64 mem_start; /* memory map start address */
  23. u32 mem_size; /* each memory_map size, not the total size */
  24. } map[LOONGSON3_BOOT_MEM_MAP_MAX];
  25. } __packed;
  26. enum loongson_cpu_type {
  27. Loongson_2E = 0,
  28. Loongson_2F = 1,
  29. Loongson_3A = 2,
  30. Loongson_3B = 3,
  31. Loongson_1A = 4,
  32. Loongson_1B = 5
  33. };
  34. /*
  35. * Capability and feature descriptor structure for MIPS CPU
  36. */
  37. struct efi_cpuinfo_loongson {
  38. u16 vers; /* version of efi_cpuinfo_loongson */
  39. u32 processor_id; /* PRID, e.g. 6305, 6306 */
  40. u32 cputype; /* Loongson_3A/3B, etc. */
  41. u32 total_node; /* num of total numa nodes */
  42. u16 cpu_startup_core_id; /* Boot core id */
  43. u16 reserved_cores_mask;
  44. u32 cpu_clock_freq; /* cpu_clock */
  45. u32 nr_cpus;
  46. } __packed;
  47. #define MAX_UARTS 64
  48. struct uart_device {
  49. u32 iotype; /* see include/linux/serial_core.h */
  50. u32 uartclk;
  51. u32 int_offset;
  52. u64 uart_base;
  53. } __packed;
  54. #define MAX_SENSORS 64
  55. #define SENSOR_TEMPER 0x00000001
  56. #define SENSOR_VOLTAGE 0x00000002
  57. #define SENSOR_FAN 0x00000004
  58. struct sensor_device {
  59. char name[32]; /* a formal name */
  60. char label[64]; /* a flexible description */
  61. u32 type; /* SENSOR_* */
  62. u32 id; /* instance id of a sensor-class */
  63. u32 fan_policy; /* see loongson_hwmon.h */
  64. u32 fan_percent;/* only for constant speed policy */
  65. u64 base_addr; /* base address of device registers */
  66. } __packed;
  67. struct system_loongson {
  68. u16 vers; /* version of system_loongson */
  69. u32 ccnuma_smp; /* 0: no numa; 1: has numa */
  70. u32 sing_double_channel; /* 1:single; 2:double */
  71. u32 nr_uarts;
  72. struct uart_device uarts[MAX_UARTS];
  73. u32 nr_sensors;
  74. struct sensor_device sensors[MAX_SENSORS];
  75. char has_ec;
  76. char ec_name[32];
  77. u64 ec_base_addr;
  78. char has_tcm;
  79. char tcm_name[32];
  80. u64 tcm_base_addr;
  81. u64 workarounds; /* see workarounds.h */
  82. } __packed;
  83. struct irq_source_routing_table {
  84. u16 vers;
  85. u16 size;
  86. u16 rtr_bus;
  87. u16 rtr_devfn;
  88. u32 vendor;
  89. u32 device;
  90. u32 PIC_type; /* conform use HT or PCI to route to CPU-PIC */
  91. u64 ht_int_bit; /* 3A: 1<<24; 3B: 1<<16 */
  92. u64 ht_enable; /* irqs used in this PIC */
  93. u32 node_id; /* node id: 0x0-0; 0x1-1; 0x10-2; 0x11-3 */
  94. u64 pci_mem_start_addr;
  95. u64 pci_mem_end_addr;
  96. u64 pci_io_start_addr;
  97. u64 pci_io_end_addr;
  98. u64 pci_config_addr;
  99. u32 dma_mask_bits;
  100. } __packed;
  101. struct interface_info {
  102. u16 vers; /* version of the specificition */
  103. u16 size;
  104. u8 flag;
  105. char description[64];
  106. } __packed;
  107. #define MAX_RESOURCE_NUMBER 128
  108. struct resource_loongson {
  109. u64 start; /* resource start address */
  110. u64 end; /* resource end address */
  111. char name[64];
  112. u32 flags;
  113. };
  114. struct archdev_data {}; /* arch specific additions */
  115. struct board_devices {
  116. char name[64]; /* hold the device name */
  117. u32 num_resources; /* number of device_resource */
  118. /* for each device's resource */
  119. struct resource_loongson resource[MAX_RESOURCE_NUMBER];
  120. /* arch specific additions */
  121. struct archdev_data archdata;
  122. };
  123. struct loongson_special_attribute {
  124. u16 vers; /* version of this special */
  125. char special_name[64]; /* special_atribute_name */
  126. u32 loongson_special_type; /* type of special device */
  127. /* for each device's resource */
  128. struct resource_loongson resource[MAX_RESOURCE_NUMBER];
  129. };
  130. struct loongson_params {
  131. u64 memory_offset; /* efi_memory_map_loongson struct offset */
  132. u64 cpu_offset; /* efi_cpuinfo_loongson struct offset */
  133. u64 system_offset; /* system_loongson struct offset */
  134. u64 irq_offset; /* irq_source_routing_table struct offset */
  135. u64 interface_offset; /* interface_info struct offset */
  136. u64 special_offset; /* loongson_special_attribute struct offset */
  137. u64 boarddev_table_offset; /* board_devices offset */
  138. };
  139. struct smbios_tables {
  140. u16 vers; /* version of smbios */
  141. u64 vga_bios; /* vga_bios address */
  142. struct loongson_params lp;
  143. };
  144. struct efi_reset_system_t {
  145. u64 ResetCold;
  146. u64 ResetWarm;
  147. u64 ResetType;
  148. u64 Shutdown;
  149. u64 DoSuspend; /* NULL if not support */
  150. };
  151. struct efi_loongson {
  152. u64 mps; /* MPS table */
  153. u64 acpi; /* ACPI table (IA64 ext 0.71) */
  154. u64 acpi20; /* ACPI table (ACPI 2.0) */
  155. struct smbios_tables smbios; /* SM BIOS table */
  156. u64 sal_systab; /* SAL system table */
  157. u64 boot_info; /* boot info table */
  158. };
  159. struct boot_params {
  160. struct efi_loongson efi;
  161. struct efi_reset_system_t reset_system;
  162. };
  163. struct loongson_system_configuration {
  164. u32 nr_cpus;
  165. u32 nr_nodes;
  166. int cores_per_node;
  167. int cores_per_package;
  168. u16 boot_cpu_id;
  169. u16 reserved_cpus_mask;
  170. enum loongson_cpu_type cputype;
  171. u64 ht_control_base;
  172. u64 pci_mem_start_addr;
  173. u64 pci_mem_end_addr;
  174. u64 pci_io_base;
  175. u64 restart_addr;
  176. u64 poweroff_addr;
  177. u64 suspend_addr;
  178. u64 vgabios_addr;
  179. u32 dma_mask_bits;
  180. char ecname[32];
  181. u32 nr_uarts;
  182. struct uart_device uarts[MAX_UARTS];
  183. u32 nr_sensors;
  184. struct sensor_device sensors[MAX_SENSORS];
  185. u64 workarounds;
  186. };
  187. extern struct efi_memory_map_loongson *loongson_memmap;
  188. extern struct loongson_system_configuration loongson_sysconf;
  189. #endif