Hello Thomas and Anastasia,

Thank you for the quick answer. Now I understand the idea of the
project more correctly. It really will be great if programmers
have their own shutdown functions.

In your example you have used pci_write_*(), but the real flashrom
code uses only rpci_write_* (it registers an undo-callback). Saving
the data to some structure on every pci_write_*() is unnecessary
complexity. So, we can continue to use rpci_write_*(), which will do
work for us, but in a different way. The main problem is that
register_shutdown() often occurs not in example_init(), but in its
called funcs. Let's see on the example of internal programmer:

internal_init() -> chipset_flash_enable() -> 
-> chipset_enables[i].doit() -> enable_flash_vt823x()

The last one can contain 1 or more rpci_write_*(). I suggest not to
register shutdown in rcpi_write_*(), but to fill a linked list with
value that should be restored. It will be restored in
example_shutdown().

Should global variables be used? In the case of an internal
programmer, struct example_data will go a long way before data is
written to it.
_______________________________________________
flashrom mailing list -- flashrom@flashrom.org
To unsubscribe send an email to flashrom-le...@flashrom.org

Reply via email to