Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * License.  See the file "COPYING" in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * identify.c: identify machine by looking up system identifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * Copyright (C) 1998 Thomas Bogendoerfer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * This code is based on arch/mips/sgi/kernel/system.c, which is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/bug.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <asm/sgialib.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <asm/bootinfo.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) struct smatch {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	char *arcname;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	char *liname;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	int flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) static struct smatch mach_table[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 		.arcname	= "SGI-IP22",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 		.liname		= "SGI Indy",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 		.flags		= PROM_FLAG_ARCS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 		.arcname	= "SGI-IP28",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 		.liname		= "SGI IP28",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 		.flags		= PROM_FLAG_ARCS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 		.arcname	= "SGI-IP30",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 		.liname		= "SGI Octane",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 		.flags		= PROM_FLAG_ARCS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 		.arcname	= "SGI-IP32",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 		.liname		= "SGI O2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 		.flags		= PROM_FLAG_ARCS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		.arcname	= "Microsoft-Jazz",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 		.liname		= "Jazz MIPS_Magnum_4000",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 		.flags		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 		.arcname	= "PICA-61",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		.liname		= "Jazz Acer_PICA_61",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 		.flags		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		.arcname	= "RM200PCI",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 		.liname		= "SNI RM200_PCI",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 		.flags		= PROM_FLAG_DONT_FREE_TEMP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		.arcname	= "RM200PCI-R5K",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		.liname		= "SNI RM200_PCI-R5K",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		.flags		= PROM_FLAG_DONT_FREE_TEMP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) int prom_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) static struct smatch * __init string_to_mach(const char *s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	for (i = 0; i < ARRAY_SIZE(mach_table); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 		if (!strcmp(s, mach_table[i].arcname))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 			return &mach_table[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	panic("Yeee, could not determine architecture type <%s>", s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) char *system_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) const char *get_system_type(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	return system_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) static pcomponent * __init ArcGetChild(pcomponent *Current)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	return (pcomponent *) ARC_CALL1(child_component, Current);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) void __init prom_identify_arch(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	pcomponent *p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	struct smatch *mach;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	const char *iname;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	 * The root component tells us what machine architecture we have here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	p = ArcGetChild(PROM_NULL_COMPONENT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	if (p == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		iname = "Unknown";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	} else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		iname = (char *) (long) p->iname;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	printk("ARCH: %s\n", iname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	mach = string_to_mach(iname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	system_type = mach->liname;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	prom_flags = mach->flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) }