Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ASM_MACH_LOONGSON64_BOOT_PARAM_H_
0003 #define __ASM_MACH_LOONGSON64_BOOT_PARAM_H_
0004 
0005 #include <linux/types.h>
0006 
0007 #define SYSTEM_RAM_LOW      1
0008 #define SYSTEM_RAM_HIGH     2
0009 #define SYSTEM_RAM_RESERVED 3
0010 #define PCI_IO          4
0011 #define PCI_MEM         5
0012 #define LOONGSON_CFG_REG    6
0013 #define VIDEO_ROM       7
0014 #define ADAPTER_ROM     8
0015 #define ACPI_TABLE      9
0016 #define SMBIOS_TABLE        10
0017 #define MAX_MEMORY_TYPE     11
0018 
0019 #define LOONGSON3_BOOT_MEM_MAP_MAX 128
0020 struct efi_memory_map_loongson {
0021     u16 vers;   /* version of efi_memory_map */
0022     u32 nr_map; /* number of memory_maps */
0023     u32 mem_freq;   /* memory frequence */
0024     struct mem_map {
0025         u32 node_id;    /* node_id which memory attached to */
0026         u32 mem_type;   /* system memory, pci memory, pci io, etc. */
0027         u64 mem_start;  /* memory map start address */
0028         u32 mem_size;   /* each memory_map size, not the total size */
0029     } map[LOONGSON3_BOOT_MEM_MAP_MAX];
0030 } __packed;
0031 
0032 enum loongson_cpu_type {
0033     Legacy_2E = 0x0,
0034     Legacy_2F = 0x1,
0035     Legacy_3A = 0x2,
0036     Legacy_3B = 0x3,
0037     Legacy_1A = 0x4,
0038     Legacy_1B = 0x5,
0039     Legacy_2G = 0x6,
0040     Legacy_2H = 0x7,
0041     Loongson_1A = 0x100,
0042     Loongson_1B = 0x101,
0043     Loongson_2E = 0x200,
0044     Loongson_2F = 0x201,
0045     Loongson_2G = 0x202,
0046     Loongson_2H = 0x203,
0047     Loongson_3A = 0x300,
0048     Loongson_3B = 0x301
0049 };
0050 
0051 /*
0052  * Capability and feature descriptor structure for MIPS CPU
0053  */
0054 struct efi_cpuinfo_loongson {
0055     u16 vers;     /* version of efi_cpuinfo_loongson */
0056     u32 processor_id; /* PRID, e.g. 6305, 6306 */
0057     u32 cputype;  /* Loongson_3A/3B, etc. */
0058     u32 total_node;   /* num of total numa nodes */
0059     u16 cpu_startup_core_id; /* Boot core id */
0060     u16 reserved_cores_mask;
0061     u32 cpu_clock_freq; /* cpu_clock */
0062     u32 nr_cpus;
0063 } __packed;
0064 
0065 #define MAX_UARTS 64
0066 struct uart_device {
0067     u32 iotype; /* see include/linux/serial_core.h */
0068     u32 uartclk;
0069     u32 int_offset;
0070     u64 uart_base;
0071 } __packed;
0072 
0073 #define MAX_SENSORS 64
0074 #define SENSOR_TEMPER  0x00000001
0075 #define SENSOR_VOLTAGE 0x00000002
0076 #define SENSOR_FAN     0x00000004
0077 struct sensor_device {
0078     char name[32];  /* a formal name */
0079     char label[64]; /* a flexible description */
0080     u32 type;       /* SENSOR_* */
0081     u32 id;         /* instance id of a sensor-class */
0082     u32 fan_policy; /* see loongson_hwmon.h */
0083     u32 fan_percent;/* only for constant speed policy */
0084     u64 base_addr;  /* base address of device registers */
0085 } __packed;
0086 
0087 struct system_loongson {
0088     u16 vers;     /* version of system_loongson */
0089     u32 ccnuma_smp; /* 0: no numa; 1: has numa */
0090     u32 sing_double_channel; /* 1:single; 2:double */
0091     u32 nr_uarts;
0092     struct uart_device uarts[MAX_UARTS];
0093     u32 nr_sensors;
0094     struct sensor_device sensors[MAX_SENSORS];
0095     char has_ec;
0096     char ec_name[32];
0097     u64 ec_base_addr;
0098     char has_tcm;
0099     char tcm_name[32];
0100     u64 tcm_base_addr;
0101     u64 workarounds; /* see workarounds.h */
0102 } __packed;
0103 
0104 struct irq_source_routing_table {
0105     u16 vers;
0106     u16 size;
0107     u16 rtr_bus;
0108     u16 rtr_devfn;
0109     u32 vendor;
0110     u32 device;
0111     u32 PIC_type;   /* conform use HT or PCI to route to CPU-PIC */
0112     u64 ht_int_bit; /* 3A: 1<<24; 3B: 1<<16 */
0113     u64 ht_enable;  /* irqs used in this PIC */
0114     u32 node_id;    /* node id: 0x0-0; 0x1-1; 0x10-2; 0x11-3 */
0115     u64 pci_mem_start_addr;
0116     u64 pci_mem_end_addr;
0117     u64 pci_io_start_addr;
0118     u64 pci_io_end_addr;
0119     u64 pci_config_addr;
0120     u32 dma_mask_bits;
0121 } __packed;
0122 
0123 struct interface_info {
0124     u16 vers; /* version of the specificition */
0125     u16 size;
0126     u8  flag;
0127     char description[64];
0128 } __packed;
0129 
0130 #define MAX_RESOURCE_NUMBER 128
0131 struct resource_loongson {
0132     u64 start; /* resource start address */
0133     u64 end;   /* resource end address */
0134     char name[64];
0135     u32 flags;
0136 };
0137 
0138 struct archdev_data {};  /* arch specific additions */
0139 
0140 struct board_devices {
0141     char name[64];    /* hold the device name */
0142     u32 num_resources; /* number of device_resource */
0143     /* for each device's resource */
0144     struct resource_loongson resource[MAX_RESOURCE_NUMBER];
0145     /* arch specific additions */
0146     struct archdev_data archdata;
0147 };
0148 
0149 struct loongson_special_attribute {
0150     u16 vers;     /* version of this special */
0151     char special_name[64]; /* special_atribute_name */
0152     u32 loongson_special_type; /* type of special device */
0153     /* for each device's resource */
0154     struct resource_loongson resource[MAX_RESOURCE_NUMBER];
0155 };
0156 
0157 struct loongson_params {
0158     u64 memory_offset;  /* efi_memory_map_loongson struct offset */
0159     u64 cpu_offset;     /* efi_cpuinfo_loongson struct offset */
0160     u64 system_offset;  /* system_loongson struct offset */
0161     u64 irq_offset;     /* irq_source_routing_table struct offset */
0162     u64 interface_offset;   /* interface_info struct offset */
0163     u64 special_offset; /* loongson_special_attribute struct offset */
0164     u64 boarddev_table_offset;  /* board_devices offset */
0165 };
0166 
0167 struct smbios_tables {
0168     u16 vers;     /* version of smbios */
0169     u64 vga_bios; /* vga_bios address */
0170     struct loongson_params lp;
0171 };
0172 
0173 struct efi_reset_system_t {
0174     u64 ResetCold;
0175     u64 ResetWarm;
0176     u64 ResetType;
0177     u64 Shutdown;
0178     u64 DoSuspend; /* NULL if not support */
0179 };
0180 
0181 struct efi_loongson {
0182     u64 mps;    /* MPS table */
0183     u64 acpi;   /* ACPI table (IA64 ext 0.71) */
0184     u64 acpi20; /* ACPI table (ACPI 2.0) */
0185     struct smbios_tables smbios;    /* SM BIOS table */
0186     u64 sal_systab; /* SAL system table */
0187     u64 boot_info;  /* boot info table */
0188 };
0189 
0190 struct boot_params {
0191     struct efi_loongson efi;
0192     struct efi_reset_system_t reset_system;
0193 };
0194 
0195 enum loongson_bridge_type {
0196     LS7A = 1,
0197     RS780E = 2,
0198     VIRTUAL = 3
0199 };
0200 
0201 extern struct efi_memory_map_loongson *loongson_memmap;
0202 extern struct loongson_system_configuration loongson_sysconf;
0203 
0204 extern struct board_devices *eboard;
0205 extern struct interface_info *einter;
0206 extern struct loongson_special_attribute *especial;
0207 
0208 extern u32 node_id_offset;
0209 extern void ls7a_early_config(void);
0210 extern void rs780e_early_config(void);
0211 extern void virtual_early_config(void);
0212 
0213 #endif