diff options
-rw-r--r-- | src/soc/intel/common/basecode/ramtop/ramtop.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/soc/intel/common/basecode/ramtop/ramtop.c b/src/soc/intel/common/basecode/ramtop/ramtop.c index 568526f44e..bf85fa8efc 100644 --- a/src/soc/intel/common/basecode/ramtop/ramtop.c +++ b/src/soc/intel/common/basecode/ramtop/ramtop.c @@ -11,8 +11,6 @@ #define RAMTOP_SIGNATURE 0x52544F50 /* 'RTOP' */ -#define RAMTOP_CMOS_OFFSET 0x64 - /* * Address of the ramtop byte in CMOS. Should be reserved * in mainboards' cmos.layout and not covered by checksum. @@ -20,13 +18,18 @@ #if CONFIG(USE_OPTION_TABLE) #include "option_table.h" -#if CMOS_VSTART_ramtop != RAMTOP_CMOS_OFFSET * 8 -#error "CMOS start for RAMTOP_CMOS is not correct, check your cmos.layout" -#endif + +#if CMOS_VSTART_ramtop % 8 != 0 +#error "The `ramtop` CMOS entry needs to be byte aligned, check your cmos.layout." +#endif // CMOS_VSTART_ramtop % 8 != 0 + #if CMOS_VLEN_ramtop != 12 #error "CMOS length for RAMTOP_CMOS bytes are not correct, check your cmos.layout" #endif -#endif + +#else +#define CMOS_VSTART_ramtop 800 +#endif // CONFIG(USE_OPTION_TABLE) struct ramtop_table { uint32_t signature; @@ -41,7 +44,7 @@ static int ramtop_cmos_read(struct ramtop_table *ramtop) u16 csum; for (p = (u8 *)ramtop, i = 0; i < sizeof(*ramtop); i++, p++) - *p = cmos_read(RAMTOP_CMOS_OFFSET + i); + *p = cmos_read((CMOS_VSTART_ramtop / 8) + i); /* Verify signature */ if (ramtop->signature != RAMTOP_SIGNATURE) { @@ -70,7 +73,7 @@ static void ramtop_cmos_write(struct ramtop_table *ramtop) ramtop, offsetof(struct ramtop_table, checksum)); for (p = (u8 *)ramtop, i = 0; i < sizeof(*ramtop); i++, p++) - cmos_write(*p, RAMTOP_CMOS_OFFSET + i); + cmos_write(*p, (CMOS_VSTART_ramtop / 8) + i); } /* Update the RAMTOP if required based on the input top_of_ram address */ |