Add ifdtool, utility to read / modify Intel Firmware Descriptor images
[coreboot.git] / util / romcc / tests / linux_test13.c
1 #include "linux_syscall.h"
2 #include "linux_console.h"
3
4 struct mem_controller {
5         unsigned short channel0[4];
6 };
7
8 static unsigned int spd_detect_dimms(const struct mem_controller *ctrl)
9 {
10         unsigned dimm_mask;
11         int i;
12
13         print_debug("1\n");
14         dimm_mask = 0;
15         for(i = 0; i < 4; i++) {
16                 int byte;
17                 unsigned device;
18
19                 print_debug("2\n");
20                 device = ctrl->channel0[i];
21                 if (device) {
22                         print_debug("3\n");
23                         byte = ctrl->channel0[i] + 2;
24                         if (byte == 7) {
25                                 dimm_mask |= (1 << i);
26                         }
27                 }
28                 print_debug("4\n");
29         }
30         print_debug("5\n");
31         return dimm_mask;
32 }
33
34
35 static void main(void)
36 {
37         static const struct mem_controller cpu[] = {
38                 {
39                         .channel0 = { (0xa<<3)|0, (0xa<<3)|2, 0, 0 },
40                 },
41         };
42         long dimm_mask;
43         print_debug("A\n");
44         dimm_mask = spd_detect_dimms(cpu);
45         print_debug("B\n");
46         _exit(0);
47 }