[coreboot] smbus_xxx functions
haleigh at edt.com
Tue Oct 11 01:36:13 CEST 2016
Firstly this is sort of building off of the suggestions from the "i2c_writeb vs i2c_raw_write output" thread; I have looked into the smbus_xxx() functions and they might do the trick. So basically what I am trying to do is send the POSTcodes to somewhere I can read them and at the moment the most convenient choices were i2c, spi and now smbus; with smbus looking the most promising. So the easiest way (i thought) would be to modify post_code() function in coreboot/src/console/post.c just temporarily adding a modification at the end of the function. I have included the 'device/smbus.h' header - at the suggestion of Mr. Werner, Mr. Kyosti, and Mr. Laurie - to allow for use (or so I thought) of the smbus functions. The following is a my output from a clean make. I do not know if the email will send in plain text indented as I have it so the error carrot is pointing up under the '->' between 'ops' and 'ops_smbus_bus'; the error instance of the error in post.c is within the #include set as well as seen below post.c(22) is '#include <device/smbus.h>'.
# configuration written to /home/test/coreboot_2/coreboot/.config
HOSTCC util/sconfig/sconfig (link)
HOSTCC nvramtool/nvramtool (link)
HOSTCC util/romcc/romcc (this may take a while)
Warning: Nonexistent include path: `src/vendorcode/amd/agesa/f16kb/Lib'
In file included from src/console/post.c:22:0:
src/include/device/smbus.h: In function 'ops_smbus_bus':
src/include/device/smbus.h:30:27: error: dereferencing pointer to incomplete type 'struct device_operations'
bops = bus->dev->ops->ops_smbus_bus;
make: *** [build/bootblock/console/post.o] Error 1
I have tried the following without avail:
~ rearranging the #include statements (does not to help at all)
~ looking at the makefile output of an unmodified bootable version I have of coreboot (used for reference and a fresh start if needed) to see if the files contain smbus.h in the inclusions - some do but much further down in the makefile output and the 'smbus.h' is in quotes not <> because it is in the same folder as the referencing file
~ googling "dereferencing pointer to incomplete type", "dereferencing pointer to incomplete struct type", "dereferencing coreboot pointer to incomplete type", etc - which the results are 99% solved by including a header file but the two I need ('device.h' and 'smbus.h') are included
~ adding 'struct device_operations;' to the top of the file - both 'post.c' and 'smbus.h'
~ figuring out where all the structs referenced in the 'bops = ....' they are all in 'src/include/device/device.h' which is included in 'post.c' and 'smbus.h'
~ checking if there are any guards and they either match or arent there ex: in 'device.h' the 'device_operations' struct is in a 'ifndef(__SIMPLE_DEVICE__) guard so I made sure that 'post.c' and 'smbus.h' are not _SIMPLE_DEVICE_
~ going in 'smbus.h' to set the bus->dev->ops to equal a 'struct device_operations' pointer and using said pointer to get 'ops_smbus_bus' with a cast
~ replacing '->' with '.'
I feel like I don't really understand the error because either coreboot provides a 'special case' scenario here, or that I am completely missing something, or that I do not understand the transactions as well as I thought.
Thank you for your time.
More information about the coreboot