Since some people disapprove of white space cleanups mixed in regular commits
[coreboot.git] / util / romcc / tests / simple_test45.c
1 static void spd_set_memclk(void)
2 {
3         unsigned min_cycle_time;
4         unsigned device;
5         int new_cycle_time, new_latency;
6         int index;
7         int latency;
8
9         min_cycle_time = 0x50;
10         device = 0x50;
11         new_cycle_time = 0xa0;
12         new_latency = 5;
13
14
15         latency = 0;
16         for(index = 0; index < 3; index++, latency++) {
17                 unsigned long loops;
18                 loops = 1000000;
19                 do {
20                         unsigned short val;
21                         val = __builtin_inw(0x10e0);
22                 } while(--loops);
23                 if (!loops) {
24                         continue;
25                 }
26
27                 __builtin_outb(device, 0xe4);
28                 __builtin_outb(index, 0xe8);
29
30                 loops = 1000000;
31                 while(--loops)
32                         ;
33         }
34         if (new_latency > 4){
35                 return;
36         }
37
38         if (new_cycle_time > min_cycle_time) {
39                 min_cycle_time = new_cycle_time;
40         }
41 }