diff options
author | Greg Watson <jarrah@users.sourceforge.net> | 2003-10-05 05:13:12 +0000 |
---|---|---|
committer | Greg Watson <jarrah@users.sourceforge.net> | 2003-10-05 05:13:12 +0000 |
commit | be956f096f51ab8eae32f4ba58b1cd4716d057b1 (patch) | |
tree | 6606ba7fc3e95a6a199ad9b5a5e25686cbde33bc /src | |
parent | ccf4d34bb746356486d4c02599d9e5c8346b8d81 (diff) | |
download | coreboot-be956f096f51ab8eae32f4ba58b1cd4716d057b1.tar.xz |
size memory
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1192 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src')
-rw-r--r-- | src/cpu/ppc/ppc4xx/mem.c | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/src/cpu/ppc/ppc4xx/mem.c b/src/cpu/ppc/ppc4xx/mem.c index 9fa6daa19b..f1bd2f8b8e 100644 --- a/src/cpu/ppc/ppc4xx/mem.c +++ b/src/cpu/ppc/ppc4xx/mem.c @@ -1,7 +1,59 @@ +#include <ppc.h> #include <mem.h> +#include <console/console.h> + +#define SDRAM0_CFGADDR 0x010 +#define SDRAM0_CFGDATA 0x011 + +#define SDRAM0_B0CR 0x40 +#define SDRAM0_B1CR 0x44 +#define SDRAM0_B2CR 0x48 +#define SDRAM0_B3CR 0x4C + +#define BA_MASK 0xffc00000 +#define BA_SHIFT 22 +#define SZ_MASK 0x000e0000 +#define SZ_SHIFT 17 +#define AM_MASK 0x0000e000 +#define AM_SHIFT 13 +#define BE_MASK 0x00000001 +#define BE_SHIFT 0 + +struct mem_range mem_bank[4]; + +void +getmemrange(int bank, unsigned int reg) +{ + unsigned int val; + unsigned int size; + + mtdcr(SDRAM0_CFGADDR, reg); + val = mfdcr(SDRAM0_CFGDATA); + + if ((val & BE_MASK) == 0) + { + mem_bank[bank].basek = 0; + mem_bank[bank].sizek = 0; + return; + } + + size = ((val & BA_MASK) >> BA_SHIFT); + mem_bank[bank].basek = size * 1024; + + size = 4 << ((val & SZ_MASK) >> SZ_SHIFT); + mem_bank[bank].sizek = size * 1024; + + printk_info("mem bank %d: basek %d, sizek %d\n", bank, mem_bank[bank].basek, mem_bank[bank].sizek); +} struct mem_range * sizeram(void) { - return 0; + getmemrange(0, SDRAM0_B0CR); + getmemrange(1, SDRAM0_B1CR); + getmemrange(2, SDRAM0_B2CR); + getmemrange(3, SDRAM0_B3CR); + + return mem_bank; } + |