mirror of
https://review.coreboot.org/flashrom.git
synced 2025-06-30 21:52:36 +02:00
Use shutdown callback mechanism to shutdown programmers
This patch attempts to resolve some programmer shutdown ordering issues by having the programmer init functions register shutdown callbacks explicitly wherever it makes most sense. Before, assumptions were made that could lead to the internal programmer's state changing before the external programmer could be shut down properly. Now, each programmer cleans up after itself and (hopefully) performs each operation in the correct order. As a side-effect, this patch gives us a better usage model for reverse operations such as rpci_* and rmmio_*. In the long-run, this should make reversing the initialization process easier to understand, less tedious, and less error-prone. In short, this patch does the following: - Registers a shutdown callback during initialization for each programmer. - Kills the .shutdown function pointer from programmer_entry struct. Also, make most shutdown functions static. - Adds a few minor clean-ups and corrections (e.g. missing physunmap() calls). TODO: Remove forward declaration of serprog_shutdown() (added to simplify diff) Corresponding to flashrom svn r1338. Signed-off-by: David Hendricks <dhendrix@google.com> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:

committed by
David Hendricks

parent
9d9a104233
commit
8bb2021d77
2
flash.h
2
flash.h
@ -40,7 +40,7 @@
|
||||
|
||||
typedef unsigned long chipaddr;
|
||||
|
||||
int register_shutdown(void (*function) (void *data), void *data);
|
||||
int register_shutdown(int (*function) (void *data), void *data);
|
||||
void *programmer_map_flash_region(const char *descr, unsigned long phys_addr,
|
||||
size_t len);
|
||||
void programmer_unmap_flash_region(void *virt_addr, size_t len);
|
||||
|
Reference in New Issue
Block a user