1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 22:21:16 +02:00

Unify PCI init and let pcidev clean itself up

Previously the internal programmer used its own code to initialize pcilib.
This patch extracts the common code from the internal programmer and
pcidev_init() into pcidev_init_common().
This fixes the non-existent PCI cleanup of the internal programmer and adds
an additional safety by checking for an already existing PCI context.

We got a nice shutdown function registration infrastructure, but did not use it
very wisely. Instead we added shutdown functions to a myriad of programmers
unnecessarily. In this patch we get rid of those that do only call pci_cleanup(pacc)
by adding a shutdown function the pcidev.c itself that gets registered by
pcidev_init().

Corresponding to flashrom svn r1642.

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:
Stefan Tauner
2013-01-04 22:24:58 +00:00
parent 30dfdbaf3a
commit 5561955b11
13 changed files with 44 additions and 41 deletions

View File

@ -60,7 +60,6 @@ static const struct par_programmer par_programmer_satamv = {
static int satamv_shutdown(void *data)
{
physunmap(mv_bar, 0x20000);
pci_cleanup(pacc);
return 0;
}
@ -96,7 +95,7 @@ int satamv_init(void)
mv_bar = physmap("Marvell 88SX7042 registers", addr, 0x20000);
if (mv_bar == ERROR_PTR)
goto error_out;
return 1;
if (register_shutdown(satamv_shutdown, NULL))
return 1;
@ -159,10 +158,6 @@ int satamv_init(void)
register_par_programmer(&par_programmer_satamv, BUS_PARALLEL);
return 0;
error_out:
pci_cleanup(pacc);
return 1;
}
/* BAR2 (MEM) can map NVRAM and flash. We set it to flash in the init function.