Carl-Daniel Hailfinger wrote:
v3 can't use global variables in stage1 or initram. Same applies to static local variables. See the bug below.
Ideas for fixes? The generic variable infrastructure would be one option.
Just call smbus_init() prior to calling smbus_read_byte() the first time. The variable infrastructure might be a nice idea for some things, but I think in cases as simple as this, we should not rely on it.
Is there a method to change variables in your "variable infrastructure" across cpus? If so, it could be useful for semaphores / locking. But I don't think that's possible since the stuff is in cache, right?
int smbus_read_byte(u16 device, u8 address) { //BUG here! static int first_time = 1;
if (first_time) { smbus_init(); first_time = 0; }
return do_smbus_read_byte(SMBUS_IO_BASE, device, address); }
Regards, Carl-Daniel