nvramtool: 64bit safe CBFS handling
[coreboot.git] / util / romcc / tests / simple_test46.c
1 static void spd_set_memclk(void)
2 {
3         static const int indicies[] = { 26, 23, 9 };
4         int new_cycle_time, new_latency;
5         int index;
6         unsigned min_cycle_time, min_latency;
7         unsigned device;
8
9         min_cycle_time = 0x50;
10         min_latency = 2;
11         device = 0x50;
12         new_cycle_time = 0xa0;
13         new_latency = 5;
14
15         for(index = 0; index < 3; index++) {
16                 unsigned long loops;
17                 unsigned long address;
18                 address = indicies[index];
19                 loops = 1000000;
20                 do {
21                 } while(--loops);
22                 if (loops < 0) {
23                         continue;
24                 }
25
26                 __builtin_outb(device, 0x10e4);
27                 __builtin_outb(address, 0x10e8);
28
29                 loops = 1000000;
30                 if ((loops?0:-1) < 0) {
31                         continue;
32                 }
33         }
34
35         if (new_cycle_time > min_cycle_time) {
36                 min_cycle_time = new_cycle_time;
37         }
38         if (new_latency > min_latency) {
39                 min_latency = new_latency;
40         }
41 }