Eric Biederman | 9008960 | 2004-05-28 14:11:54 +0000 | [diff] [blame] | 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"); |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame^] | 46 | _exit(0); |
Eric Biederman | 9008960 | 2004-05-28 14:11:54 +0000 | [diff] [blame] | 47 | } |