diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-25 01:08:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-25 01:08:34 -0400 |
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 @@ | |||
22 | #include <asm/prom.h> | 22 | #include <asm/prom.h> |
23 | #include <asm/head.h> | 23 | #include <asm/head.h> |
24 | #include <asm/io.h> | 24 | #include <asm/io.h> |
25 | #include <asm/memctrl.h> | ||
25 | 26 | ||
26 | #define DRV_MODULE_NAME "chmc" | 27 | #define DRV_MODULE_NAME "chmc" |
27 | #define PFX DRV_MODULE_NAME ": " | 28 | #define PFX DRV_MODULE_NAME ": " |
@@ -158,9 +159,9 @@ static struct chmc_bank_info *chmc_find_bank(unsigned long phys_addr) | |||
158 | /* This is the main purpose of this driver. */ | 159 | /* This is the main purpose of this driver. */ |
159 | #define SYNDROME_MIN -1 | 160 | #define SYNDROME_MIN -1 |
160 | #define SYNDROME_MAX 144 | 161 | #define SYNDROME_MAX 144 |
161 | int chmc_getunumber(int syndrome_code, | 162 | static int chmc_print_dimm(int syndrome_code, |
162 | unsigned long phys_addr, | 163 | unsigned long phys_addr, |
163 | char *buf, int buflen) | 164 | char *buf, int buflen) |
164 | { | 165 | { |
165 | struct chmc_bank_info *bp; | 166 | struct chmc_bank_info *bp; |
166 | struct chmc_obp_mem_layout *prop; | 167 | struct chmc_obp_mem_layout *prop; |
@@ -466,16 +467,26 @@ static inline bool chmc_platform(void) | |||
466 | 467 | ||
467 | static int __init chmc_init(void) | 468 | static int __init chmc_init(void) |
468 | { | 469 | { |
470 | int ret; | ||
471 | |||
469 | if (!chmc_platform()) | 472 | if (!chmc_platform()) |
470 | return -ENODEV; | 473 | return -ENODEV; |
471 | 474 | ||
472 | return of_register_driver(&chmc_driver, &of_bus_type); | 475 | ret = register_dimm_printer(chmc_print_dimm); |
476 | if (!ret) { | ||
477 | ret = of_register_driver(&chmc_driver, &of_bus_type); | ||
478 | if (ret) | ||
479 | unregister_dimm_printer(chmc_print_dimm); | ||
480 | } | ||
481 | return ret; | ||
473 | } | 482 | } |
474 | 483 | ||
475 | static void __exit chmc_cleanup(void) | 484 | static void __exit chmc_cleanup(void) |
476 | { | 485 | { |
477 | if (chmc_platform()) | 486 | if (chmc_platform()) { |
487 | unregister_dimm_printer(chmc_print_dimm); | ||
478 | of_unregister_driver(&chmc_driver); | 488 | of_unregister_driver(&chmc_driver); |
489 | } | ||
479 | } | 490 | } |
480 | 491 | ||
481 | module_init(chmc_init); | 492 | module_init(chmc_init); |