diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-24 22:08:34 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-24 22:08:34 -0700 |
commit | 881d021ab0d675f519b68df916fde969940ef988 (patch) | |
tree | b4b60a1d2a0a25c8b1f1fbf322a44d89817a22da /arch/sparc64/kernel/chmc.c | |
parent | 83ef64b9dea6e3ed287a45d56166913bffcd2497 (diff) |
sparc64: Add generic interface for registering a dimm printing handler.
The way to do this varies by platform type and the exact memory
controller the cpu uses.
For Spitfire cpus we currently just use prom_getunumber() and hope
that works.
For Cheetah cpus we have a memory controller driver that can
compute this information.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/chmc.c')
-rw-r--r-- | arch/sparc64/kernel/chmc.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/arch/sparc64/kernel/chmc.c b/arch/sparc64/kernel/chmc.c index 2f73ddc8676d..a3c79fd5dd31 100644 --- a/arch/sparc64/kernel/chmc.c +++ b/arch/sparc64/kernel/chmc.c @@ -22,6 +22,7 @@ #include <asm/prom.h> #include <asm/head.h> #include <asm/io.h> +#include <asm/memctrl.h> #define DRV_MODULE_NAME "chmc" #define PFX DRV_MODULE_NAME ": " @@ -158,9 +159,9 @@ static struct chmc_bank_info *chmc_find_bank(unsigned long phys_addr) /* This is the main purpose of this driver. */ #define SYNDROME_MIN -1 #define SYNDROME_MAX 144 -int chmc_getunumber(int syndrome_code, - unsigned long phys_addr, - char *buf, int buflen) +static int chmc_print_dimm(int syndrome_code, + unsigned long phys_addr, + char *buf, int buflen) { struct chmc_bank_info *bp; struct chmc_obp_mem_layout *prop; @@ -466,16 +467,26 @@ static inline bool chmc_platform(void) static int __init chmc_init(void) { + int ret; + if (!chmc_platform()) return -ENODEV; - return of_register_driver(&chmc_driver, &of_bus_type); + ret = register_dimm_printer(chmc_print_dimm); + if (!ret) { + ret = of_register_driver(&chmc_driver, &of_bus_type); + if (ret) + unregister_dimm_printer(chmc_print_dimm); + } + return ret; } static void __exit chmc_cleanup(void) { - if (chmc_platform()) + if (chmc_platform()) { + unregister_dimm_printer(chmc_print_dimm); of_unregister_driver(&chmc_driver); + } } module_init(chmc_init); |