1 // SPDX-License-Identifier: GPL-2.0
3 * Author: Huacai Chen <chenhuacai@loongson.cn>
5 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
7 #include <linux/acpi.h>
9 #include <linux/export.h>
10 #include <linux/memblock.h>
11 #include <asm/early_ioremap.h>
12 #include <asm/bootinfo.h>
13 #include <asm/loongson.h>
14 #include <asm/setup.h>
17 struct loongson_system_configuration loongson_sysconf;
18 EXPORT_SYMBOL(loongson_sysconf);
20 void __init init_environ(void)
22 int efi_boot = fw_arg0;
23 char *cmdline = early_memremap_ro(fw_arg1, COMMAND_LINE_SIZE);
26 set_bit(EFI_BOOT, &efi.flags);
28 clear_bit(EFI_BOOT, &efi.flags);
30 strscpy(boot_command_line, cmdline, COMMAND_LINE_SIZE);
31 strscpy(init_command_line, cmdline, COMMAND_LINE_SIZE);
32 early_memunmap(cmdline, COMMAND_LINE_SIZE);
34 efi_system_table = fw_arg2;
37 static int __init init_cpu_fullname(void)
41 if (loongson_sysconf.cpuname && !strncmp(loongson_sysconf.cpuname, "Loongson", 8)) {
42 for (cpu = 0; cpu < NR_CPUS; cpu++)
43 __cpu_full_name[cpu] = loongson_sysconf.cpuname;
47 arch_initcall(init_cpu_fullname);
49 static ssize_t boardinfo_show(struct kobject *kobj,
50 struct kobj_attribute *attr, char *buf)
56 "ROM Size\t\t: %d KB\n"
57 "Release Date\t\t: %s\n\n"
59 "Manufacturer\t\t: %s\n"
60 "Board Name\t\t: %s\n"
61 "Family\t\t\t: LOONGSON64\n\n",
62 b_info.bios_vendor, b_info.bios_version,
63 b_info.bios_size, b_info.bios_release_date,
64 b_info.board_vendor, b_info.board_name);
67 static struct kobj_attribute boardinfo_attr = __ATTR(boardinfo, 0444,
68 boardinfo_show, NULL);
70 static int __init boardinfo_init(void)
72 struct kobject *loongson_kobj;
74 loongson_kobj = kobject_create_and_add("loongson", firmware_kobj);
76 return sysfs_create_file(loongson_kobj, &boardinfo_attr.attr);
78 late_initcall(boardinfo_init);