This source file includes following definitions.
- sparc_display_systype
- get_idprom
- find_vac_size
- find_vac_linesize
- find_vac_hwflushes
1
2
3
4
5
6
7
8
9
10 #include <linux/kernel.h>
11
12 #include <asm/types.h>
13 #include <asm/oplib.h>
14 #include <asm/idprom.h>
15 #include <asm/machines.h>
16 #include <asm/system.h>
17
18 struct idp_struct *idprom;
19 static struct idp_struct idprom_buff;
20
21
22
23
24
25 struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES] = {
26
27 { "Sun 4/100 Series", (SM_SUN4 | SM_4_110) },
28 { "Sun 4/200 Series", (SM_SUN4 | SM_4_260) },
29 { "Sun 4/300 Series", (SM_SUN4 | SM_4_330) },
30 { "Sun 4/400 Series", (SM_SUN4 | SM_4_470) },
31
32 { "Sun4c SparcStation 1", (SM_SUN4C | SM_4C_SS1) },
33 { "Sun4c SparcStation IPC", (SM_SUN4C | SM_4C_IPC) },
34 { "Sun4c SparcStation 1+", (SM_SUN4C | SM_4C_SS1PLUS) },
35 { "Sun4c SparcStation SLC", (SM_SUN4C | SM_4C_SLC) },
36 { "Sun4c SparcStation 2", (SM_SUN4C | SM_4C_SS2) },
37 { "Sun4c SparcStation ELC", (SM_SUN4C | SM_4C_ELC) },
38 { "Sun4c SparcStation IPX", (SM_SUN4C | SM_4C_IPX) },
39
40 { "Sun4m SparcSystem600", (SM_SUN4M | SM_4M_SS60) },
41 { "Sun4m SparcStation10", (SM_SUN4M | SM_4M_SS50) },
42 { "Sun4m SparcStation5", (SM_SUN4M | SM_4M_SS40) },
43
44 { "Sun4M OBP based system", (SM_SUN4M_OBP | 0x0) } };
45
46 void
47 sparc_display_systype(unsigned char machtyp)
48 {
49 char system_name[128];
50 int i;
51
52 for(i = 0; i<NUM_SUN_MACHINES; i++) {
53 if(Sun_Machines[i].id_machtype == machtyp) {
54 if(machtyp!=(SM_SUN4M_OBP | 0x0)) {
55 printk("TYPE: %s\n", Sun_Machines[i].name);
56 break;
57 } else {
58 prom_getproperty(prom_root_node, "banner-name",
59 system_name, sizeof(system_name));
60 printk("TYPE: %s\n", system_name);
61 break;
62 }
63 }
64 }
65 if(i == NUM_SUN_MACHINES)
66 printk("Uh oh, IDPROM had bogus id_machtype value <%x>\n", machtyp);
67 return;
68 }
69
70 void
71 get_idprom(void)
72 {
73 prom_getidp((char *) &idprom_buff, sizeof(idprom_buff));
74
75 idprom = &idprom_buff;
76
77 sparc_display_systype(idprom->id_machtype);
78
79 printk("Ethernet address: %x:%x:%x:%x:%x:%x\n",
80 idprom->id_eaddr[0], idprom->id_eaddr[1], idprom->id_eaddr[2],
81 idprom->id_eaddr[3], idprom->id_eaddr[4], idprom->id_eaddr[5]);
82
83 return;
84 }
85
86
87
88
89
90 int
91 find_vac_size(void)
92 {
93 int vac_prop_len;
94 int vacsize = 0;
95
96 vac_prop_len = prom_getproplen(prom_root_node, "vac-size");
97 if(vac_prop_len != -1) {
98 vacsize = prom_getint(prom_root_node, "vac-size");
99 return vacsize;
100 } else {
101 switch(idprom->id_machtype) {
102 case (SM_SUN4C | SM_4C_SS1):
103 case (SM_SUN4C | SM_4C_IPC):
104 case (SM_SUN4C | SM_4C_SS1PLUS):
105 case (SM_SUN4C | SM_4C_SLC):
106 case (SM_SUN4C | SM_4C_SS2):
107 case (SM_SUN4C | SM_4C_ELC):
108 case (SM_SUN4C | SM_4C_IPX):
109 return 65536;
110 default:
111 printk("find_vac_size: Can't determine size of VAC, bailing out...\n");
112 halt();
113 break;
114 };
115 };
116 return -1;
117 }
118
119
120
121 int
122 find_vac_linesize(void)
123 {
124 int vac_prop_len;
125
126 vac_prop_len = prom_getproplen(prom_root_node, "vac-linesize");
127
128 if(vac_prop_len != -1)
129 return prom_getint(prom_root_node, "vac-linesize");
130 else {
131 switch(idprom->id_machtype) {
132 case (SM_SUN4C | SM_4C_SS1):
133 case (SM_SUN4C | SM_4C_IPC):
134 case (SM_SUN4C | SM_4C_SS1PLUS):
135 case (SM_SUN4C | SM_4C_SLC):
136 return 16;
137 case (SM_SUN4C | SM_4C_SS2):
138 case (SM_SUN4C | SM_4C_ELC):
139 case (SM_SUN4C | SM_4C_IPX):
140 return 32;
141 default:
142 printk("find_vac_linesize: Can't determine VAC linesize, bailing out...\n");
143 halt();
144 break;
145 };
146 };
147 return -1;
148 }
149
150 int
151 find_vac_hwflushes(void)
152 {
153 register int len;
154 int tmp1, tmp2;
155
156
157
158
159 len = prom_getproperty(prom_root_node, "vac_hwflush",
160 (char *) &tmp1, sizeof(int));
161 if(len != 4) tmp1=0;
162
163 len = prom_getproperty(prom_root_node, "vac-hwflush",
164 (char *) &tmp2, sizeof(int));
165 if(len != 4) tmp2=0;
166
167 return (tmp1|tmp2);
168 }
169