mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-01 06:21:52 -06:00
ppc/pnv: Move the PNOR LPC address into struct PnvPnor
Rather than use the hardcoded define throughout the tree for the
PNOR LPC address, keep it within the PnvPnor object.
This should solve a dead code issue in the BMC HIOMAP checks where
Coverity (correctly) reported that the sanity checks are dead code.
We would like to keep the sanity checks without turning them into a
compile time assert in case we would like to make them configurable
in future.
Fixes: 4c84a0a4a6
("ppc/pnv: Add a PNOR address and size sanity checks")
Resolves: Coverity CID 1593723
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
This commit is contained in:
parent
965797d19a
commit
ce5a32d180
4 changed files with 6 additions and 3 deletions
|
@ -1191,7 +1191,7 @@ static void pnv_init(MachineState *machine)
|
||||||
* Since we can not reach the remote BMC machine with LPC memops,
|
* Since we can not reach the remote BMC machine with LPC memops,
|
||||||
* map it always for now.
|
* map it always for now.
|
||||||
*/
|
*/
|
||||||
memory_region_add_subregion(pnv->chips[0]->fw_mr, PNOR_SPI_OFFSET,
|
memory_region_add_subregion(pnv->chips[0]->fw_mr, pnv->pnor->lpc_address,
|
||||||
&pnv->pnor->mmio);
|
&pnv->pnor->mmio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -174,8 +174,8 @@ static void hiomap_cmd(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len,
|
||||||
{
|
{
|
||||||
PnvPnor *pnor = PNV_PNOR(object_property_get_link(OBJECT(ibs), "pnor",
|
PnvPnor *pnor = PNV_PNOR(object_property_get_link(OBJECT(ibs), "pnor",
|
||||||
&error_abort));
|
&error_abort));
|
||||||
|
uint32_t pnor_addr = pnor->lpc_address;
|
||||||
uint32_t pnor_size = pnor->size;
|
uint32_t pnor_size = pnor->size;
|
||||||
uint32_t pnor_addr = PNOR_SPI_OFFSET;
|
|
||||||
bool readonly = false;
|
bool readonly = false;
|
||||||
|
|
||||||
rsp_buffer_push(rsp, cmd[2]);
|
rsp_buffer_push(rsp, cmd[2]);
|
||||||
|
@ -251,8 +251,8 @@ static const IPMINetfn hiomap_netfn = {
|
||||||
|
|
||||||
void pnv_bmc_set_pnor(IPMIBmc *bmc, PnvPnor *pnor)
|
void pnv_bmc_set_pnor(IPMIBmc *bmc, PnvPnor *pnor)
|
||||||
{
|
{
|
||||||
|
uint32_t pnor_addr = pnor->lpc_address;
|
||||||
uint32_t pnor_size = pnor->size;
|
uint32_t pnor_size = pnor->size;
|
||||||
uint32_t pnor_addr = PNOR_SPI_OFFSET;
|
|
||||||
|
|
||||||
if (!pnv_bmc_is_simulator(bmc)) {
|
if (!pnv_bmc_is_simulator(bmc)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -108,6 +108,8 @@ static void pnv_pnor_realize(DeviceState *dev, Error **errp)
|
||||||
memset(s->storage, 0xFF, s->size);
|
memset(s->storage, 0xFF, s->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s->lpc_address = PNOR_SPI_OFFSET;
|
||||||
|
|
||||||
memory_region_init_io(&s->mmio, OBJECT(s), &pnv_pnor_ops, s,
|
memory_region_init_io(&s->mmio, OBJECT(s), &pnv_pnor_ops, s,
|
||||||
TYPE_PNV_PNOR, s->size);
|
TYPE_PNV_PNOR, s->size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ struct PnvPnor {
|
||||||
BlockBackend *blk;
|
BlockBackend *blk;
|
||||||
|
|
||||||
uint8_t *storage;
|
uint8_t *storage;
|
||||||
|
uint32_t lpc_address; /* Offset within LPC FW space */
|
||||||
int64_t size;
|
int64_t size;
|
||||||
MemoryRegion mmio;
|
MemoryRegion mmio;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue