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