69 |
|
// Create "device-tree" |
70 |
|
RegEntryID device_tree; |
71 |
|
if (!RegistryCStrEntryCreate(NULL, "Devices:device-tree", &device_tree)) { |
72 |
< |
u32 = BusClockSpeed; |
72 |
> |
u32 = htonl(BusClockSpeed); |
73 |
|
RegistryPropertyCreate(&device_tree, "clock-frequency", &u32, 4); |
74 |
|
RegistryPropertyCreateStr(&device_tree, "model", "Power Macintosh"); |
75 |
|
|
77 |
|
RegEntryID aapl_rom; |
78 |
|
if (!RegistryCStrEntryCreate(&device_tree, "AAPL,ROM", &aapl_rom)) { |
79 |
|
RegistryPropertyCreateStr(&aapl_rom, "device_type", "rom"); |
80 |
< |
uint32 reg[2] = {ROM_BASE, ROM_SIZE}; |
80 |
> |
uint32 reg[2]; |
81 |
> |
reg[0] = htonl(ROM_BASE); |
82 |
> |
reg[1] = htonl(ROM_SIZE); |
83 |
|
RegistryPropertyCreate(&aapl_rom, "reg", ®, 8); |
84 |
|
} |
85 |
|
|
122 |
|
break; |
123 |
|
} |
124 |
|
if (!RegistryCStrEntryCreate(&device_tree, str, &power_pc)) { |
125 |
< |
u32 = CPUClockSpeed; |
125 |
> |
u32 = htonl(CPUClockSpeed); |
126 |
|
RegistryPropertyCreate(&power_pc, "clock-frequency", &u32, 4); |
127 |
< |
RegistryPropertyCreate(&power_pc, "cpu-version", &PVR, 4); |
127 |
> |
u32 = htonl(PVR); |
128 |
> |
RegistryPropertyCreate(&power_pc, "cpu-version", &u32, 4); |
129 |
|
RegistryPropertyCreateStr(&power_pc, "device_type", "cpu"); |
130 |
|
switch (PVR >> 16) { |
131 |
|
case 1: // 601 |
132 |
< |
u32 = 64; |
132 |
> |
u32 = htonl(64); |
133 |
|
RegistryPropertyCreate(&power_pc, "d-cache-block-size", &u32, 4); |
134 |
< |
u32 = 128; |
134 |
> |
u32 = htonl(128); |
135 |
|
RegistryPropertyCreate(&power_pc, "d-cache-sets", &u32, 4); |
136 |
< |
u32 = 0x8000; |
136 |
> |
u32 = htonl(0x8000); |
137 |
|
RegistryPropertyCreate(&power_pc, "d-cache-size", &u32, 4); |
138 |
< |
u32 = 64; |
138 |
> |
u32 = htonl(64); |
139 |
|
RegistryPropertyCreate(&power_pc, "i-cache-block-size", &u32, 4); |
140 |
< |
u32 = 128; |
140 |
> |
u32 = htonl(128); |
141 |
|
RegistryPropertyCreate(&power_pc, "i-cache-sets", &u32, 4); |
142 |
< |
u32 = 0x8000; |
142 |
> |
u32 = htonl(0x8000); |
143 |
|
RegistryPropertyCreate(&power_pc, "i-cache-size", &u32, 4); |
144 |
< |
u32 = 128; |
144 |
> |
u32 = htonl(128); |
145 |
|
RegistryPropertyCreate(&power_pc, "tlb-sets", &u32, 4); |
146 |
< |
u32 = 256; |
146 |
> |
u32 = htonl(256); |
147 |
|
RegistryPropertyCreate(&power_pc, "tlb-size", &u32, 4); |
148 |
|
break; |
149 |
|
case 3: // 603 |
150 |
< |
u32 = 32; |
150 |
> |
u32 = htonl(32); |
151 |
|
RegistryPropertyCreate(&power_pc, "d-cache-block-size", &u32, 4); |
152 |
< |
u32 = 64; |
152 |
> |
u32 = htonl(64); |
153 |
|
RegistryPropertyCreate(&power_pc, "d-cache-sets", &u32, 4); |
154 |
< |
u32 = 0x2000; |
154 |
> |
u32 = htonl(0x2000); |
155 |
|
RegistryPropertyCreate(&power_pc, "d-cache-size", &u32, 4); |
156 |
< |
u32 = 32; |
156 |
> |
u32 = htonl(32); |
157 |
|
RegistryPropertyCreate(&power_pc, "i-cache-block-size", &u32, 4); |
158 |
< |
u32 = 64; |
158 |
> |
u32 = htonl(64); |
159 |
|
RegistryPropertyCreate(&power_pc, "i-cache-sets", &u32, 4); |
160 |
< |
u32 = 0x2000; |
160 |
> |
u32 = htonl(0x2000); |
161 |
|
RegistryPropertyCreate(&power_pc, "i-cache-size", &u32, 4); |
162 |
< |
u32 = 32; |
162 |
> |
u32 = htonl(32); |
163 |
|
RegistryPropertyCreate(&power_pc, "tlb-sets", &u32, 4); |
164 |
< |
u32 = 64; |
164 |
> |
u32 = htonl(64); |
165 |
|
RegistryPropertyCreate(&power_pc, "tlb-size", &u32, 4); |
166 |
|
break; |
167 |
|
case 4: // 604 |
168 |
< |
u32 = 32; |
168 |
> |
u32 = htonl(32); |
169 |
|
RegistryPropertyCreate(&power_pc, "d-cache-block-size", &u32, 4); |
170 |
< |
u32 = 128; |
170 |
> |
u32 = htonl(128); |
171 |
|
RegistryPropertyCreate(&power_pc, "d-cache-sets", &u32, 4); |
172 |
< |
u32 = 0x4000; |
172 |
> |
u32 = htonl(0x4000); |
173 |
|
RegistryPropertyCreate(&power_pc, "d-cache-size", &u32, 4); |
174 |
< |
u32 = 32; |
174 |
> |
u32 = htonl(32); |
175 |
|
RegistryPropertyCreate(&power_pc, "i-cache-block-size", &u32, 4); |
176 |
< |
u32 = 128; |
176 |
> |
u32 = htonl(128); |
177 |
|
RegistryPropertyCreate(&power_pc, "i-cache-sets", &u32, 4); |
178 |
< |
u32 = 0x4000; |
178 |
> |
u32 = htonl(0x4000); |
179 |
|
RegistryPropertyCreate(&power_pc, "i-cache-size", &u32, 4); |
180 |
< |
u32 = 64; |
180 |
> |
u32 = htonl(64); |
181 |
|
RegistryPropertyCreate(&power_pc, "tlb-sets", &u32, 4); |
182 |
< |
u32 = 128; |
182 |
> |
u32 = htonl(128); |
183 |
|
RegistryPropertyCreate(&power_pc, "tlb-size", &u32, 4); |
184 |
|
break; |
185 |
|
case 6: // 603e |
186 |
|
case 7: // 603ev |
187 |
< |
u32 = 32; |
187 |
> |
u32 = htonl(32); |
188 |
|
RegistryPropertyCreate(&power_pc, "d-cache-block-size", &u32, 4); |
189 |
< |
u32 = 128; |
189 |
> |
u32 = htonl(128); |
190 |
|
RegistryPropertyCreate(&power_pc, "d-cache-sets", &u32, 4); |
191 |
< |
u32 = 0x4000; |
191 |
> |
u32 = htonl(0x4000); |
192 |
|
RegistryPropertyCreate(&power_pc, "d-cache-size", &u32, 4); |
193 |
< |
u32 = 32; |
193 |
> |
u32 = htonl(32); |
194 |
|
RegistryPropertyCreate(&power_pc, "i-cache-block-size", &u32, 4); |
195 |
< |
u32 = 128; |
195 |
> |
u32 = htonl(128); |
196 |
|
RegistryPropertyCreate(&power_pc, "i-cache-sets", &u32, 4); |
197 |
< |
u32 = 0x4000; |
197 |
> |
u32 = htonl(0x4000); |
198 |
|
RegistryPropertyCreate(&power_pc, "i-cache-size", &u32, 4); |
199 |
< |
u32 = 32; |
199 |
> |
u32 = htonl(32); |
200 |
|
RegistryPropertyCreate(&power_pc, "tlb-sets", &u32, 4); |
201 |
< |
u32 = 64; |
201 |
> |
u32 = htonl(64); |
202 |
|
RegistryPropertyCreate(&power_pc, "tlb-size", &u32, 4); |
203 |
|
break; |
204 |
|
case 8: // 750 |
205 |
< |
u32 = 32; |
205 |
> |
u32 = htonl(32); |
206 |
|
RegistryPropertyCreate(&power_pc, "d-cache-block-size", &u32, 4); |
207 |
< |
u32 = 256; |
207 |
> |
u32 = htonl(256); |
208 |
|
RegistryPropertyCreate(&power_pc, "d-cache-sets", &u32, 4); |
209 |
< |
u32 = 0x8000; |
209 |
> |
u32 = htonl(0x8000); |
210 |
|
RegistryPropertyCreate(&power_pc, "d-cache-size", &u32, 4); |
211 |
< |
u32 = 32; |
211 |
> |
u32 = htonl(32); |
212 |
|
RegistryPropertyCreate(&power_pc, "i-cache-block-size", &u32, 4); |
213 |
< |
u32 = 256; |
213 |
> |
u32 = htonl(256); |
214 |
|
RegistryPropertyCreate(&power_pc, "i-cache-sets", &u32, 4); |
215 |
< |
u32 = 0x8000; |
215 |
> |
u32 = htonl(0x8000); |
216 |
|
RegistryPropertyCreate(&power_pc, "i-cache-size", &u32, 4); |
217 |
< |
u32 = 64; |
217 |
> |
u32 = htonl(64); |
218 |
|
RegistryPropertyCreate(&power_pc, "tlb-sets", &u32, 4); |
219 |
< |
u32 = 128; |
219 |
> |
u32 = htonl(128); |
220 |
|
RegistryPropertyCreate(&power_pc, "tlb-size", &u32, 4); |
221 |
|
break; |
222 |
|
case 9: // 604e |
223 |
|
case 10: // 604ev5 |
224 |
< |
u32 = 32; |
224 |
> |
u32 = htonl(32); |
225 |
|
RegistryPropertyCreate(&power_pc, "d-cache-block-size", &u32, 4); |
226 |
< |
u32 = 256; |
226 |
> |
u32 = htonl(256); |
227 |
|
RegistryPropertyCreate(&power_pc, "d-cache-sets", &u32, 4); |
228 |
< |
u32 = 0x8000; |
228 |
> |
u32 = htonl(0x8000); |
229 |
|
RegistryPropertyCreate(&power_pc, "d-cache-size", &u32, 4); |
230 |
< |
u32 = 32; |
230 |
> |
u32 = htonl(32); |
231 |
|
RegistryPropertyCreate(&power_pc, "i-cache-block-size", &u32, 4); |
232 |
< |
u32 = 256; |
232 |
> |
u32 = htonl(256); |
233 |
|
RegistryPropertyCreate(&power_pc, "i-cache-sets", &u32, 4); |
234 |
< |
u32 = 0x8000; |
234 |
> |
u32 = htonl(0x8000); |
235 |
|
RegistryPropertyCreate(&power_pc, "i-cache-size", &u32, 4); |
236 |
< |
u32 = 64; |
236 |
> |
u32 = htonl(64); |
237 |
|
RegistryPropertyCreate(&power_pc, "tlb-sets", &u32, 4); |
238 |
< |
u32 = 128; |
238 |
> |
u32 = htonl(128); |
239 |
|
RegistryPropertyCreate(&power_pc, "tlb-size", &u32, 4); |
240 |
|
break; |
241 |
|
default: |
242 |
|
break; |
243 |
|
} |
244 |
< |
u32 = 32; |
244 |
> |
u32 = htonl(32); |
245 |
|
RegistryPropertyCreate(&power_pc, "reservation-granularity", &u32, 4); |
246 |
|
uint32 reg[2] = {0, 0}; |
247 |
|
RegistryPropertyCreate(&power_pc, "reg", ®, 8); |
250 |
|
// Create "memory" |
251 |
|
RegEntryID memory; |
252 |
|
if (!RegistryCStrEntryCreate(&device_tree, "memory", &memory)) { |
253 |
< |
uint32 reg[2] = {RAMBase, RAMSize}; |
253 |
> |
uint32 reg[2]; |
254 |
> |
reg[0] = htonl(RAMBase); |
255 |
> |
reg[1] = htonl(RAMSize); |
256 |
|
RegistryPropertyCreateStr(&memory, "device_type", "memory"); |
257 |
|
RegistryPropertyCreate(&memory, "reg", ®, 8); |
258 |
|
} |