1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_MACH_LOONGSON64_BOOT_PARAM_H_
3 #define __ASM_MACH_LOONGSON64_BOOT_PARAM_H_
5 #include <linux/types.h>
7 #define SYSTEM_RAM_LOW 1
8 #define SYSTEM_RAM_HIGH 2
9 #define SYSTEM_RAM_RESERVED 3
12 #define LOONGSON_CFG_REG 6
16 #define SMBIOS_TABLE 10
17 #define UMA_VIDEO_RAM 11
18 #define VUMA_VIDEO_RAM 12
19 #define MAX_MEMORY_TYPE 13
21 #define MEM_SIZE_IS_IN_BYTES (1 << 31)
23 #define LOONGSON3_BOOT_MEM_MAP_MAX 128
24 struct efi_memory_map_loongson {
25 u16 vers; /* version of efi_memory_map */
26 u32 nr_map; /* number of memory_maps */
27 u32 mem_freq; /* memory frequence */
29 u32 node_id; /* node_id which memory attached to */
30 u32 mem_type; /* system memory, pci memory, pci io, etc. */
31 u64 mem_start; /* memory map start address */
32 u32 mem_size; /* each memory_map size, not the total size */
33 } map[LOONGSON3_BOOT_MEM_MAP_MAX];
36 enum loongson_cpu_type {
56 * Capability and feature descriptor structure for MIPS CPU
58 struct efi_cpuinfo_loongson {
59 u16 vers; /* version of efi_cpuinfo_loongson */
60 u32 processor_id; /* PRID, e.g. 6305, 6306 */
61 u32 cputype; /* Loongson_3A/3B, etc. */
62 u32 total_node; /* num of total numa nodes */
63 u16 cpu_startup_core_id; /* Boot core id */
64 u16 reserved_cores_mask;
65 u32 cpu_clock_freq; /* cpu_clock */
71 u32 iotype; /* see include/linux/serial_core.h */
77 #define MAX_SENSORS 64
78 #define SENSOR_TEMPER 0x00000001
79 #define SENSOR_VOLTAGE 0x00000002
80 #define SENSOR_FAN 0x00000004
81 struct sensor_device {
82 char name[32]; /* a formal name */
83 char label[64]; /* a flexible description */
84 u32 type; /* SENSOR_* */
85 u32 id; /* instance id of a sensor-class */
86 u32 fan_policy; /* see loongson_hwmon.h */
87 u32 fan_percent;/* only for constant speed policy */
88 u64 base_addr; /* base address of device registers */
91 struct system_loongson {
92 u16 vers; /* version of system_loongson */
93 u32 ccnuma_smp; /* 0: no numa; 1: has numa */
94 u32 sing_double_channel; /* 1:single; 2:double */
96 struct uart_device uarts[MAX_UARTS];
98 struct sensor_device sensors[MAX_SENSORS];
105 u64 workarounds; /* see workarounds.h */
108 struct irq_source_routing_table {
115 u32 PIC_type; /* conform use HT or PCI to route to CPU-PIC */
116 u64 ht_int_bit; /* 3A: 1<<24; 3B: 1<<16 */
117 u64 ht_enable; /* irqs used in this PIC */
118 u32 node_id; /* node id: 0x0-0; 0x1-1; 0x10-2; 0x11-3 */
119 u64 pci_mem_start_addr;
120 u64 pci_mem_end_addr;
121 u64 pci_io_start_addr;
128 struct interface_info {
129 u16 vers; /* version of the specificition */
132 char description[64];
135 #define MAX_RESOURCE_NUMBER 128
136 struct resource_loongson {
137 u64 start; /* resource start address */
138 u64 end; /* resource end address */
143 struct archdev_data {}; /* arch specific additions */
145 struct board_devices {
146 char name[64]; /* hold the device name */
147 u32 num_resources; /* number of device_resource */
148 /* for each device's resource */
149 struct resource_loongson resource[MAX_RESOURCE_NUMBER];
150 /* arch specific additions */
151 struct archdev_data archdata;
154 struct loongson_special_attribute {
155 u16 vers; /* version of this special */
156 char special_name[64]; /* special_atribute_name */
157 u32 loongson_special_type; /* type of special device */
158 /* for each device's resource */
159 struct resource_loongson resource[MAX_RESOURCE_NUMBER];
162 struct loongson_params {
163 u64 memory_offset; /* efi_memory_map_loongson struct offset */
164 u64 cpu_offset; /* efi_cpuinfo_loongson struct offset */
165 u64 system_offset; /* system_loongson struct offset */
166 u64 irq_offset; /* irq_source_routing_table struct offset */
167 u64 interface_offset; /* interface_info struct offset */
168 u64 special_offset; /* loongson_special_attribute struct offset */
169 u64 boarddev_table_offset; /* board_devices offset */
172 struct smbios_tables {
173 u16 vers; /* version of smbios */
174 u64 vga_bios; /* vga_bios address */
175 struct loongson_params lp;
178 struct efi_reset_system_t {
183 u64 DoSuspend; /* NULL if not support */
186 struct efi_loongson {
187 u64 mps; /* MPS table */
188 u64 acpi; /* ACPI table (IA64 ext 0.71) */
189 u64 acpi20; /* ACPI table (ACPI 2.0) */
190 struct smbios_tables smbios; /* SM BIOS table */
191 u64 sal_systab; /* SAL system table */
192 u64 boot_info; /* boot info table */
196 struct efi_loongson efi;
197 struct efi_reset_system_t reset_system;
200 enum loongson_bridge_type {
206 extern struct efi_memory_map_loongson *loongson_memmap;
207 extern struct loongson_system_configuration loongson_sysconf;
209 extern struct board_devices *eboard;
210 extern struct interface_info *einter;
211 extern struct loongson_special_attribute *especial;
213 extern u32 node_id_offset;
214 extern void ls7a_early_config(void);
215 extern void rs780e_early_config(void);
216 extern void virtual_early_config(void);