1
2#ifndef __ASM_MACH_LOONGSON64_BOOT_PARAM_H_
3#define __ASM_MACH_LOONGSON64_BOOT_PARAM_H_
4
5#define SYSTEM_RAM_LOW 1
6#define SYSTEM_RAM_HIGH 2
7#define SYSTEM_RAM_RESERVED 3
8#define PCI_IO 4
9#define PCI_MEM 5
10#define LOONGSON_CFG_REG 6
11#define VIDEO_ROM 7
12#define ADAPTER_ROM 8
13#define ACPI_TABLE 9
14#define SMBIOS_TABLE 10
15#define MAX_MEMORY_TYPE 11
16
17#define LOONGSON3_BOOT_MEM_MAP_MAX 128
18struct efi_memory_map_loongson {
19 u16 vers;
20 u32 nr_map;
21 u32 mem_freq;
22 struct mem_map {
23 u32 node_id;
24 u32 mem_type;
25 u64 mem_start;
26 u32 mem_size;
27 } map[LOONGSON3_BOOT_MEM_MAP_MAX];
28} __packed;
29
30enum loongson_cpu_type {
31 Legacy_2E = 0x0,
32 Legacy_2F = 0x1,
33 Legacy_3A = 0x2,
34 Legacy_3B = 0x3,
35 Legacy_1A = 0x4,
36 Legacy_1B = 0x5,
37 Legacy_2G = 0x6,
38 Legacy_2H = 0x7,
39 Loongson_1A = 0x100,
40 Loongson_1B = 0x101,
41 Loongson_2E = 0x200,
42 Loongson_2F = 0x201,
43 Loongson_2G = 0x202,
44 Loongson_2H = 0x203,
45 Loongson_3A = 0x300,
46 Loongson_3B = 0x301
47};
48
49
50
51
52struct efi_cpuinfo_loongson {
53 u16 vers;
54 u32 processor_id;
55 u32 cputype;
56 u32 total_node;
57 u16 cpu_startup_core_id;
58 u16 reserved_cores_mask;
59 u32 cpu_clock_freq;
60 u32 nr_cpus;
61} __packed;
62
63#define MAX_UARTS 64
64struct uart_device {
65 u32 iotype;
66 u32 uartclk;
67 u32 int_offset;
68 u64 uart_base;
69} __packed;
70
71#define MAX_SENSORS 64
72#define SENSOR_TEMPER 0x00000001
73#define SENSOR_VOLTAGE 0x00000002
74#define SENSOR_FAN 0x00000004
75struct sensor_device {
76 char name[32];
77 char label[64];
78 u32 type;
79 u32 id;
80 u32 fan_policy;
81 u32 fan_percent;
82 u64 base_addr;
83} __packed;
84
85struct system_loongson {
86 u16 vers;
87 u32 ccnuma_smp;
88 u32 sing_double_channel;
89 u32 nr_uarts;
90 struct uart_device uarts[MAX_UARTS];
91 u32 nr_sensors;
92 struct sensor_device sensors[MAX_SENSORS];
93 char has_ec;
94 char ec_name[32];
95 u64 ec_base_addr;
96 char has_tcm;
97 char tcm_name[32];
98 u64 tcm_base_addr;
99 u64 workarounds;
100} __packed;
101
102struct irq_source_routing_table {
103 u16 vers;
104 u16 size;
105 u16 rtr_bus;
106 u16 rtr_devfn;
107 u32 vendor;
108 u32 device;
109 u32 PIC_type;
110 u64 ht_int_bit;
111 u64 ht_enable;
112 u32 node_id;
113 u64 pci_mem_start_addr;
114 u64 pci_mem_end_addr;
115 u64 pci_io_start_addr;
116 u64 pci_io_end_addr;
117 u64 pci_config_addr;
118 u32 dma_mask_bits;
119} __packed;
120
121struct interface_info {
122 u16 vers;
123 u16 size;
124 u8 flag;
125 char description[64];
126} __packed;
127
128#define MAX_RESOURCE_NUMBER 128
129struct resource_loongson {
130 u64 start;
131 u64 end;
132 char name[64];
133 u32 flags;
134};
135
136struct archdev_data {};
137
138struct board_devices {
139 char name[64];
140 u32 num_resources;
141
142 struct resource_loongson resource[MAX_RESOURCE_NUMBER];
143
144 struct archdev_data archdata;
145};
146
147struct loongson_special_attribute {
148 u16 vers;
149 char special_name[64];
150 u32 loongson_special_type;
151
152 struct resource_loongson resource[MAX_RESOURCE_NUMBER];
153};
154
155struct loongson_params {
156 u64 memory_offset;
157 u64 cpu_offset;
158 u64 system_offset;
159 u64 irq_offset;
160 u64 interface_offset;
161 u64 special_offset;
162 u64 boarddev_table_offset;
163};
164
165struct smbios_tables {
166 u16 vers;
167 u64 vga_bios;
168 struct loongson_params lp;
169};
170
171struct efi_reset_system_t {
172 u64 ResetCold;
173 u64 ResetWarm;
174 u64 ResetType;
175 u64 Shutdown;
176 u64 DoSuspend;
177};
178
179struct efi_loongson {
180 u64 mps;
181 u64 acpi;
182 u64 acpi20;
183 struct smbios_tables smbios;
184 u64 sal_systab;
185 u64 boot_info;
186};
187
188struct boot_params {
189 struct efi_loongson efi;
190 struct efi_reset_system_t reset_system;
191};
192
193struct loongson_system_configuration {
194 u32 nr_cpus;
195 u32 nr_nodes;
196 int cores_per_node;
197 int cores_per_package;
198 u16 boot_cpu_id;
199 u16 reserved_cpus_mask;
200 enum loongson_cpu_type cputype;
201 u64 ht_control_base;
202 u64 pci_mem_start_addr;
203 u64 pci_mem_end_addr;
204 u64 pci_io_base;
205 u64 restart_addr;
206 u64 poweroff_addr;
207 u64 suspend_addr;
208 u64 vgabios_addr;
209 u32 dma_mask_bits;
210 char ecname[32];
211 u32 nr_uarts;
212 struct uart_device uarts[MAX_UARTS];
213 u32 nr_sensors;
214 struct sensor_device sensors[MAX_SENSORS];
215 u64 workarounds;
216};
217
218extern struct efi_memory_map_loongson *loongson_memmap;
219extern struct loongson_system_configuration loongson_sysconf;
220
221#endif
222