Nico Huber (nico.h(a)gmx.de) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17992
-gerrit
commit e45b48d28023b4eed345250b0c8f96958660e15f
Author: Martin Roth <martinroth(a)google.com>
Date: Thu Dec 29 14:03:50 2016 -0700
amdmct: Fix offset calculation in mct_ResetDataStruct_D()
The code was intentionally using an offset past the end of the array to
get the value of the next byte when starting to clear the structure.
The calculated offset was too far off. So rewrite it using offsetof()
and sizeof() which is less error-prone. Also make use of memset() and
put a comment into the struct's declaration about the fragile code.
A correct solution would require more extensive refactoring (e.g.
moving the skipped fields out of the struct).
Fixes warning for GCC 6.2 toolchain update:
src/northbridge/amd/amdfam10/../amdmct/mct/mct_d.c:3628:27:
In function 'mct_ResetDataStruct_D':
error: index 2 denotes an offset greater than size of 'u8[2][4]
{aka unsigned char[2][4]}' [-Werror=array-bounds]
Change-Id: Ic81cf5e57992fc0e45f6c96b62a35742a8ef891f
Signed-off-by: Martin Roth <martinroth(a)google.com>
Signed-off-by: Nico Huber <nico.huber(a)secunet.com>
---
src/northbridge/amd/amdmct/mct/mct_d.c | 25 ++++++++++---------------
src/northbridge/amd/amdmct/mct/mct_d.h | 5 +++++
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/northbridge/amd/amdmct/mct/mct_d.c b/src/northbridge/amd/amdmct/mct/mct_d.c
index 62fc626..779a8a5 100644
--- a/src/northbridge/amd/amdmct/mct/mct_d.c
+++ b/src/northbridge/amd/amdmct/mct/mct_d.c
@@ -3601,35 +3601,30 @@ static void mct_ResetDataStruct_D(struct MCTStatStruc *pMCTstat,
struct DCTStatStruc *pDCTstatA)
{
u8 Node;
- u32 i;
struct DCTStatStruc *pDCTstat;
- u32 start, stop;
+ size_t start, stop;
u8 *p;
u16 host_serv1, host_serv2;
/* Initialize Data structures by clearing all entries to 0 */
- p = (u8 *) pMCTstat;
- for (i = 0; i < sizeof(struct MCTStatStruc); i++) {
- p[i] = 0;
- }
+ memset(pMCTstat, 0x00, sizeof(*pMCTstat));
for (Node = 0; Node < 8; Node++) {
pDCTstat = pDCTstatA + Node;
host_serv1 = pDCTstat->HostBiosSrvc1;
host_serv2 = pDCTstat->HostBiosSrvc2;
- p = (u8 *) pDCTstat;
+ /* clear everything but CH_D_DIR_B_DQS .. CH_D_BC_RCVRDLY */
+ p = (u8 *)pDCTstat;
start = 0;
- stop = (u32)(&((struct DCTStatStruc *)0)->CH_MaxRdLat[2]);
- for (i = start; i < stop; i++) {
- p[i] = 0;
- }
+ stop = offsetof(struct DCTStatStruc, CH_D_DIR_B_DQS);
+ memset(p + start, 0x00, stop - start);
- start = (u32)(&((struct DCTStatStruc *)0)->CH_D_BC_RCVRDLY[2][4]);
+ start = (u32)(offsetof(struct DCTStatStruc, CH_D_BC_RCVRDLY)
+ + sizeof(pDCTstat->CH_D_BC_RCVRDLY));
stop = sizeof(struct DCTStatStruc);
- for (i = start; i < stop; i++) {
- p[i] = 0;
- }
+ memset(p + start, 0x00, stop - start);
+
pDCTstat->HostBiosSrvc1 = host_serv1;
pDCTstat->HostBiosSrvc2 = host_serv2;
}
diff --git a/src/northbridge/amd/amdmct/mct/mct_d.h b/src/northbridge/amd/amdmct/mct/mct_d.h
index 4e1a909..fbfbf6f 100644
--- a/src/northbridge/amd/amdmct/mct/mct_d.h
+++ b/src/northbridge/amd/amdmct/mct/mct_d.h
@@ -451,6 +451,9 @@ struct DCTStatStruc { /* A per Node structure*/
u16 CH_MaxRdLat[2]; /* Max Read Latency (ns) for DCT 0*/
/* Max Read Latency (ns) for DCT 1*/
+
+ /* DON'T MOVE the following declarations. They form a
+ region that's to be skipped in mct_ResetDataStruct_D(). */
u8 CH_D_DIR_B_DQS[2][4][2][9]; /* [A/B] [DIMM1-4] [R/W] [DQS] */
/* CHA DIMM0 Byte 0 - 7 and Check Write DQS Delay*/
/* CHA DIMM0 Byte 0 - 7 and Check Read DQS Delay*/
@@ -473,6 +476,8 @@ struct DCTStatStruc { /* A per Node structure*/
u8 CH_D_BC_RCVRDLY[2][4];
/* CHA DIMM 0 - 4 Check Byte Receiver Enable Delay*/
/* CHB DIMM 0 - 4 Check Byte Receiver Enable Delay*/
+ /* END DON'T MOVE (see above) */
+
u8 DIMMValidDCT[2]; /* DIMM# in DCT0*/
/* DIMM# in DCT1*/
u8 MaxDCTs; /* Max number of DCTs in system*/
Nico Huber (nico.h(a)gmx.de) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17992
-gerrit
commit b0774dbce285848f37cd87a0bb31be39b5fe5238
Author: Martin Roth <martinroth(a)google.com>
Date: Thu Dec 29 14:03:50 2016 -0700
amdmct: Fix offset calculation in mct_ResetDataStruct_D()
The code was intentionally using an offset past the end of the array to
get the value of the next byte when starting to clear the structure.
The calculated offset was too far off. So rewrite it using offsetof()
and sizeof() which is less error-prone. Also make use of memset() and
put a comment into the struct's declaration about the fragile code.
A correct solution would require more extensive refactoring (e.g.
moving the skipped fields out of the struct).
Fixes warning for GCC 6.2 toolchain update:
src/northbridge/amd/amdfam10/../amdmct/mct/mct_d.c:3628:27:
In function 'mct_ResetDataStruct_D':
error: index 2 denotes an offset greater than size of 'u8[2][4]
{aka unsigned char[2][4]}' [-Werror=array-bounds]
Change-Id: Ic81cf5e57992fc0e45f6c96b62a35742a8ef891f
Signed-off-by: Martin Roth <martinroth(a)google.com>
Signed-off-by: Nico Huber <nico.huber(a)secunet.com>
---
src/northbridge/amd/amdmct/mct/mct_d.c | 24 ++++++++++--------------
src/northbridge/amd/amdmct/mct/mct_d.h | 5 +++++
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/northbridge/amd/amdmct/mct/mct_d.c b/src/northbridge/amd/amdmct/mct/mct_d.c
index 62fc626..2d4970e 100644
--- a/src/northbridge/amd/amdmct/mct/mct_d.c
+++ b/src/northbridge/amd/amdmct/mct/mct_d.c
@@ -3603,33 +3603,29 @@ static void mct_ResetDataStruct_D(struct MCTStatStruc *pMCTstat,
u8 Node;
u32 i;
struct DCTStatStruc *pDCTstat;
- u32 start, stop;
+ size_t start, stop;
u8 *p;
u16 host_serv1, host_serv2;
/* Initialize Data structures by clearing all entries to 0 */
- p = (u8 *) pMCTstat;
- for (i = 0; i < sizeof(struct MCTStatStruc); i++) {
- p[i] = 0;
- }
+ memset(pMCTstat, 0x00, sizeof(*pMCTstat));
for (Node = 0; Node < 8; Node++) {
pDCTstat = pDCTstatA + Node;
host_serv1 = pDCTstat->HostBiosSrvc1;
host_serv2 = pDCTstat->HostBiosSrvc2;
- p = (u8 *) pDCTstat;
+ /* clear everything but CH_D_DIR_B_DQS .. CH_D_BC_RCVRDLY */
+ p = (u8 *)pDCTstat;
start = 0;
- stop = (u32)(&((struct DCTStatStruc *)0)->CH_MaxRdLat[2]);
- for (i = start; i < stop; i++) {
- p[i] = 0;
- }
+ stop = offsetof(struct DCTStatStruc, CH_D_DIR_B_DQS);
+ memset(p + start, 0x00, stop - start);
- start = (u32)(&((struct DCTStatStruc *)0)->CH_D_BC_RCVRDLY[2][4]);
+ start = (u32)(offsetof(struct DCTStatStruc, CH_D_BC_RCVRDLY)
+ + sizeof(pDCTstat->CH_D_BC_RCVRDLY));
stop = sizeof(struct DCTStatStruc);
- for (i = start; i < stop; i++) {
- p[i] = 0;
- }
+ memset(p + start, 0x00, stop - start);
+
pDCTstat->HostBiosSrvc1 = host_serv1;
pDCTstat->HostBiosSrvc2 = host_serv2;
}
diff --git a/src/northbridge/amd/amdmct/mct/mct_d.h b/src/northbridge/amd/amdmct/mct/mct_d.h
index 4e1a909..fbfbf6f 100644
--- a/src/northbridge/amd/amdmct/mct/mct_d.h
+++ b/src/northbridge/amd/amdmct/mct/mct_d.h
@@ -451,6 +451,9 @@ struct DCTStatStruc { /* A per Node structure*/
u16 CH_MaxRdLat[2]; /* Max Read Latency (ns) for DCT 0*/
/* Max Read Latency (ns) for DCT 1*/
+
+ /* DON'T MOVE the following declarations. They form a
+ region that's to be skipped in mct_ResetDataStruct_D(). */
u8 CH_D_DIR_B_DQS[2][4][2][9]; /* [A/B] [DIMM1-4] [R/W] [DQS] */
/* CHA DIMM0 Byte 0 - 7 and Check Write DQS Delay*/
/* CHA DIMM0 Byte 0 - 7 and Check Read DQS Delay*/
@@ -473,6 +476,8 @@ struct DCTStatStruc { /* A per Node structure*/
u8 CH_D_BC_RCVRDLY[2][4];
/* CHA DIMM 0 - 4 Check Byte Receiver Enable Delay*/
/* CHB DIMM 0 - 4 Check Byte Receiver Enable Delay*/
+ /* END DON'T MOVE (see above) */
+
u8 DIMMValidDCT[2]; /* DIMM# in DCT0*/
/* DIMM# in DCT1*/
u8 MaxDCTs; /* Max number of DCTs in system*/
Boon Tiong Teo (boon.tiong.teo(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17976
-gerrit
commit c4f206f57160561c8d31d8d1907f3b931ab97ed9
Author: Teo Boon Tiong <boon.tiong.teo(a)intel.com>
Date: Wed Dec 28 18:56:26 2016 +0800
driver/intel/fsp1_1: Fix boot failure for non-verstage case
Currently car_stage_entry is defined only in romstage_after_verstage and
as a result when SEPARATE_VERSTAGE is not selected, there is no
entry point into romstage. So, use the same entry point in either case.
Change-Id: I1cd2cf5655fdff6e23b7b76c3974e7dfd3835efd
Signed-off-by: Teo Boon Tiong <boon.tiong.teo(a)intel.com>
---
src/drivers/intel/fsp1_1/Makefile.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/drivers/intel/fsp1_1/Makefile.inc b/src/drivers/intel/fsp1_1/Makefile.inc
index 4088293..39a688d 100644
--- a/src/drivers/intel/fsp1_1/Makefile.inc
+++ b/src/drivers/intel/fsp1_1/Makefile.inc
@@ -28,7 +28,7 @@ romstage-y += fsp_util.c
romstage-y += hob.c
romstage-y += raminit.c
romstage-y += romstage.c
-romstage-$(CONFIG_SEPARATE_VERSTAGE) += romstage_after_verstage.S
+romstage-$(CONFIG_C_ENVIRONMENT_BOOTBLOCK) += romstage_after_verstage.S
romstage-y += stack.c
romstage-y += stage_cache.c
romstage-$(CONFIG_MMA) += mma_core.c
Boon Tiong Teo (boon.tiong.teo(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17976
-gerrit
commit c63224050f6a06e96cc78bec8929219c2e1be109
Author: Teo Boon Tiong <boon.tiong.teo(a)intel.com>
Date: Wed Dec 28 18:56:26 2016 +0800
driver/intel/fsp1_1: Fix boot failure for non-verstage case
Currently car_stage_entry is defined only in romstage_after_verstage and
as a result when SEPARATE_VERSTAGE is not selected, there is no
entry point into romstage. So, use the same entry point in either case.
Change-Id: I1cd2cf5655fdff6e23b7b76c3974e7dfd3835efd
Signed-off-by: Teo Boon Tiong <boon.tiong.teo(a)intel.com>
---
src/drivers/intel/fsp1_1/Makefile.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/drivers/intel/fsp1_1/Makefile.inc b/src/drivers/intel/fsp1_1/Makefile.inc
index 4088293..a3261df 100644
--- a/src/drivers/intel/fsp1_1/Makefile.inc
+++ b/src/drivers/intel/fsp1_1/Makefile.inc
@@ -28,7 +28,7 @@ romstage-y += fsp_util.c
romstage-y += hob.c
romstage-y += raminit.c
romstage-y += romstage.c
-romstage-$(CONFIG_SEPARATE_VERSTAGE) += romstage_after_verstage.S
+romstage-y += romstage_after_verstage.S
romstage-y += stack.c
romstage-y += stage_cache.c
romstage-$(CONFIG_MMA) += mma_core.c
Boon Tiong Teo (boon.tiong.teo(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17976
-gerrit
commit a61b46f185e2b90e3f424dbee5173c5df96cb74c
Author: Teo Boon Tiong <boon.tiong.teo(a)intel.com>
Date: Wed Dec 28 18:56:26 2016 +0800
fsp1_1: Fix boot failure for non-verstage case
Currently car_stage_entry is defined only in romstage_after_verstage and
as a result when SEPARATE_VERSTAGE is not selected, there is no
entry point into romstage. So, use the same entry point in either case.
Change-Id: I1cd2cf5655fdff6e23b7b76c3974e7dfd3835efd
Signed-off-by: Teo Boon Tiong <boon.tiong.teo(a)intel.com>
---
src/drivers/intel/fsp1_1/Makefile.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/drivers/intel/fsp1_1/Makefile.inc b/src/drivers/intel/fsp1_1/Makefile.inc
index 4088293..a3261df 100644
--- a/src/drivers/intel/fsp1_1/Makefile.inc
+++ b/src/drivers/intel/fsp1_1/Makefile.inc
@@ -28,7 +28,7 @@ romstage-y += fsp_util.c
romstage-y += hob.c
romstage-y += raminit.c
romstage-y += romstage.c
-romstage-$(CONFIG_SEPARATE_VERSTAGE) += romstage_after_verstage.S
+romstage-y += romstage_after_verstage.S
romstage-y += stack.c
romstage-y += stage_cache.c
romstage-$(CONFIG_MMA) += mma_core.c
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18024
-gerrit
commit 4640b12db36a604dbb339932ce4a6f145468f1ab
Author: Martin Roth <martinroth(a)google.com>
Date: Mon Jan 2 19:55:11 2017 -0700
3rdparty/arm-trusted-firmware: Update to Dec 23, 2016 master
177 commits between Sep 20, 2016 and Dec 23, 2016
Change-Id: I49695f3287a742cd1fb603b890d124f60788f88f
Signed-off-by: Martin Roth <martinroth(a)google.com>
---
3rdparty/arm-trusted-firmware | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/3rdparty/arm-trusted-firmware b/3rdparty/arm-trusted-firmware
index bfd9251..cef7b3c 160000
--- a/3rdparty/arm-trusted-firmware
+++ b/3rdparty/arm-trusted-firmware
@@ -1 +1 @@
-Subproject commit bfd925139fdbc2e87979849907b34843aa326994
+Subproject commit cef7b3ce8b26cd94e7e71ddeefc039451525b780