Merge tag 'sched-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / arch / mips / loongson64 / boardinfo.c
blob280989c5a137b5f32708b21331b48bc581745130
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/kobject.h>
3 #include <boot_param.h>
5 static ssize_t boardinfo_show(struct kobject *kobj,
6 struct kobj_attribute *attr, char *buf)
8 char board_manufacturer[64] = {0};
9 char *tmp_board_manufacturer = board_manufacturer;
10 char bios_vendor[64] = {0};
11 char *tmp_bios_vendor = bios_vendor;
13 strcpy(board_manufacturer, eboard->name);
14 strcpy(bios_vendor, einter->description);
16 return sprintf(buf,
17 "Board Info\n"
18 "Manufacturer\t\t: %s\n"
19 "Board Name\t\t: %s\n"
20 "Family\t\t\t: LOONGSON3\n\n"
21 "BIOS Info\n"
22 "Vendor\t\t\t: %s\n"
23 "Version\t\t\t: %s\n"
24 "ROM Size\t\t: %d KB\n"
25 "Release Date\t\t: %s\n",
26 strsep(&tmp_board_manufacturer, "-"),
27 eboard->name,
28 strsep(&tmp_bios_vendor, "-"),
29 einter->description,
30 einter->size,
31 especial->special_name);
33 static struct kobj_attribute boardinfo_attr = __ATTR(boardinfo, 0444,
34 boardinfo_show, NULL);
36 static int __init boardinfo_init(void)
38 struct kobject *lefi_kobj;
40 lefi_kobj = kobject_create_and_add("lefi", firmware_kobj);
41 if (!lefi_kobj) {
42 pr_err("lefi: Firmware registration failed.\n");
43 return -ENOMEM;
46 return sysfs_create_file(lefi_kobj, &boardinfo_attr.attr);
48 late_initcall(boardinfo_init);