Author: rminnich
Date: 2008-09-17 04:19:59 +0200 (Wed, 17 Sep 2008)
New Revision: 863

Modified:
   coreboot-v3/include/globalvars.h
   coreboot-v3/southbridge/amd/cs5536/smbus_initram.c
Log:
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 <[EMAIL PROTECTED]>

Acked-by: Carl-Daniel Hailfinger <[EMAIL PROTECTED]>


Modified: coreboot-v3/include/globalvars.h
===================================================================
--- coreboot-v3/include/globalvars.h    2008-09-16 03:21:29 UTC (rev 862)
+++ coreboot-v3/include/globalvars.h    2008-09-17 02:19:59 UTC (rev 863)
@@ -53,6 +53,8 @@
        /* 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 */

Modified: coreboot-v3/southbridge/amd/cs5536/smbus_initram.c
===================================================================
--- coreboot-v3/southbridge/amd/cs5536/smbus_initram.c  2008-09-16 03:21:29 UTC 
(rev 862)
+++ coreboot-v3/southbridge/amd/cs5536/smbus_initram.c  2008-09-17 02:19:59 UTC 
(rev 863)
@@ -321,11 +321,11 @@
  */
 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);


--
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to