amd/gx2 + amd/lx: Fix shift overflow issue

gcc 6.1 complains that SMM_OFFSET << 8 is larger than the register
it is assigned to (rightly so):

src/northbridge/amd/gx2/northbridgeinit.c:196:23: error: result of
    '1077936128 << 8' requires 40 bits to represent, but 'int' only
    has 32 bits [-Werror=shift-overflow=]
  msr.lo = (SMM_OFFSET << 8) & 0xfff00000;
                       ^~

Change-Id: Ib0d669268202d222574abee335a6a65c8a255cc7
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: https://review.coreboot.org/14617
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Stefan Reinauer 2016-05-04 16:26:44 -07:00 committed by Martin Roth
parent 24850ccf9b
commit 617536e580
2 changed files with 4 additions and 4 deletions

View File

@ -177,7 +177,7 @@ static void SMMGL0Init(struct gliutable *gl)
msr.hi = offset << 8 | gl->hi; msr.hi = offset << 8 | gl->hi;
msr.hi |= SMM_OFFSET >> 24; msr.hi |= SMM_OFFSET >> 24;
msr.lo = SMM_OFFSET << 8; msr.lo = (SMM_OFFSET & 0x00ffffff) << 8;
msr.lo |= ((~(SMM_SIZE * 1024) + 1) >> 12) & 0xfffff; msr.lo |= ((~(SMM_SIZE * 1024) + 1) >> 12) & 0xfffff;
wrmsr(gl->desc_name, msr); /* MSR - See table above */ wrmsr(gl->desc_name, msr); /* MSR - See table above */
@ -193,7 +193,7 @@ static void SMMGL1Init(struct gliutable *gl)
/* I don't think this is needed */ /* I don't think this is needed */
msr.hi &= 0xffffff00; msr.hi &= 0xffffff00;
msr.hi |= (SMM_OFFSET >> 24); msr.hi |= (SMM_OFFSET >> 24);
msr.lo = (SMM_OFFSET << 8) & 0xfff00000; msr.lo = (SMM_OFFSET & 0x00fff000) << 8;
msr.lo |= ((~(SMM_SIZE * 1024) + 1) >> 12) & 0xfffff; msr.lo |= ((~(SMM_SIZE * 1024) + 1) >> 12) & 0xfffff;
wrmsr(gl->desc_name, msr); /* MSR - See table above */ wrmsr(gl->desc_name, msr); /* MSR - See table above */

View File

@ -164,7 +164,7 @@ static void SMMGL0Init(struct gliutable *gl)
msr.hi = offset << 8 | gl->hi; msr.hi = offset << 8 | gl->hi;
msr.hi |= SMM_OFFSET >> 24; msr.hi |= SMM_OFFSET >> 24;
msr.lo = SMM_OFFSET << 8; msr.lo = (SMM_OFFSET & 0x00ffffff) << 8;
msr.lo |= ((~(SMM_SIZE * 1024) + 1) >> 12) & 0xfffff; msr.lo |= ((~(SMM_SIZE * 1024) + 1) >> 12) & 0xfffff;
wrmsr(gl->desc_name, msr); // MSR - See table above wrmsr(gl->desc_name, msr); // MSR - See table above
@ -181,7 +181,7 @@ static void SMMGL1Init(struct gliutable *gl)
/* I don't think this is needed */ /* I don't think this is needed */
msr.hi &= 0xffffff00; msr.hi &= 0xffffff00;
msr.hi |= (SMM_OFFSET >> 24); msr.hi |= (SMM_OFFSET >> 24);
msr.lo = (SMM_OFFSET << 8) & 0xFFF00000; msr.lo = (SMM_OFFSET & 0x00fff000) << 8;
msr.lo |= ((~(SMM_SIZE * 1024) + 1) >> 12) & 0xfffff; msr.lo |= ((~(SMM_SIZE * 1024) + 1) >> 12) & 0xfffff;
wrmsr(gl->desc_name, msr); // MSR - See table above wrmsr(gl->desc_name, msr); // MSR - See table above