1 // SPDX-License-Identifier: GPL-2.0-or-later << 2 /* 1 /* 3 * Copyright (C) 2016 Imagination Technologies 2 * Copyright (C) 2016 Imagination Technologies 4 * Author: Paul Burton <paul.burton@mips.com> 3 * Author: Paul Burton <paul.burton@mips.com> >> 4 * >> 5 * This program is free software; you can redistribute it and/or modify it >> 6 * under the terms of the GNU General Public License as published by the >> 7 * Free Software Foundation; either version 2 of the License, or (at your >> 8 * option) any later version. 5 */ 9 */ 6 10 7 #include <linux/of.h> 11 #include <linux/of.h> 8 12 9 #include <asm/bootinfo.h> 13 #include <asm/bootinfo.h> 10 14 11 char *system_type; << 12 << 13 const char *get_system_type(void) 15 const char *get_system_type(void) 14 { 16 { 15 const char *str; 17 const char *str; 16 int err; 18 int err; 17 << 18 if (system_type) << 19 return system_type; << 20 19 21 err = of_property_read_string(of_root, 20 err = of_property_read_string(of_root, "model", &str); 22 if (!err) 21 if (!err) 23 return str; 22 return str; 24 23 25 err = of_property_read_string_index(of 24 err = of_property_read_string_index(of_root, "compatible", 0, &str); 26 if (!err) 25 if (!err) 27 return str; 26 return str; 28 27 29 return "Unknown"; 28 return "Unknown"; 30 } 29 } 31 30
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.