Message ID | 20170323061509.4231-3-mikey@neuling.org |
---|---|
State | Accepted |
Headers | show |
On 03/23/2017 07:15 AM, Michael Neuling wrote: > Indirect scoms can only set certain bits of data. Ensure only these > are set when trying to write. > > Signed-off-by: Michael Neuling <mikey@neuling.org> Reviewed-by: Cédric Le Goater <clg@kaod.org> > --- > hw/xscom.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/hw/xscom.c b/hw/xscom.c > index 6fde427f1e..b0bc260087 100644 > --- a/hw/xscom.c > +++ b/hw/xscom.c > @@ -369,6 +369,10 @@ static int xscom_indirect_write(uint32_t gcid, uint64_t pcb_addr, uint64_t val) > if (proc_gen < proc_gen_p8) > return OPAL_UNSUPPORTED; > > + /* Only 16 bit data with indirect */ > + if (val & ~(XSCOM_ADDR_IND_DATA)) > + return OPAL_PARAMETER; > + > /* Write indirect address & data */ > addr = pcb_addr & 0x7fffffff; > data = pcb_addr & XSCOM_ADDR_IND_ADDR; >
diff --git a/hw/xscom.c b/hw/xscom.c index 6fde427f1e..b0bc260087 100644 --- a/hw/xscom.c +++ b/hw/xscom.c @@ -369,6 +369,10 @@ static int xscom_indirect_write(uint32_t gcid, uint64_t pcb_addr, uint64_t val) if (proc_gen < proc_gen_p8) return OPAL_UNSUPPORTED; + /* Only 16 bit data with indirect */ + if (val & ~(XSCOM_ADDR_IND_DATA)) + return OPAL_PARAMETER; + /* Write indirect address & data */ addr = pcb_addr & 0x7fffffff; data = pcb_addr & XSCOM_ADDR_IND_ADDR;
Indirect scoms can only set certain bits of data. Ensure only these are set when trying to write. Signed-off-by: Michael Neuling <mikey@neuling.org> --- hw/xscom.c | 4 ++++ 1 file changed, 4 insertions(+)