mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 22:21:16 +02:00
Automatically unmap physmap()s
Similarly to the previous PCI self-clean up patch this one allows to get rid of a huge number of programmer shutdown functions and makes introducing bugs harder. It adds a new function rphysmap() that takes care of unmapping at shutdown. Callers are changed where it makes sense. Corresponding to flashrom svn r1714. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
14
satasii.c
14
satasii.c
@ -54,12 +54,6 @@ static const struct par_programmer par_programmer_satasii = {
|
||||
.chip_writen = fallback_chip_writen,
|
||||
};
|
||||
|
||||
static int satasii_shutdown(void *data)
|
||||
{
|
||||
physunmap(sii_bar, SATASII_MEMMAP_SIZE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t satasii_wait_done(void)
|
||||
{
|
||||
uint32_t ctrl_reg;
|
||||
@ -97,15 +91,15 @@ int satasii_init(void)
|
||||
reg_offset = 0x50;
|
||||
}
|
||||
|
||||
sii_bar = physmap("SATA SiI registers", addr, SATASII_MEMMAP_SIZE) + reg_offset;
|
||||
sii_bar = rphysmap("SATA SiI registers", addr, SATASII_MEMMAP_SIZE);
|
||||
if (sii_bar == ERROR_PTR)
|
||||
return 1;
|
||||
sii_bar += reg_offset;
|
||||
|
||||
/* Check if ROM cycle are OK. */
|
||||
if ((id != 0x0680) && (!(pci_mmio_readl(sii_bar) & (1 << 26))))
|
||||
msg_pwarn("Warning: Flash seems unconnected.\n");
|
||||
|
||||
if (register_shutdown(satasii_shutdown, NULL))
|
||||
return 1;
|
||||
|
||||
register_par_programmer(&par_programmer_satasii, BUS_PARALLEL);
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user