[PATCH] PCI: clean up msi.c a bit
[linux-2.6/sactl.git] / arch / ppc / syslib / ibm440sp_common.c
blob293e4138d172e12b1d70054e97c87abfc27bd452
1 /*
2 * PPC440SP/PPC440SPe system library
4 * Matt Porter <mporter@kernel.crashing.org>
5 * Copyright 2002-2005 MontaVista Software Inc.
7 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
8 * Copyright (c) 2003, 2004 Zultys Technologies
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
16 #include <linux/config.h>
17 #include <linux/types.h>
18 #include <linux/serial.h>
20 #include <asm/param.h>
21 #include <asm/ibm44x.h>
22 #include <asm/mmu.h>
23 #include <asm/machdep.h>
24 #include <asm/time.h>
25 #include <asm/ppc4xx_pic.h>
28 * Read the 440SP memory controller to get size of system memory.
30 unsigned long __init ibm440sp_find_end_of_memory(void)
32 u32 i;
33 u32 mem_size = 0;
35 /* Read two bank sizes and sum */
36 for (i=0; i< MQ0_NUM_BANKS; i++)
37 switch (mfdcr(DCRN_MQ0_BS0BAS + i) & MQ0_CONFIG_SIZE_MASK) {
38 case MQ0_CONFIG_SIZE_8M:
39 mem_size += PPC44x_MEM_SIZE_8M;
40 break;
41 case MQ0_CONFIG_SIZE_16M:
42 mem_size += PPC44x_MEM_SIZE_16M;
43 break;
44 case MQ0_CONFIG_SIZE_32M:
45 mem_size += PPC44x_MEM_SIZE_32M;
46 break;
47 case MQ0_CONFIG_SIZE_64M:
48 mem_size += PPC44x_MEM_SIZE_64M;
49 break;
50 case MQ0_CONFIG_SIZE_128M:
51 mem_size += PPC44x_MEM_SIZE_128M;
52 break;
53 case MQ0_CONFIG_SIZE_256M:
54 mem_size += PPC44x_MEM_SIZE_256M;
55 break;
56 case MQ0_CONFIG_SIZE_512M:
57 mem_size += PPC44x_MEM_SIZE_512M;
58 break;
59 case MQ0_CONFIG_SIZE_1G:
60 mem_size += PPC44x_MEM_SIZE_1G;
61 break;
62 case MQ0_CONFIG_SIZE_2G:
63 mem_size += PPC44x_MEM_SIZE_2G;
64 break;
65 default:
66 break;
68 return mem_size;