1 #ifndef __ASM_MACH_LOONGSON64_BOOT_PARAM_H_ 2 #define __ASM_MACH_LOONGSON64_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 SMBIOS_TABLE 10 14 #define MAX_MEMORY_TYPE 11 15 16 #define LOONGSON3_BOOT_MEM_MAP_MAX 128 17 struct efi_memory_map_loongson { 18 u16 vers; /* version of efi_memory_map */ 19 u32 nr_map; /* number of memory_maps */ 20 u32 mem_freq; /* memory frequence */ 21 struct mem_map { 22 u32 node_id; /* node_id which memory attached to */ 23 u32 mem_type; /* system memory, pci memory, pci io, etc. */ 24 u64 mem_start; /* memory map start address */ 25 u32 mem_size; /* each memory_map size, not the total size */ 26 } map[LOONGSON3_BOOT_MEM_MAP_MAX]; 27 } __packed; 28 29 enum loongson_cpu_type { 30 Legacy_2E = 0x0, 31 Legacy_2F = 0x1, 32 Legacy_3A = 0x2, 33 Legacy_3B = 0x3, 34 Legacy_1A = 0x4, 35 Legacy_1B = 0x5, 36 Legacy_2G = 0x6, 37 Legacy_2H = 0x7, 38 Loongson_1A = 0x100, 39 Loongson_1B = 0x101, 40 Loongson_2E = 0x200, 41 Loongson_2F = 0x201, 42 Loongson_2G = 0x202, 43 Loongson_2H = 0x203, 44 Loongson_3A = 0x300, 45 Loongson_3B = 0x301 46 }; 47 48 /* 49 * Capability and feature descriptor structure for MIPS CPU 50 */ 51 struct efi_cpuinfo_loongson { 52 u16 vers; /* version of efi_cpuinfo_loongson */ 53 u32 processor_id; /* PRID, e.g. 6305, 6306 */ 54 u32 cputype; /* Loongson_3A/3B, etc. */ 55 u32 total_node; /* num of total numa nodes */ 56 u16 cpu_startup_core_id; /* Boot core id */ 57 u16 reserved_cores_mask; 58 u32 cpu_clock_freq; /* cpu_clock */ 59 u32 nr_cpus; 60 } __packed; 61 62 #define MAX_UARTS 64 63 struct uart_device { 64 u32 iotype; /* see include/linux/serial_core.h */ 65 u32 uartclk; 66 u32 int_offset; 67 u64 uart_base; 68 } __packed; 69 70 #define MAX_SENSORS 64 71 #define SENSOR_TEMPER 0x00000001 72 #define SENSOR_VOLTAGE 0x00000002 73 #define SENSOR_FAN 0x00000004 74 struct sensor_device { 75 char name[32]; /* a formal name */ 76 char label[64]; /* a flexible description */ 77 u32 type; /* SENSOR_* */ 78 u32 id; /* instance id of a sensor-class */ 79 u32 fan_policy; /* see loongson_hwmon.h */ 80 u32 fan_percent;/* only for constant speed policy */ 81 u64 base_addr; /* base address of device registers */ 82 } __packed; 83 84 struct system_loongson { 85 u16 vers; /* version of system_loongson */ 86 u32 ccnuma_smp; /* 0: no numa; 1: has numa */ 87 u32 sing_double_channel; /* 1:single; 2:double */ 88 u32 nr_uarts; 89 struct uart_device uarts[MAX_UARTS]; 90 u32 nr_sensors; 91 struct sensor_device sensors[MAX_SENSORS]; 92 char has_ec; 93 char ec_name[32]; 94 u64 ec_base_addr; 95 char has_tcm; 96 char tcm_name[32]; 97 u64 tcm_base_addr; 98 u64 workarounds; /* see workarounds.h */ 99 } __packed; 100 101 struct irq_source_routing_table { 102 u16 vers; 103 u16 size; 104 u16 rtr_bus; 105 u16 rtr_devfn; 106 u32 vendor; 107 u32 device; 108 u32 PIC_type; /* conform use HT or PCI to route to CPU-PIC */ 109 u64 ht_int_bit; /* 3A: 1<<24; 3B: 1<<16 */ 110 u64 ht_enable; /* irqs used in this PIC */ 111 u32 node_id; /* node id: 0x0-0; 0x1-1; 0x10-2; 0x11-3 */ 112 u64 pci_mem_start_addr; 113 u64 pci_mem_end_addr; 114 u64 pci_io_start_addr; 115 u64 pci_io_end_addr; 116 u64 pci_config_addr; 117 u32 dma_mask_bits; 118 } __packed; 119 120 struct interface_info { 121 u16 vers; /* version of the specificition */ 122 u16 size; 123 u8 flag; 124 char description[64]; 125 } __packed; 126 127 #define MAX_RESOURCE_NUMBER 128 128 struct resource_loongson { 129 u64 start; /* resource start address */ 130 u64 end; /* resource end address */ 131 char name[64]; 132 u32 flags; 133 }; 134 135 struct archdev_data {}; /* arch specific additions */ 136 137 struct board_devices { 138 char name[64]; /* hold the device name */ 139 u32 num_resources; /* number of device_resource */ 140 /* for each device's resource */ 141 struct resource_loongson resource[MAX_RESOURCE_NUMBER]; 142 /* arch specific additions */ 143 struct archdev_data archdata; 144 }; 145 146 struct loongson_special_attribute { 147 u16 vers; /* version of this special */ 148 char special_name[64]; /* special_atribute_name */ 149 u32 loongson_special_type; /* type of special device */ 150 /* for each device's resource */ 151 struct resource_loongson resource[MAX_RESOURCE_NUMBER]; 152 }; 153 154 struct loongson_params { 155 u64 memory_offset; /* efi_memory_map_loongson struct offset */ 156 u64 cpu_offset; /* efi_cpuinfo_loongson struct offset */ 157 u64 system_offset; /* system_loongson struct offset */ 158 u64 irq_offset; /* irq_source_routing_table struct offset */ 159 u64 interface_offset; /* interface_info struct offset */ 160 u64 special_offset; /* loongson_special_attribute struct offset */ 161 u64 boarddev_table_offset; /* board_devices offset */ 162 }; 163 164 struct smbios_tables { 165 u16 vers; /* version of smbios */ 166 u64 vga_bios; /* vga_bios address */ 167 struct loongson_params lp; 168 }; 169 170 struct efi_reset_system_t { 171 u64 ResetCold; 172 u64 ResetWarm; 173 u64 ResetType; 174 u64 Shutdown; 175 u64 DoSuspend; /* NULL if not support */ 176 }; 177 178 struct efi_loongson { 179 u64 mps; /* MPS table */ 180 u64 acpi; /* ACPI table (IA64 ext 0.71) */ 181 u64 acpi20; /* ACPI table (ACPI 2.0) */ 182 struct smbios_tables smbios; /* SM BIOS table */ 183 u64 sal_systab; /* SAL system table */ 184 u64 boot_info; /* boot info table */ 185 }; 186 187 struct boot_params { 188 struct efi_loongson efi; 189 struct efi_reset_system_t reset_system; 190 }; 191 192 struct loongson_system_configuration { 193 u32 nr_cpus; 194 u32 nr_nodes; 195 int cores_per_node; 196 int cores_per_package; 197 u16 boot_cpu_id; 198 u16 reserved_cpus_mask; 199 enum loongson_cpu_type cputype; 200 u64 ht_control_base; 201 u64 pci_mem_start_addr; 202 u64 pci_mem_end_addr; 203 u64 pci_io_base; 204 u64 restart_addr; 205 u64 poweroff_addr; 206 u64 suspend_addr; 207 u64 vgabios_addr; 208 u32 dma_mask_bits; 209 char ecname[32]; 210 u32 nr_uarts; 211 struct uart_device uarts[MAX_UARTS]; 212 u32 nr_sensors; 213 struct sensor_device sensors[MAX_SENSORS]; 214 u64 workarounds; 215 }; 216 217 extern struct efi_memory_map_loongson *loongson_memmap; 218 extern struct loongson_system_configuration loongson_sysconf; 219 220 #endif 221