1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_MACH_LOONGSON64_BOOT_PARAM_H_
3 #define __ASM_MACH_LOONGSON64_BOOT_PARAM_H_
5 #define SYSTEM_RAM_LOW 1
6 #define SYSTEM_RAM_HIGH 2
7 #define SYSTEM_RAM_RESERVED 3
10 #define LOONGSON_CFG_REG 6
14 #define SMBIOS_TABLE 10
15 #define MAX_MEMORY_TYPE 11
17 #define LOONGSON3_BOOT_MEM_MAP_MAX 128
18 struct efi_memory_map_loongson {
19 u16 vers; /* version of efi_memory_map */
20 u32 nr_map; /* number of memory_maps */
21 u32 mem_freq; /* memory frequence */
23 u32 node_id; /* node_id which memory attached to */
24 u32 mem_type; /* system memory, pci memory, pci io, etc. */
25 u64 mem_start; /* memory map start address */
26 u32 mem_size; /* each memory_map size, not the total size */
27 } map[LOONGSON3_BOOT_MEM_MAP_MAX];
30 enum loongson_cpu_type {
50 * Capability and feature descriptor structure for MIPS CPU
52 struct efi_cpuinfo_loongson {
53 u16 vers; /* version of efi_cpuinfo_loongson */
54 u32 processor_id; /* PRID, e.g. 6305, 6306 */
55 u32 cputype; /* Loongson_3A/3B, etc. */
56 u32 total_node; /* num of total numa nodes */
57 u16 cpu_startup_core_id; /* Boot core id */
58 u16 reserved_cores_mask;
59 u32 cpu_clock_freq; /* cpu_clock */
65 u32 iotype; /* see include/linux/serial_core.h */
71 #define MAX_SENSORS 64
72 #define SENSOR_TEMPER 0x00000001
73 #define SENSOR_VOLTAGE 0x00000002
74 #define SENSOR_FAN 0x00000004
75 struct sensor_device {
76 char name[32]; /* a formal name */
77 char label[64]; /* a flexible description */
78 u32 type; /* SENSOR_* */
79 u32 id; /* instance id of a sensor-class */
80 u32 fan_policy; /* see loongson_hwmon.h */
81 u32 fan_percent;/* only for constant speed policy */
82 u64 base_addr; /* base address of device registers */
85 struct system_loongson {
86 u16 vers; /* version of system_loongson */
87 u32 ccnuma_smp; /* 0: no numa; 1: has numa */
88 u32 sing_double_channel; /* 1:single; 2:double */
90 struct uart_device uarts[MAX_UARTS];
92 struct sensor_device sensors[MAX_SENSORS];
99 u64 workarounds; /* see workarounds.h */
102 struct irq_source_routing_table {
109 u32 PIC_type; /* conform use HT or PCI to route to CPU-PIC */
110 u64 ht_int_bit; /* 3A: 1<<24; 3B: 1<<16 */
111 u64 ht_enable; /* irqs used in this PIC */
112 u32 node_id; /* node id: 0x0-0; 0x1-1; 0x10-2; 0x11-3 */
113 u64 pci_mem_start_addr;
114 u64 pci_mem_end_addr;
115 u64 pci_io_start_addr;
121 struct interface_info {
122 u16 vers; /* version of the specificition */
125 char description[64];
128 #define MAX_RESOURCE_NUMBER 128
129 struct resource_loongson {
130 u64 start; /* resource start address */
131 u64 end; /* resource end address */
136 struct archdev_data {}; /* arch specific additions */
138 struct board_devices {
139 char name[64]; /* hold the device name */
140 u32 num_resources; /* number of device_resource */
141 /* for each device's resource */
142 struct resource_loongson resource[MAX_RESOURCE_NUMBER];
143 /* arch specific additions */
144 struct archdev_data archdata;
147 struct loongson_special_attribute {
148 u16 vers; /* version of this special */
149 char special_name[64]; /* special_atribute_name */
150 u32 loongson_special_type; /* type of special device */
151 /* for each device's resource */
152 struct resource_loongson resource[MAX_RESOURCE_NUMBER];
155 struct loongson_params {
156 u64 memory_offset; /* efi_memory_map_loongson struct offset */
157 u64 cpu_offset; /* efi_cpuinfo_loongson struct offset */
158 u64 system_offset; /* system_loongson struct offset */
159 u64 irq_offset; /* irq_source_routing_table struct offset */
160 u64 interface_offset; /* interface_info struct offset */
161 u64 special_offset; /* loongson_special_attribute struct offset */
162 u64 boarddev_table_offset; /* board_devices offset */
165 struct smbios_tables {
166 u16 vers; /* version of smbios */
167 u64 vga_bios; /* vga_bios address */
168 struct loongson_params lp;
171 struct efi_reset_system_t {
176 u64 DoSuspend; /* NULL if not support */
179 struct efi_loongson {
180 u64 mps; /* MPS table */
181 u64 acpi; /* ACPI table (IA64 ext 0.71) */
182 u64 acpi20; /* ACPI table (ACPI 2.0) */
183 struct smbios_tables smbios; /* SM BIOS table */
184 u64 sal_systab; /* SAL system table */
185 u64 boot_info; /* boot info table */
189 struct efi_loongson efi;
190 struct efi_reset_system_t reset_system;
193 struct loongson_system_configuration {
197 int cores_per_package;
199 u16 reserved_cpus_mask;
200 enum loongson_cpu_type cputype;
202 u64 pci_mem_start_addr;
203 u64 pci_mem_end_addr;
212 struct uart_device uarts[MAX_UARTS];
214 struct sensor_device sensors[MAX_SENSORS];
218 extern struct efi_memory_map_loongson *loongson_memmap;
219 extern struct loongson_system_configuration loongson_sysconf;