1 // SPDX-License-Identifier: GPL-2.0 1 2 /* 3 * idprom.c: Routines to load the idprom into 4 * interpret the data contained with 5 * 6 * Copyright (C) 1995 David S. Miller (davem@c 7 * Sun3/3x models added by David Monro (davidm 8 */ 9 10 #include <linux/module.h> 11 #include <linux/kernel.h> 12 #include <linux/types.h> 13 #include <linux/init.h> 14 #include <linux/string.h> 15 16 #include <asm/oplib.h> 17 #include <asm/idprom.h> 18 #include <asm/machines.h> /* Fun with Sun rel 19 20 #include "sun3.h" 21 22 struct idprom *idprom; 23 EXPORT_SYMBOL(idprom); 24 25 static struct idprom idprom_buffer; 26 27 /* Here is the master table of Sun machines wh 28 * of the Sparc CPU and have a meaningful IDPR 29 * know about. See asm-sparc/machines.h for e 30 */ 31 static struct Sun_Machine_Models Sun_Machines[ 32 /* First, Sun3's */ 33 { .name = "Sun 3/160 Series", .id_ma 34 { .name = "Sun 3/50", .id_ma 35 { .name = "Sun 3/260 Series", .id_ma 36 { .name = "Sun 3/110 Series", .id_ma 37 { .name = "Sun 3/60", .id_ma 38 { .name = "Sun 3/E", .id_ma 39 /* Now, Sun3x's */ 40 { .name = "Sun 3/460 Series", .id_ma 41 { .name = "Sun 3/80", .id_ma 42 /* Then, Sun4's */ 43 // { .name = "Sun 4/100 Series", .id_ma 44 // { .name = "Sun 4/200 Series", .id_ma 45 // { .name = "Sun 4/300 Series", .id_ma 46 // { .name = "Sun 4/400 Series", .id_ma 47 /* And now, Sun4c's */ 48 // { .name = "Sun4c SparcStation 1", .id_ma 49 // { .name = "Sun4c SparcStation IPC", .id_ma 50 // { .name = "Sun4c SparcStation 1+", .id_ma 51 // { .name = "Sun4c SparcStation SLC", .id_ma 52 // { .name = "Sun4c SparcStation 2", .id_ma 53 // { .name = "Sun4c SparcStation ELC", .id_ma 54 // { .name = "Sun4c SparcStation IPX", .id_ma 55 /* Finally, early Sun4m's */ 56 // { .name = "Sun4m SparcSystem600", .id_ma 57 // { .name = "Sun4m SparcStation10/20", .id_ma 58 // { .name = "Sun4m SparcStation5", .id_ma 59 /* One entry for the OBP arch's which are sun4 60 // { .name = "Sun4M OBP based system", .id_ma 61 }; 62 63 static void __init display_system_type(unsigne 64 { 65 register int i; 66 67 for (i = 0; i < NUM_SUN_MACHINES; i++) 68 if(Sun_Machines[i].id_machtype 69 if (machtype != (SM_SU 70 pr_info("TYPE: 71 else { 72 #if 0 73 char sysname[1 74 75 prom_getproper 76 77 pr_info("TYPE: 78 #endif 79 } 80 return; 81 } 82 } 83 84 prom_printf("IDPROM: Bogus id_machtype 85 prom_halt(); 86 } 87 88 void sun3_get_model(char *model) 89 { 90 register int i; 91 92 for (i = 0; i < NUM_SUN_MACHINES; i++) 93 if(Sun_Machines[i].id_machtype 94 strcpy(model, Sun_Mach 95 return; 96 } 97 } 98 } 99 100 101 102 /* Calculate the IDPROM checksum (xor of the d 103 static unsigned char __init calc_idprom_cksum( 104 { 105 unsigned char cksum, i, *ptr = (unsign 106 107 for (i = cksum = 0; i <= 0x0E; i++) 108 cksum ^= *ptr++; 109 110 return cksum; 111 } 112 113 /* Create a local IDPROM copy, verify integrit 114 void __init idprom_init(void) 115 { 116 prom_get_idprom((char *) &idprom_buffe 117 118 idprom = &idprom_buffer; 119 120 if (idprom->id_format != 0x01) { 121 prom_printf("IDPROM: Unknown f 122 prom_halt(); 123 } 124 125 if (idprom->id_cksum != calc_idprom_ck 126 prom_printf("IDPROM: Checksum 127 idprom->id_cksum, 128 prom_halt(); 129 } 130 131 display_system_type(idprom->id_machtyp 132 133 pr_info("Ethernet address: %pM\n", idp 134 } 135
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.