mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 14:11:15 +02:00
programmer: Drop dead fallback_map() boilerplate
The fallback_{un}map() boilerplate code doesn't do anything, merely distracts away from otherwise linear control flow. Just drop it as anything in the future that could need such a thing is free to implement it when required. Change-Id: Ibb7760f807fae040416cef2797a7dbf6572f7df9 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/68963 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
This commit is contained in:

committed by
Felix Singer

parent
801e7c1674
commit
c0813e7edd
12
flashrom.c
12
flashrom.c
@ -215,11 +215,15 @@ void *master_map_flash_region(const struct registered_master *mst,
|
|||||||
else if (mst->buses_supported & BUS_NONSPI)
|
else if (mst->buses_supported & BUS_NONSPI)
|
||||||
map_flash_region = mst->par.map_flash_region;
|
map_flash_region = mst->par.map_flash_region;
|
||||||
|
|
||||||
void *ret;
|
/* A result of NULL causes mapped addresses to be chip physical
|
||||||
|
* addresses, assuming only a single region is mapped (the entire flash
|
||||||
|
* space). Chips with a second region (like a register map) require a
|
||||||
|
* real memory mapping to distinguish the different ranges. Those chips
|
||||||
|
* are FWH/LPC, so the bus master provides a real mapping.
|
||||||
|
*/
|
||||||
|
void *ret = NULL;
|
||||||
if (map_flash_region)
|
if (map_flash_region)
|
||||||
ret = map_flash_region(descr, phys_addr, len);
|
ret = map_flash_region(descr, phys_addr, len);
|
||||||
else
|
|
||||||
ret = fallback_map(descr, phys_addr, len);
|
|
||||||
msg_gspew("%s: mapping %s from 0x%0*" PRIxPTR " to 0x%0*" PRIxPTR "\n",
|
msg_gspew("%s: mapping %s from 0x%0*" PRIxPTR " to 0x%0*" PRIxPTR "\n",
|
||||||
__func__, descr, PRIxPTR_WIDTH, phys_addr, PRIxPTR_WIDTH, (uintptr_t) ret);
|
__func__, descr, PRIxPTR_WIDTH, phys_addr, PRIxPTR_WIDTH, (uintptr_t) ret);
|
||||||
return ret;
|
return ret;
|
||||||
@ -236,8 +240,6 @@ void master_unmap_flash_region(const struct registered_master *mst,
|
|||||||
|
|
||||||
if (unmap_flash_region)
|
if (unmap_flash_region)
|
||||||
unmap_flash_region(virt_addr, len);
|
unmap_flash_region(virt_addr, len);
|
||||||
else
|
|
||||||
fallback_unmap(virt_addr, len);
|
|
||||||
msg_gspew("%s: unmapped 0x%0*" PRIxPTR "\n", __func__, PRIxPTR_WIDTH, (uintptr_t)virt_addr);
|
msg_gspew("%s: unmapped 0x%0*" PRIxPTR "\n", __func__, PRIxPTR_WIDTH, (uintptr_t)virt_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,8 +439,6 @@ struct par_master {
|
|||||||
int register_par_master(const struct par_master *mst, const enum chipbustype buses, void *data);
|
int register_par_master(const struct par_master *mst, const enum chipbustype buses, void *data);
|
||||||
|
|
||||||
/* programmer.c */
|
/* programmer.c */
|
||||||
void *fallback_map(const char *descr, uintptr_t phys_addr, size_t len);
|
|
||||||
void fallback_unmap(void *virt_addr, size_t len);
|
|
||||||
void fallback_chip_writew(const struct flashctx *flash, uint16_t val, chipaddr addr);
|
void fallback_chip_writew(const struct flashctx *flash, uint16_t val, chipaddr addr);
|
||||||
void fallback_chip_writel(const struct flashctx *flash, uint32_t val, chipaddr addr);
|
void fallback_chip_writel(const struct flashctx *flash, uint32_t val, chipaddr addr);
|
||||||
void fallback_chip_writen(const struct flashctx *flash, const uint8_t *buf, chipaddr addr, size_t len);
|
void fallback_chip_writen(const struct flashctx *flash, const uint8_t *buf, chipaddr addr, size_t len);
|
||||||
|
@ -76,7 +76,7 @@ int register_par_master(const struct par_master *mst,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bus masters supporting FWH/LPC cannot use fallback_map(), distinct
|
/* Bus masters supporting FWH/LPC cannot use chip physical maps, distinct
|
||||||
* mappings are needed to support chips with FEATURE_REGISTERMAP
|
* mappings are needed to support chips with FEATURE_REGISTERMAP
|
||||||
*/
|
*/
|
||||||
if ((buses & (BUS_FWH | BUS_LPC)) && !mst->map_flash_region) {
|
if ((buses & (BUS_FWH | BUS_LPC)) && !mst->map_flash_region) {
|
||||||
|
17
programmer.c
17
programmer.c
@ -17,23 +17,6 @@
|
|||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
|
|
||||||
/* Fallback map() for programmers which don't need special handling */
|
|
||||||
void *fallback_map(const char *descr, uintptr_t phys_addr, size_t len)
|
|
||||||
{
|
|
||||||
/* A result of NULL causes mapped addresses to be chip physical
|
|
||||||
* addresses, assuming only a single region is mapped (the entire flash
|
|
||||||
* space). Chips with a second region (like a register map) require a
|
|
||||||
* real memory mapping to distinguish the different ranges. Those chips
|
|
||||||
* are FWH/LPC, so the bus master provides a real mapping.
|
|
||||||
*/
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* No-op/fallback unmap() for programmers which don't need special handling */
|
|
||||||
void fallback_unmap(void *virt_addr, size_t len)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Little-endian fallback for drivers not supporting 16 bit accesses */
|
/* Little-endian fallback for drivers not supporting 16 bit accesses */
|
||||||
void fallback_chip_writew(const struct flashctx *flash, uint16_t val,
|
void fallback_chip_writew(const struct flashctx *flash, uint16_t val,
|
||||||
chipaddr addr)
|
chipaddr addr)
|
||||||
|
Reference in New Issue
Block a user