boot_param.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. #ifndef __ASM_MACH_LOONGSON_BOOT_PARAM_H_
  2. #define __ASM_MACH_LOONGSON_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 MAX_MEMORY_TYPE 10
  13. #define LOONGSON3_BOOT_MEM_MAP_MAX 128
  14. struct efi_memory_map_loongson {
  15. u16 vers; /* version of efi_memory_map */
  16. u32 nr_map; /* number of memory_maps */
  17. u32 mem_freq; /* memory frequence */
  18. struct mem_map {
  19. u32 node_id; /* node_id which memory attached to */
  20. u32 mem_type; /* system memory, pci memory, pci io, etc. */
  21. u64 mem_start; /* memory map start address */
  22. u32 mem_size; /* each memory_map size, not the total size */
  23. } map[LOONGSON3_BOOT_MEM_MAP_MAX];
  24. } __packed;
  25. enum loongson_cpu_type {
  26. Loongson_2E = 0,
  27. Loongson_2F = 1,
  28. Loongson_3A = 2,
  29. Loongson_3B = 3,
  30. Loongson_1A = 4,
  31. Loongson_1B = 5
  32. };
  33. /*
  34. * Capability and feature descriptor structure for MIPS CPU
  35. */
  36. struct efi_cpuinfo_loongson {
  37. u16 vers; /* version of efi_cpuinfo_loongson */
  38. u32 processor_id; /* PRID, e.g. 6305, 6306 */
  39. u32 cputype; /* Loongson_3A/3B, etc. */
  40. u32 total_node; /* num of total numa nodes */
  41. u32 cpu_startup_core_id; /* Core id */
  42. u32 cpu_clock_freq; /* cpu_clock */
  43. u32 nr_cpus;
  44. } __packed;
  45. struct system_loongson {
  46. u16 vers; /* version of system_loongson */
  47. u32 ccnuma_smp; /* 0: no numa; 1: has numa */
  48. u32 sing_double_channel; /* 1:single; 2:double */
  49. } __packed;
  50. struct irq_source_routing_table {
  51. u16 vers;
  52. u16 size;
  53. u16 rtr_bus;
  54. u16 rtr_devfn;
  55. u32 vendor;
  56. u32 device;
  57. u32 PIC_type; /* conform use HT or PCI to route to CPU-PIC */
  58. u64 ht_int_bit; /* 3A: 1<<24; 3B: 1<<16 */
  59. u64 ht_enable; /* irqs used in this PIC */
  60. u32 node_id; /* node id: 0x0-0; 0x1-1; 0x10-2; 0x11-3 */
  61. u64 pci_mem_start_addr;
  62. u64 pci_mem_end_addr;
  63. u64 pci_io_start_addr;
  64. u64 pci_io_end_addr;
  65. u64 pci_config_addr;
  66. u32 dma_mask_bits;
  67. } __packed;
  68. struct interface_info {
  69. u16 vers; /* version of the specificition */
  70. u16 size;
  71. u8 flag;
  72. char description[64];
  73. } __packed;
  74. #define MAX_RESOURCE_NUMBER 128
  75. struct resource_loongson {
  76. u64 start; /* resource start address */
  77. u64 end; /* resource end address */
  78. char name[64];
  79. u32 flags;
  80. };
  81. struct archdev_data {}; /* arch specific additions */
  82. struct board_devices {
  83. char name[64]; /* hold the device name */
  84. u32 num_resources; /* number of device_resource */
  85. /* for each device's resource */
  86. struct resource_loongson resource[MAX_RESOURCE_NUMBER];
  87. /* arch specific additions */
  88. struct archdev_data archdata;
  89. };
  90. struct loongson_special_attribute {
  91. u16 vers; /* version of this special */
  92. char special_name[64]; /* special_atribute_name */
  93. u32 loongson_special_type; /* type of special device */
  94. /* for each device's resource */
  95. struct resource_loongson resource[MAX_RESOURCE_NUMBER];
  96. };
  97. struct loongson_params {
  98. u64 memory_offset; /* efi_memory_map_loongson struct offset */
  99. u64 cpu_offset; /* efi_cpuinfo_loongson struct offset */
  100. u64 system_offset; /* system_loongson struct offset */
  101. u64 irq_offset; /* irq_source_routing_table struct offset */
  102. u64 interface_offset; /* interface_info struct offset */
  103. u64 special_offset; /* loongson_special_attribute struct offset */
  104. u64 boarddev_table_offset; /* board_devices offset */
  105. };
  106. struct smbios_tables {
  107. u16 vers; /* version of smbios */
  108. u64 vga_bios; /* vga_bios address */
  109. struct loongson_params lp;
  110. };
  111. struct efi_reset_system_t {
  112. u64 ResetCold;
  113. u64 ResetWarm;
  114. u64 ResetType;
  115. u64 Shutdown;
  116. u64 DoSuspend; /* NULL if not support */
  117. };
  118. struct efi_loongson {
  119. u64 mps; /* MPS table */
  120. u64 acpi; /* ACPI table (IA64 ext 0.71) */
  121. u64 acpi20; /* ACPI table (ACPI 2.0) */
  122. struct smbios_tables smbios; /* SM BIOS table */
  123. u64 sal_systab; /* SAL system table */
  124. u64 boot_info; /* boot info table */
  125. };
  126. struct boot_params {
  127. struct efi_loongson efi;
  128. struct efi_reset_system_t reset_system;
  129. };
  130. struct loongson_system_configuration {
  131. u32 nr_cpus;
  132. u32 nr_nodes;
  133. int cores_per_node;
  134. int cores_per_package;
  135. enum loongson_cpu_type cputype;
  136. u64 ht_control_base;
  137. u64 pci_mem_start_addr;
  138. u64 pci_mem_end_addr;
  139. u64 pci_io_base;
  140. u64 restart_addr;
  141. u64 poweroff_addr;
  142. u64 suspend_addr;
  143. u64 vgabios_addr;
  144. u32 dma_mask_bits;
  145. };
  146. extern struct efi_memory_map_loongson *loongson_memmap;
  147. extern struct loongson_system_configuration loongson_sysconf;
  148. extern int cpuhotplug_workaround;
  149. #endif