summaryrefslogtreecommitdiffstats
path: root/atapromise.c
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2021-05-24 20:33:45 +1000
committerEdward O'Callaghan <quasisec@chromium.org>2021-05-27 02:36:32 +0000
commitad8eb60e5d559e113a73e13213846938fded03de (patch)
tree62ab8787767ec99a6948ad53e38aef771bab5c1c /atapromise.c
parent4f537721036c73381c073c7c9a1569275fd4333a (diff)
downloadflashrom-ad8eb60e5d559e113a73e13213846938fded03de.tar.gz
flashrom-ad8eb60e5d559e113a73e13213846938fded03de.tar.bz2
flashrom-ad8eb60e5d559e113a73e13213846938fded03de.zip
par_masters: Reshuffle to remove forward declarations
Dispense with all these forward declarations by way of ordering. Just deal with all the par_masters in one go to be over and done with. BUG=none BRANCH=none TEST=builds Change-Id: I88e89992380195fee7c9de7ec57502ab980ec5df Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/54873 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'atapromise.c')
-rw-r--r--atapromise.c55
1 files changed, 26 insertions, 29 deletions
diff --git a/atapromise.c b/atapromise.c
index f32bdb498..4941a7c28 100644
--- a/atapromise.c
+++ b/atapromise.c
@@ -53,20 +53,6 @@ const struct dev_entry ata_promise[] = {
{0},
};
-static void atapromise_chip_writeb(const struct flashctx *flash, uint8_t val, chipaddr addr);
-static uint8_t atapromise_chip_readb(const struct flashctx *flash, const chipaddr addr);
-
-static const struct par_master par_master_atapromise = {
- .chip_readb = atapromise_chip_readb,
- .chip_readw = fallback_chip_readw,
- .chip_readl = fallback_chip_readl,
- .chip_readn = fallback_chip_readn,
- .chip_writeb = atapromise_chip_writeb,
- .chip_writew = fallback_chip_writew,
- .chip_writel = fallback_chip_writel,
- .chip_writen = fallback_chip_writen,
-};
-
void *atapromise_map(const char *descr, uintptr_t phys_addr, size_t len)
{
/* In case fallback_map ever returns something other than NULL. */
@@ -106,6 +92,32 @@ static void atapromise_limit_chip(struct flashchip *chip)
}
}
+static void atapromise_chip_writeb(const struct flashctx *flash, uint8_t val, chipaddr addr)
+{
+ uint32_t data;
+
+ atapromise_limit_chip(flash->chip);
+ data = (rom_base_addr + (addr & ADDR_MASK)) << 8 | val;
+ OUTL(data, io_base_addr + 0x14);
+}
+
+static uint8_t atapromise_chip_readb(const struct flashctx *flash, const chipaddr addr)
+{
+ atapromise_limit_chip(flash->chip);
+ return pci_mmio_readb(atapromise_bar + (addr & ADDR_MASK));
+}
+
+static const struct par_master par_master_atapromise = {
+ .chip_readb = atapromise_chip_readb,
+ .chip_readw = fallback_chip_readw,
+ .chip_readl = fallback_chip_readl,
+ .chip_readn = fallback_chip_readn,
+ .chip_writeb = atapromise_chip_writeb,
+ .chip_writew = fallback_chip_writew,
+ .chip_writel = fallback_chip_writel,
+ .chip_writen = fallback_chip_writen,
+};
+
int atapromise_init(void)
{
struct pci_dev *dev = NULL;
@@ -150,21 +162,6 @@ int atapromise_init(void)
return 0;
}
-static void atapromise_chip_writeb(const struct flashctx *flash, uint8_t val, chipaddr addr)
-{
- uint32_t data;
-
- atapromise_limit_chip(flash->chip);
- data = (rom_base_addr + (addr & ADDR_MASK)) << 8 | val;
- OUTL(data, io_base_addr + 0x14);
-}
-
-static uint8_t atapromise_chip_readb(const struct flashctx *flash, const chipaddr addr)
-{
- atapromise_limit_chip(flash->chip);
- return pci_mmio_readb(atapromise_bar + (addr & ADDR_MASK));
-}
-
#else
#error PCI port I/O access is not supported on this architecture yet.
#endif