sb and soc: Enforce correct offset of member "chromeos" in global_nvs_t

The padding has recently been broken in commit 90ebf96df5
("soc/intel/skylake: Add GNVS variables and include SGX ASL") and fixed
again in commit af88398887 ("soc/intel/skylake: Fix broken GNVS offset
for chromeos").  Avoid this bug in the future.

Change-Id: I1bf3027bba239c8747ad26a3130a7e047d3b8c94
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-on: https://review.coreboot.org/22229
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Jonathan Neuschäfer 2017-10-30 17:20:18 +01:00 committed by Martin Roth
parent 7bd4715a70
commit 0781cbe1d3
12 changed files with 43 additions and 14 deletions

View File

@ -24,6 +24,7 @@
#ifndef __SOC_STONEYRIDGE_NVS_H__ #ifndef __SOC_STONEYRIDGE_NVS_H__
#define __SOC_STONEYRIDGE_NVS_H__ #define __SOC_STONEYRIDGE_NVS_H__
#include <commonlib/helpers.h>
#include <compiler.h> #include <compiler.h>
#include <stdint.h> #include <stdint.h>
#include <vendorcode/google/chromeos/gnvs.h> #include <vendorcode/google/chromeos/gnvs.h>
@ -48,5 +49,6 @@ typedef struct global_nvs_t {
/* ChromeOS specific (0x100 - 0xfff) */ /* ChromeOS specific (0x100 - 0xfff) */
chromeos_acpi_t chromeos; chromeos_acpi_t chromeos;
} __packed global_nvs_t; } __packed global_nvs_t;
check_member(global_nvs_t, chromeos, 0x100);
#endif /* __SOC_STONEYRIDGE_NVS_H__ */ #endif /* __SOC_STONEYRIDGE_NVS_H__ */

View File

@ -24,6 +24,7 @@
#ifndef _SOC_APOLLOLAKE_NVS_H_ #ifndef _SOC_APOLLOLAKE_NVS_H_
#define _SOC_APOLLOLAKE_NVS_H_ #define _SOC_APOLLOLAKE_NVS_H_
#include <commonlib/helpers.h>
#include <compiler.h> #include <compiler.h>
#include <vendorcode/google/chromeos/gnvs.h> #include <vendorcode/google/chromeos/gnvs.h>
@ -52,5 +53,6 @@ typedef struct global_nvs_t {
/* ChromeOS specific (0x100 - 0xfff) */ /* ChromeOS specific (0x100 - 0xfff) */
chromeos_acpi_t chromeos; chromeos_acpi_t chromeos;
} __packed global_nvs_t; } __packed global_nvs_t;
check_member(global_nvs_t, chromeos, 0x100);
#endif /* _SOC_APOLLOLAKE_NVS_H_ */ #endif /* _SOC_APOLLOLAKE_NVS_H_ */

View File

@ -17,11 +17,12 @@
#ifndef _BAYTRAIL_NVS_H_ #ifndef _BAYTRAIL_NVS_H_
#define _BAYTRAIL_NVS_H_ #define _BAYTRAIL_NVS_H_
#include <commonlib/helpers.h>
#include <compiler.h> #include <compiler.h>
#include <vendorcode/google/chromeos/gnvs.h> #include <vendorcode/google/chromeos/gnvs.h>
#include <soc/device_nvs.h> #include <soc/device_nvs.h>
typedef struct { typedef struct global_nvs_t {
/* Miscellaneous */ /* Miscellaneous */
u16 osys; /* 0x00 - Operating System */ u16 osys; /* 0x00 - Operating System */
u8 smif; /* 0x02 - SMI function call ("TRAP") */ u8 smif; /* 0x02 - SMI function call ("TRAP") */
@ -66,6 +67,7 @@ typedef struct {
/* Baytrail LPSS (0x1000) */ /* Baytrail LPSS (0x1000) */
device_nvs_t dev; device_nvs_t dev;
} __packed global_nvs_t; } __packed global_nvs_t;
check_member(global_nvs_t, chromeos, 0x100);
void acpi_create_gnvs(global_nvs_t *gnvs); void acpi_create_gnvs(global_nvs_t *gnvs);
#ifdef __SMM__ #ifdef __SMM__

View File

@ -18,12 +18,13 @@
#ifndef _SOC_NVS_H_ #ifndef _SOC_NVS_H_
#define _SOC_NVS_H_ #define _SOC_NVS_H_
#include <rules.h> #include <commonlib/helpers.h>
#include <compiler.h> #include <compiler.h>
#include <vendorcode/google/chromeos/gnvs.h> #include <rules.h>
#include <soc/device_nvs.h> #include <soc/device_nvs.h>
#include <vendorcode/google/chromeos/gnvs.h>
typedef struct { typedef struct global_nvs_t {
/* Miscellaneous */ /* Miscellaneous */
u16 osys; /* 0x00 - Operating System */ u16 osys; /* 0x00 - Operating System */
u8 smif; /* 0x02 - SMI function call ("TRAP") */ u8 smif; /* 0x02 - SMI function call ("TRAP") */
@ -70,6 +71,7 @@ typedef struct {
/* LPSS (0x1000) */ /* LPSS (0x1000) */
device_nvs_t dev; device_nvs_t dev;
} __packed global_nvs_t; } __packed global_nvs_t;
check_member(global_nvs_t, chromeos, 0x100);
void acpi_create_gnvs(global_nvs_t *gnvs); void acpi_create_gnvs(global_nvs_t *gnvs);
#if ENV_SMM #if ENV_SMM

View File

@ -17,11 +17,12 @@
#ifndef _BROADWELL_NVS_H_ #ifndef _BROADWELL_NVS_H_
#define _BROADWELL_NVS_H_ #define _BROADWELL_NVS_H_
#include <commonlib/helpers.h>
#include <compiler.h> #include <compiler.h>
#include <vendorcode/google/chromeos/gnvs.h>
#include <soc/device_nvs.h> #include <soc/device_nvs.h>
#include <vendorcode/google/chromeos/gnvs.h>
typedef struct { typedef struct global_nvs_t {
/* Miscellaneous */ /* Miscellaneous */
u16 osys; /* 0x00 - Operating System */ u16 osys; /* 0x00 - Operating System */
u8 smif; /* 0x02 - SMI function call ("TRAP") */ u8 smif; /* 0x02 - SMI function call ("TRAP") */
@ -58,6 +59,7 @@ typedef struct {
/* Device specific (0x1000) */ /* Device specific (0x1000) */
device_nvs_t dev; device_nvs_t dev;
} __packed global_nvs_t; } __packed global_nvs_t;
check_member(global_nvs_t, chromeos, 0x100);
void acpi_create_gnvs(global_nvs_t *gnvs); void acpi_create_gnvs(global_nvs_t *gnvs);
#ifdef __SMM__ #ifdef __SMM__

View File

@ -18,6 +18,7 @@
#ifndef _SOC_NVS_H_ #ifndef _SOC_NVS_H_
#define _SOC_NVS_H_ #define _SOC_NVS_H_
#include <commonlib/helpers.h>
#include <compiler.h> #include <compiler.h>
#include <vendorcode/google/chromeos/gnvs.h> #include <vendorcode/google/chromeos/gnvs.h>
@ -45,6 +46,7 @@ typedef struct global_nvs_t {
/* ChromeOS specific (0x100 - 0xfff) */ /* ChromeOS specific (0x100 - 0xfff) */
chromeos_acpi_t chromeos; chromeos_acpi_t chromeos;
} __packed global_nvs_t; } __packed global_nvs_t;
check_member(global_nvs_t, chromeos, 0x100);
#endif #endif

View File

@ -18,11 +18,12 @@
#ifndef _SOC_NVS_H_ #ifndef _SOC_NVS_H_
#define _SOC_NVS_H_ #define _SOC_NVS_H_
#include <rules.h> #include <commonlib/helpers.h>
#include <compiler.h> #include <compiler.h>
#include <rules.h>
#include <vendorcode/google/chromeos/gnvs.h> #include <vendorcode/google/chromeos/gnvs.h>
typedef struct { typedef struct global_nvs_t {
/* Miscellaneous */ /* Miscellaneous */
u16 osys; /* 0x00 - Operating System */ u16 osys; /* 0x00 - Operating System */
u8 smif; /* 0x02 - SMI function call ("TRAP") */ u8 smif; /* 0x02 - SMI function call ("TRAP") */
@ -66,6 +67,7 @@ typedef struct {
/* ChromeOS specific (0x100 - 0xfff) */ /* ChromeOS specific (0x100 - 0xfff) */
chromeos_acpi_t chromeos; chromeos_acpi_t chromeos;
} __packed global_nvs_t; } __packed global_nvs_t;
check_member(global_nvs_t, chromeos, 0x100);
#if ENV_SMM #if ENV_SMM
/* Used in SMM to find the ACPI GNVS address */ /* Used in SMM to find the ACPI GNVS address */

View File

@ -14,10 +14,12 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <stdint.h> #include <commonlib/helpers.h>
#include <compiler.h> #include <compiler.h>
#include <stdint.h>
#include "vendorcode/google/chromeos/gnvs.h" #include "vendorcode/google/chromeos/gnvs.h"
typedef struct {
typedef struct global_nvs_t {
/* Miscellaneous */ /* Miscellaneous */
u16 osys; /* 0x00 - Operating System */ u16 osys; /* 0x00 - Operating System */
u8 smif; /* 0x02 - SMI function call ("TRAP") */ u8 smif; /* 0x02 - SMI function call ("TRAP") */
@ -152,6 +154,7 @@ typedef struct {
/* ChromeOS specific (starts at 0x100)*/ /* ChromeOS specific (starts at 0x100)*/
chromeos_acpi_t chromeos; chromeos_acpi_t chromeos;
} __packed global_nvs_t; } __packed global_nvs_t;
check_member(global_nvs_t, chromeos, 0x100);
#ifdef __SMM__ #ifdef __SMM__
/* Used in SMM to find the ACPI GNVS address */ /* Used in SMM to find the ACPI GNVS address */

View File

@ -14,9 +14,11 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <commonlib/helpers.h>
#include <compiler.h> #include <compiler.h>
#include "vendorcode/google/chromeos/gnvs.h" #include "vendorcode/google/chromeos/gnvs.h"
typedef struct {
typedef struct global_nvs_t {
/* Miscellaneous */ /* Miscellaneous */
u16 osys; /* 0x00 - Operating System */ u16 osys; /* 0x00 - Operating System */
u8 smif; /* 0x02 - SMI function call ("TRAP") */ u8 smif; /* 0x02 - SMI function call ("TRAP") */
@ -148,6 +150,7 @@ typedef struct {
/* ChromeOS specific (starts at 0x100)*/ /* ChromeOS specific (starts at 0x100)*/
chromeos_acpi_t chromeos; chromeos_acpi_t chromeos;
} __packed global_nvs_t; } __packed global_nvs_t;
check_member(global_nvs_t, chromeos, 0x100);
#ifdef __SMM__ #ifdef __SMM__
/* Used in SMM to find the ACPI GNVS address */ /* Used in SMM to find the ACPI GNVS address */

View File

@ -14,9 +14,11 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <commonlib/helpers.h>
#include <compiler.h> #include <compiler.h>
#include "vendorcode/google/chromeos/gnvs.h" #include "vendorcode/google/chromeos/gnvs.h"
typedef struct {
typedef struct global_nvs_t {
/* Miscellaneous */ /* Miscellaneous */
u16 osys; /* 0x00 - Operating System */ u16 osys; /* 0x00 - Operating System */
u8 smif; /* 0x02 - SMI function call ("TRAP") */ u8 smif; /* 0x02 - SMI function call ("TRAP") */
@ -148,6 +150,7 @@ typedef struct {
/* ChromeOS specific (starts at 0x100)*/ /* ChromeOS specific (starts at 0x100)*/
chromeos_acpi_t chromeos; chromeos_acpi_t chromeos;
} __packed global_nvs_t; } __packed global_nvs_t;
check_member(global_nvs_t, chromeos, 0x100);
#ifdef __SMM__ #ifdef __SMM__
/* Used in SMM to find the ACPI GNVS address */ /* Used in SMM to find the ACPI GNVS address */

View File

@ -14,9 +14,11 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <commonlib/helpers.h>
#include <compiler.h> #include <compiler.h>
#include "vendorcode/google/chromeos/gnvs.h" #include "vendorcode/google/chromeos/gnvs.h"
typedef struct {
typedef struct global_nvs_t {
/* Miscellaneous */ /* Miscellaneous */
u16 osys; /* 0x00 - Operating System */ u16 osys; /* 0x00 - Operating System */
u8 smif; /* 0x02 - SMI function call ("TRAP") */ u8 smif; /* 0x02 - SMI function call ("TRAP") */
@ -150,6 +152,7 @@ typedef struct {
/* ChromeOS specific (starts at 0x100)*/ /* ChromeOS specific (starts at 0x100)*/
chromeos_acpi_t chromeos; chromeos_acpi_t chromeos;
} __packed global_nvs_t; } __packed global_nvs_t;
check_member(global_nvs_t, chromeos, 0x100);
#ifdef __SMM__ #ifdef __SMM__
/* Used in SMM to find the ACPI GNVS address */ /* Used in SMM to find the ACPI GNVS address */

View File

@ -14,9 +14,11 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <commonlib/helpers.h>
#include <compiler.h> #include <compiler.h>
#include "vendorcode/google/chromeos/gnvs.h" #include "vendorcode/google/chromeos/gnvs.h"
typedef struct {
typedef struct global_nvs_t {
/* Miscellaneous */ /* Miscellaneous */
u16 osys; /* 0x00 - Operating System */ u16 osys; /* 0x00 - Operating System */
u8 smif; /* 0x02 - SMI function call ("TRAP") */ u8 smif; /* 0x02 - SMI function call ("TRAP") */
@ -126,6 +128,7 @@ typedef struct {
/* ChromeOS specific (starts at 0x100)*/ /* ChromeOS specific (starts at 0x100)*/
chromeos_acpi_t chromeos; chromeos_acpi_t chromeos;
} __packed global_nvs_t; } __packed global_nvs_t;
check_member(global_nvs_t, chromeos, 0x100);
#ifdef __SMM__ #ifdef __SMM__
/* Used in SMM to find the ACPI GNVS address */ /* Used in SMM to find the ACPI GNVS address */