This source file includes following definitions.
- get_idprom
- find_vac_size
- find_vac_linesize
- find_vac_hwflushes
- find_mmu_num_segmaps
- find_mmu_num_contexts
1
2
3
4
5
6
7 #include <linux/kernel.h>
8
9 #include <asm/types.h>
10 #include <asm/openprom.h>
11 #include <asm/idprom.h>
12
13 struct idp_struct idprom;
14 extern int num_segmaps, num_contexts;
15
16 void get_idprom(void)
17 {
18 char* idp_addr;
19 char* knl_idp_addr;
20 int i;
21
22 idp_addr = (char *)IDPROM_ADDR;
23 knl_idp_addr = (char *) &idprom;
24
25 for(i = 0; i<IDPROM_SIZE; i++)
26 *knl_idp_addr++ = *idp_addr++;
27
28 return;
29 }
30
31
32
33
34
35 int
36 find_vac_size(void)
37 {
38 int vac_prop_len;
39 int vacsize = 0;
40 int node_root;
41
42 node_root = (*(romvec->pv_nodeops->no_nextnode))(0);
43
44 vac_prop_len = (*(romvec->pv_nodeops->no_proplen))(node_root, "vac-size");
45
46 if(vac_prop_len != -1)
47 {
48 (*(romvec->pv_nodeops->no_getprop))(node_root, "vac-size", (char *) &vacsize);
49 return vacsize;
50 }
51 else
52 {
53
54
55 switch(idprom.id_machtype)
56 {
57 case 0x51:
58 case 0x52:
59 case 0x53:
60 case 0x54:
61 case 0x55:
62 case 0x56:
63 case 0x57:
64 return 65536;
65 default:
66 return -1;
67 }
68 };
69 }
70
71
72
73 int
74 find_vac_linesize(void)
75 {
76 int vac_prop_len;
77 int vaclinesize = 0;
78 int node_root;
79
80 node_root = (*(romvec->pv_nodeops->no_nextnode))(0);
81
82 vac_prop_len = (*(romvec->pv_nodeops->no_proplen))(node_root, "vac-linesize");
83
84 if(vac_prop_len != -1)
85 {
86 (*(romvec->pv_nodeops->no_getprop))(node_root, "vac-linesize",
87 (char *) &vaclinesize);
88 return vaclinesize;
89 }
90 else
91 {
92
93
94 switch(idprom.id_machtype)
95 {
96 case 0x51:
97 case 0x52:
98 case 0x53:
99 case 0x54:
100 return 16;
101 case 0x55:
102 case 0x56:
103 case 0x57:
104 return 32;
105 default:
106 return -1;
107 }
108 };
109 }
110
111 int
112 find_vac_hwflushes(void)
113 {
114 register int len, node_root;
115 int tmp1, tmp2;
116
117 node_root = (*(romvec->pv_nodeops->no_nextnode))(0);
118
119 len = (*(romvec->pv_nodeops->no_proplen))(node_root, "vac_hwflush");
120
121 #ifdef DEBUG_IDPROM
122 printf("DEBUG: find_vac_hwflushes: proplen vac_hwflush=0x%x\n", len);
123 #endif
124
125
126
127
128 len |= (*(romvec->pv_nodeops->no_proplen))(node_root, "vac-hwflush");
129
130 #ifdef DEBUG_IDPROM
131 printf("DEBUG: find_vac_hwflushes: proplen vac-hwflush=0x%x\n", len);
132 #endif
133
134 len = (*(romvec->pv_nodeops->no_getprop))(node_root,"vac_hwflush",
135 (char *) &tmp1);
136 if(len != 4) tmp1=0;
137
138 len = (*(romvec->pv_nodeops->no_getprop))(node_root, "vac-hwflush",
139 (char *) &tmp2);
140 if(len != 4) tmp2=0;
141
142
143 return (tmp1|tmp2);
144 }
145
146 void
147 find_mmu_num_segmaps(void)
148 {
149 register int root_node, len;
150
151 root_node = (*(romvec->pv_nodeops->no_nextnode))(0);
152
153 len = (*(romvec->pv_nodeops->no_getprop))(root_node, "mmu-npmg",
154 (char *) &num_segmaps);
155
156 #ifdef DEBUG_MMU
157 printf("find_mmu_num_segmaps: property length = %d\n", len);
158 #endif
159
160 if(len != 4) num_segmaps = 128;
161
162 return;
163 }
164
165 void
166 find_mmu_num_contexts(void)
167 {
168 register int root_node, len;
169
170 root_node = (*(romvec->pv_nodeops->no_nextnode))(0);
171
172 len = (*(romvec->pv_nodeops->no_getprop))(root_node, "mmu-nctx",
173 (char *) &num_contexts);
174
175 #ifdef DEBUG_MMU
176 printf("find_mmu_num_contexts: property length = %d\n", len);
177 #endif
178
179 if(len != 4) num_contexts = 8;
180
181 return;
182 }
183