| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * This file is subject to the terms and conditions of the GNU General Public | 
					
						
							|  |  |  |  * License.  See the file "COPYING" in the main directory of this archive | 
					
						
							|  |  |  |  * for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * identify.c: identify machine by looking up system identifier | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 1998 Thomas Bogendoerfer | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This code is based on arch/mips/sgi/kernel/system.c, which is | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2011-04-04 14:15:29 -07:00
										 |  |  |  * Copyright (C) 1996 David S. Miller (davem@davemloft.net) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2012-01-20 18:35:53 -05:00
										 |  |  | #include <linux/bug.h>
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #include <linux/init.h>
 | 
					
						
							|  |  |  | #include <linux/kernel.h>
 | 
					
						
							|  |  |  | #include <linux/types.h>
 | 
					
						
							|  |  |  | #include <linux/string.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <asm/sgialib.h>
 | 
					
						
							|  |  |  | #include <asm/bootinfo.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct smatch { | 
					
						
							|  |  |  | 	char *arcname; | 
					
						
							|  |  |  | 	char *liname; | 
					
						
							|  |  |  | 	int flags; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct smatch mach_table[] = { | 
					
						
							| 
									
										
										
										
											2007-10-11 23:46:07 +01:00
										 |  |  | 	{ | 
					
						
							|  |  |  | 		.arcname	= "SGI-IP22", | 
					
						
							|  |  |  | 		.liname		= "SGI Indy", | 
					
						
							|  |  |  | 		.flags		= PROM_FLAG_ARCS, | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		.arcname	= "SGI-IP27", | 
					
						
							|  |  |  | 		.liname		= "SGI Origin", | 
					
						
							|  |  |  | 		.flags		= PROM_FLAG_ARCS, | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		.arcname	= "SGI-IP28", | 
					
						
							|  |  |  | 		.liname		= "SGI IP28", | 
					
						
							|  |  |  | 		.flags		= PROM_FLAG_ARCS, | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		.arcname	= "SGI-IP30", | 
					
						
							|  |  |  | 		.liname		= "SGI Octane", | 
					
						
							|  |  |  | 		.flags		= PROM_FLAG_ARCS, | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		.arcname	= "SGI-IP32", | 
					
						
							|  |  |  | 		.liname		= "SGI O2", | 
					
						
							|  |  |  | 		.flags		= PROM_FLAG_ARCS, | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		.arcname	= "Microsoft-Jazz", | 
					
						
							|  |  |  | 		.liname		= "Jazz MIPS_Magnum_4000", | 
					
						
							|  |  |  | 		.flags		= 0, | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		.arcname	= "PICA-61", | 
					
						
							|  |  |  | 		.liname		= "Jazz Acer_PICA_61", | 
					
						
							|  |  |  | 		.flags		= 0, | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		.arcname	= "RM200PCI", | 
					
						
							|  |  |  | 		.liname		= "SNI RM200_PCI", | 
					
						
							| 
									
										
										
										
											2008-05-27 01:15:20 +02:00
										 |  |  | 		.flags		= PROM_FLAG_DONT_FREE_TEMP, | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		.arcname	= "RM200PCI-R5K", | 
					
						
							|  |  |  | 		.liname		= "SNI RM200_PCI-R5K", | 
					
						
							| 
									
										
										
										
											2007-10-11 23:46:07 +01:00
										 |  |  | 		.flags		= PROM_FLAG_DONT_FREE_TEMP, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int prom_flags; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct smatch * __init string_to_mach(const char *s) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	int i; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-02-05 04:42:11 +02:00
										 |  |  | 	for (i = 0; i < ARRAY_SIZE(mach_table); i++) { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 		if (!strcmp(s, mach_table[i].arcname)) | 
					
						
							|  |  |  | 			return &mach_table[i]; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	panic("Yeee, could not determine architecture type <%s>", s); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | char *system_type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const char *get_system_type(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return system_type; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void __init prom_identify_arch(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	pcomponent *p; | 
					
						
							|  |  |  | 	struct smatch *mach; | 
					
						
							|  |  |  | 	const char *iname; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * The root component tells us what machine architecture we have here. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	p = ArcGetChild(PROM_NULL_COMPONENT); | 
					
						
							|  |  |  | 	if (p == NULL) { | 
					
						
							|  |  |  | #ifdef CONFIG_SGI_IP27
 | 
					
						
							|  |  |  | 		/* IP27 PROM misbehaves, seems to not implement ARC
 | 
					
						
							| 
									
										
										
										
											2013-01-22 12:59:30 +01:00
										 |  |  | 		   GetChild().	So we just assume it's an IP27.	 */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 		iname = "SGI-IP27"; | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | 		iname = "Unknown"; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 	} else | 
					
						
							|  |  |  | 		iname = (char *) (long) p->iname; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	printk("ARCH: %s\n", iname); | 
					
						
							|  |  |  | 	mach = string_to_mach(iname); | 
					
						
							|  |  |  | 	system_type = mach->liname; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	prom_flags = mach->flags; | 
					
						
							|  |  |  | } |