while others dislike them being extra commits, let's clean them up once and for all for the existing code. If it's ugly, let it only be ugly once :-) Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5507 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| #include "linux_syscall.h"
 | |
| #include "linux_console.h"
 | |
| 
 | |
| struct mem_controller {
 | |
| 	unsigned short channel0[4];
 | |
| };
 | |
| 
 | |
| static unsigned int spd_detect_dimms(const struct mem_controller *ctrl)
 | |
| {
 | |
|         unsigned dimm_mask;
 | |
|         int i;
 | |
| 
 | |
| 	print_debug("1\n");
 | |
|         dimm_mask = 0;
 | |
|         for(i = 0; i < 4; i++) {
 | |
|                 int byte;
 | |
|                 unsigned device;
 | |
| 
 | |
| 		print_debug("2\n");
 | |
|                 device = ctrl->channel0[i];
 | |
|                 if (device) {
 | |
| 			print_debug("3\n");
 | |
|                         byte = ctrl->channel0[i] + 2;
 | |
|                         if (byte == 7) {
 | |
|                                 dimm_mask |= (1 << i);
 | |
|                         }
 | |
|                 }
 | |
| 		print_debug("4\n");
 | |
|         }
 | |
| 	print_debug("5\n");
 | |
|         return dimm_mask;
 | |
| }
 | |
| 
 | |
| 
 | |
| static void main(void)
 | |
| {
 | |
|         static const struct mem_controller cpu[] = {
 | |
|                 {
 | |
|                         .channel0 = { (0xa<<3)|0, (0xa<<3)|2, 0, 0 },
 | |
|                 },
 | |
|         };
 | |
| 	long dimm_mask;
 | |
| 	print_debug("A\n");
 | |
| 	dimm_mask = spd_detect_dimms(cpu);
 | |
| 	print_debug("B\n");
 | |
| 	_exit(0);
 | |
| }
 |