Attention is currently required from: Nico Huber. Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/52604 )
Change subject: [RFC] tests: Abstract port I/O and factor mec1308 specifics out ......................................................................
Patch Set 1:
(3 comments)
Patchset:
PS1: Nico thank you so much, you really help me, this patch explains the idea perfectly!! I need some time, I am implementing this idea gradually. Two thoughts, added as comments.
File tests/init_shutdown.c:
https://review.coreboot.org/c/flashrom/+/52604/comment/a632b596_4c0c6537 PS1, Line 63: .outb = mec1308_outb, I think, maybe I could get away with a default implementation of outx functions, and only customise inx functions? And this also means have 3 variables in io_mock uint8_t outb_val uint16_t outw_val uint32_t outl_val instead of void *priv. Outx functions are mocked, so they do not do any actual output. The only useful thing could be the value passed to outx, the value definitely needed to be stored.
Having said that, maybe you see further than me and you see that default outx won't be sufficient? what do you think?
File tests/tests.c:
https://review.coreboot.org/c/flashrom/+/52604/comment/6605b34b_ef93274a PS1, Line 23: const struct io_mock *current_io = NULL; Do you think it would work if I try to swap this line with extern definition in io_mock.h ? I want to try have extern const struct definition for current_io here (without assigning to NULL), and const struct with = NULL in io_mock.h
The reason is, it wasn't easy for me to understand why current_io is assigned NULL on the top, and then used in functions below. It takes some time (at least it took some time for me) to understand that current_io is reassigned in different file. When it is extern without any assignment, it is more clear that it is taken care of elsewhere.
I want to try swap lines, hope it can work.