[LinuxBIOS] proper way to pass an array between functions

Corey Osgood corey_osgood at verizon.net
Tue May 22 13:15:14 CEST 2007


Okay, this is stupid, I know. K&R hasn't helped so far, because they
deal with static arrays within the same function, at least as far as
I've skimmed. I'm trying to define an array of unsigned longs in
sdram_enable, pass that to spd_set_sdram_registers where its set to the
address offsets, and then have it used in do_ram_command to read from
those offsets. What's the proper way to do this? Just an example of what
I'm doing, hopefully someone can point out my error:

define it:
unsigned long row_offsets[DIMM_SOCKETS * 2 - 1];

pass it on:
spd_set_dram_size(ctrl, row_offsets);

accept it:
static void spd_set_dram_size(const struct mem_controller *ctrl,
unsigned long row_offsets)

set it:
row_offsets[i * 2] = (dimm_size * 4 * 1024);

use it (in do_ram_command):
read32(row_offsets[i] + addr_offset);

And the gcc error:
/LinuxBIOSv2/src/mainboard/asus/mew-vm/auto.c -o auto.inc
raminit.c:97.37:  <which is where do_ram_command is defined, similar to
spd_set_dram_size above>
subscripted value is not a pointer
make[1]: *** [auto.inc] Error 1
make[1]: Leaving directory
`/home/amp/linuxbios/p2b/LinuxBIOSv2/targets/asus/mew-vm/mew-vm/normal'
make: *** [normal/linuxbios.rom] Error 1

BTW, I've gotten the i810 as far as booting a filo payload (looking for
linux in the wrong location), but haven't tried any further than that
yet. Will probably try further once I can get this straightened out.

Thanks,
Corey




More information about the coreboot mailing list