From 5a74d7889b3175972b1df76e6b4e20047ef95f72 Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Wed, 17 Sep 2008 02:19:59 +0000 Subject: [PATCH] Here is an alternate approach to getting rid of the static in cs5536 smbus. Set up a global var variable called spd_inited. It is set when spd is inited. For simple cases, nothing is visible to initram main. For complex cases, initram main can do the work and set this variable. This compiles and runs on dbe62, which is actually meaningless since dbe62 has not smbus, but hey ... Signed-off-by: Ronald G. Minnich Acked-by: Carl-Daniel Hailfinger git-svn-id: svn://coreboot.org/repository/coreboot-v3@863 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- include/globalvars.h | 2 ++ southbridge/amd/cs5536/smbus_initram.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/globalvars.h b/include/globalvars.h index b1f4ec5cc2..b144e19f98 100644 --- a/include/globalvars.h +++ b/include/globalvars.h @@ -53,6 +53,8 @@ struct global_vars { /* these two values are of interest in many stages */ u32 init_detected; struct sys_info sys_info; + /* has the spd hardware been set up? */ + int spd_inited; }; #endif /* GLOBALVARS_H */ diff --git a/southbridge/amd/cs5536/smbus_initram.c b/southbridge/amd/cs5536/smbus_initram.c index 989a705903..8304f43c20 100644 --- a/southbridge/amd/cs5536/smbus_initram.c +++ b/southbridge/amd/cs5536/smbus_initram.c @@ -321,11 +321,11 @@ err: */ int smbus_read_byte(u16 device, u8 address) { - static int first_time = 1; + struct global_vars *g = global_vars(); - if (first_time) { + if (!g->spd_inited) { smbus_init(); - first_time = 0; + g->spd_inited = 1; } return do_smbus_read_byte(SMBUS_IO_BASE, device, address);